New to C#
I have some c# code i am trying to modify.
I want to set the pen.with to a fixed with when id draws on the canvas.
I did not write this code just trying to find out where the pen.with is.
Thanks for any help and comments
I have some c# code i am trying to modify.
I want to set the pen.with to a fixed with when id draws on the canvas.
I did not write this code just trying to find out where the pen.with is.
private void DrawMainCanvas() { using (Graphics g = Graphics.FromImage(todraw_bmp)) { g.Clear(Color.White); g.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height)); if (sb_ShowAllLines.Checked) { DrawRects(todraw_bmp, rects); } foreach (DrawRect r in LinesToDisplay) { if (r.str != "") { g.DrawString(r.str, r.font, new SolidBrush(r.clr), r.rect.X, r.rect.Y); SizeF textsize = g.MeasureString(r.str, r.font); r.rect.Width = (int) textsize.Width; //r.rect.Width = 16; r.rect.Height = (int) textsize.Height; } else { if (sb_Transparent.Checked) { g.FillRectangle(new SolidBrush(Color.FromArgb(128, r.clr.R, r.clr.G, r.clr.B)), r.rect); } else { g.FillRectangle(new SolidBrush(r.clr), r.rect); } } } } Image.bmp_to_screen(); } private void pictureBox1_Paint(object sender, PaintEventArgs e) { if (loaded) { if (ActiveObj != null) { if (ActiveObj.obj.str == "") //selected line { Brush BrushRectSmall = new HatchBrush(HatchStyle.Percent50, Color.FromArgb(128, 128, 128, 128)); e.Graphics.FillRectangle(BrushRectSmall, Image.to_scr(ActiveObj.PointRect(1))); e.Graphics.FillRectangle(BrushRectSmall, Image.to_scr(ActiveObj.PointRect(2))); e.Graphics.DrawLine(Pens.Black, Center(Image.to_scr(ActiveObj.PointRect(1))), Center(Image.to_scr(ActiveObj.PointRect(2)))); } else //selected text { e.Graphics.DrawRectangle(Pens.Black, Image.to_scr(ActiveObj.DrawRect())); } } } }
Thanks for any help and comments
Last edited by a moderator: