gdi+ reverse coordinates

  • Thread starter Thread starter Ron Dahl
  • Start date Start date
R

Ron Dahl

I would like to permanently have the lower left portion of my graphics
object be (0,0) and the coordinae values to increase to the right and
upward.

In other words, point(10,30) would be 20 units above point (10,10).

I looked at graphics.translatetransform and graphics.scaletransform, but it
quickly overwhelmed me.

Can anyone give me a simple example of how I could do this?

Thanks in advance for any help.
Ron Dahl
 
You can try this

Imports System.Drawing.Drawing2D

Private Sub TestingForm_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

PaintCircles(e)

End Sub

Private Sub PaintCircles(ByRef e As System.Windows.Forms.PaintEventArgs)

e.Graphics.ResetTransform()
e.Graphics.ScaleTransform(1, -1)
e.Graphics.TranslateTransform(0, Me.Size.Height, MatrixOrder.Append)

e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 50, 50, 100, 100)
e.Graphics.DrawEllipse(New Pen(Color.Chocolate, 3), 50, 150, 100,
100)


End Sub

The blue circle at (50, 50) should appear below the chocolate circle at
(50, 150) near the bottom of the form.

I've noticed that although the Paint event fires went the form is resized
the shapes drawn with the Graphics object to not refresh unless the portion
of the form where they are is moved off screen and then brought back on
screen. Does anyone know how to get them to refresh with doing this?

--Robby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top