TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Farooque Ali
1.5k
255
242.7k
Select the Drawned text during runtime for modification and move
Jun 14 2011 2:57 AM
Hi,
Am doing the imaging application. Here i was done the drawing a text on picturebix. It is working fine.
Now i need to select that text and modify the size and color. And also i have move the text througout the picturebox.
Am working on that, but am not able to find the solution.
Can anyone please tell me how to do this.
Below is the code for draw the text
public void InsertText(string text, int xPosition, int yPosition, string fontname, float fontsize, string fontstyle, string colorname)
{
Bitmap temp = (Bitmap)bmp;
Bitmap bmap = (Bitmap)temp.Clone();
Graphics gr = Graphics.FromImage(bmap);
if (string.IsNullOrEmpty(fontname))
fontname = "Times New Roman";
if (fontsize.Equals(null))
fontsize = 10.0F;
Font font = new Font(fontname, fontsize);
if (!string.IsNullOrEmpty(fontstyle))
{
FontStyle fstyle = FontStyle.Regular;
switch (fontstyle.ToLower())
{
case "bold":
fstyle = FontStyle.Bold;
break;
case "italic":
fstyle = FontStyle.Italic;
break;
case "underline":
fstyle = FontStyle.Underline;
break;
case "strikeout":
fstyle = FontStyle.Strikeout;
break;
}
font = new Font(fontname, fontsize, fstyle);
}
if (string.IsNullOrEmpty(colorname))
colorname = "Black";
Color color1 = Color.FromName(colorname);
int gW = (int)(text.Length * fontsize);
gW = gW == 0 ? 10 : gW;
LinearGradientBrush LGBrush = new LinearGradientBrush(new Rectangle(0, 0, gW, (int)fontsize), color1, color1, LinearGradientMode.Vertical);
//lbltext.Visible = true;
//lbltext.ForeColor = color1;
//lbltext.Location = new Point(xPosition, yPosition);
//lbltext.Text = text;
//gr.DrawString(text, font, Brushes.White, new PointF(xPos, yPos));
gr.DrawString(text, font, LGBrush, new PointF(xPosition, yPosition));
temp = (Bitmap)bmap.Clone();
pictureBox1.Image = temp;
}
}
Reply
Answers (
3
)
what is the meaning of publish
Mobile web application interface loading issue on windows phone..