C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » C# Syntax »

how to use trim function


Posted Date: 03 Jan 2009    Resource Type: Code Snippets    Category: C# Syntax
Author: MuruganMember Level: Gold    
Rating: 1 out of 5Points: 10




This code shows how to use trim function


using System;
using System.Drawing;
using System.Windows.Forms;

class TrimmingTheText: Form
{
public static void Main()
{
Application.Run(new TrimmingTheText());
}
public TrimmingTheText()
{
Text = "Trimming the Text";
ResizeRedraw = true;
}
protected override void OnPaint(PaintEventArgs pea)
{
DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
}
protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
{
Brush brush = new SolidBrush(clr);
float cyText = Font.GetHeight(grfx);
float cyRect = cyText;
RectangleF rectf = new RectangleF(0, 0, cx, cyRect);
string str = "welcome to string trimming ";
StringFormat strfmt = new StringFormat();

strfmt.Trimming = StringTrimming.Character;
grfx.DrawString("Character: " + str, Font, brush, rectf, strfmt);

}
}







Responses

Author: murugan    03 Jan 2009Member Level: Bronze   Points : 0
thank u for posting string function

keep posting

kliugi


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
String trimming in c#  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Check UnCheck The Checkboxes
Previous Resource: File Upload
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use