eramgarden
Well-known member
- Joined
- Mar 8, 2004
- Messages
- 579
I have 700x500 canvas.
I have an image.
how can I center the image on the canvas?
If i have: gr.DrawImage(b, 0.0F, 0.0F)..this draws it on the left hand corner of the canvas..
This is what i have:
Any ideas??
I have an image.
how can I center the image on the canvas?
If i have: gr.DrawImage(b, 0.0F, 0.0F)..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))
[b]gr.DrawImage(b, 0.0F, 0.0F)[/b]
Any ideas??