Image Center
-
I have 700x500 canvas. I have an image. [b] how can I center the image on the canvas?[b] If i have: [b]gr.DrawImage(b, 0.0F, 0.0F)[/b]..this draws it on the left hand corner of the canvas.. This is what i have: [code] Dim g As Graphics = Graphics.FromImage(b) Dim gr As Graphics = Graphics.FromImage(Canvas) Dim imageH As Single = Convert.ToSingle(b.Height) Dim imageW As Single = Convert.ToSingle(b.Width) Dim CanH As Single = Convert.ToSingle(Canvas.Height) Dim canW As Single = Convert.ToSingle(Canvas.Width) Dim bgBrush = New SolidBrush(System.Drawing.Color.White) gr.FillRectangle(bgBrush, New Rectangle(0, 0, 700, 500)) gr.DrawImage(b, 0.0F, 0.0F) [/code] any ideas?
-
I have 700x500 canvas. I have an image. [b] how can I center the image on the canvas?[b] If i have: [b]gr.DrawImage(b, 0.0F, 0.0F)[/b]..this draws it on the left hand corner of the canvas.. This is what i have: [code] Dim g As Graphics = Graphics.FromImage(b) Dim gr As Graphics = Graphics.FromImage(Canvas) Dim imageH As Single = Convert.ToSingle(b.Height) Dim imageW As Single = Convert.ToSingle(b.Width) Dim CanH As Single = Convert.ToSingle(Canvas.Height) Dim canW As Single = Convert.ToSingle(Canvas.Width) Dim bgBrush = New SolidBrush(System.Drawing.Color.White) gr.FillRectangle(bgBrush, New Rectangle(0, 0, 700, 500)) gr.DrawImage(b, 0.0F, 0.0F) [/code] any ideas?
found my answer.