Generating Text bitmap from Graphics
-
Hi, All. My application have to generate a text bitmap. The text string is inputted by user, and will be drawn on a panel witin a fixed region. so the string is auto wrapped with multi-line. I would like to save the display text into a bitmap file (same as the preview with auto wrapped). Does anyone know how to do ? Could you please provide me some examples ? Thank you so much !!
-
Hi, All. My application have to generate a text bitmap. The text string is inputted by user, and will be drawn on a panel witin a fixed region. so the string is auto wrapped with multi-line. I would like to save the display text into a bitmap file (same as the preview with auto wrapped). Does anyone know how to do ? Could you please provide me some examples ? Thank you so much !!
-
Hi, All. My application have to generate a text bitmap. The text string is inputted by user, and will be drawn on a panel witin a fixed region. so the string is auto wrapped with multi-line. I would like to save the display text into a bitmap file (same as the preview with auto wrapped). Does anyone know how to do ? Could you please provide me some examples ? Thank you so much !!
Create a new Graphis object and use DrawString function....
.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
Hi, All. My application have to generate a text bitmap. The text string is inputted by user, and will be drawn on a panel witin a fixed region. so the string is auto wrapped with multi-line. I would like to save the display text into a bitmap file (same as the preview with auto wrapped). Does anyone know how to do ? Could you please provide me some examples ? Thank you so much !!
-
Hello, Do I understand it write, that you have the Text allready in your panel and make a bitmap (like screenshot) from the panel? Martin
yes, correct. I have already used the drawString to draw text on Panel. But don't know how to generate a bitmap. Here is my example code for drawing the string:
string txt = "AbcdefgHigklmnopqrstuvWxyz.AbcdefgHigklmnopqrstuvWxyz.***(AbcdefgHigklmnopqrstuvWxyz)@#!!!) (AbcdefgHigklmnopqrstuvWxyZ)ZZZZZZZ"; StringFormat drawFormat = new StringFormat(); drawFormat.FormatFlags = StringFormatFlags.DisplayFormatControl; drawFormat.Trimming = StringTrimming.Character; drawFormat.LineAlignment = StringAlignment.Near; // start from top line g.DrawRectangle(Pens.Red, new Rectangle(100, 100, 200, 500)); g.DrawString(txt, f, Brushes.Black, new RectangleF(100, 100, 200, 500), drawFormat);
-
Create a new Graphis object and use DrawString function....
.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
yes, correct. I have already used the drawString to draw text on Panel. But don't know how to generate a bitmap. Here is my example code for drawing the string:
string txt = "AbcdefgHigklmnopqrstuvWxyz.AbcdefgHigklmnopqrstuvWxyz.***(AbcdefgHigklmnopqrstuvWxyz)@#!!!) (AbcdefgHigklmnopqrstuvWxyZ)ZZZZZZZ"; StringFormat drawFormat = new StringFormat(); drawFormat.FormatFlags = StringFormatFlags.DisplayFormatControl; drawFormat.Trimming = StringTrimming.Character; drawFormat.LineAlignment = StringAlignment.Near; // start from top line g.DrawRectangle(Pens.Red, new Rectangle(100, 100, 200, 500)); g.DrawString(txt, f, Brushes.Black, new RectangleF(100, 100, 200, 500), drawFormat);