473,474 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

gdi+ reverse coordinates

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

Nov 21 '05 #1
2 1530

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
"Ron Dahl" <rd***@ghp.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #2
There is an article in the GDI+ FAQ that explains how to do this and draw
text up the right way too.

http://www.bobpowell.net/reverseaxistext.htm
--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Ron Dahl" <rd***@ghp.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christian Jacob | last post by:
Hello, I need to dynamically create room-plans which are supposed to highlight given rooms. For this, I've got room-plan templates which ahow the outline of the rooms of a building. Now I want...
1
by: herbert | last post by:
The following code, copied from MSDN article "Using Matrix Transformation in System.Drawing" creates an OutOfMemoryException when creating the Matrix. The downloaded MSDN source code works fine....
6
by: James dean | last post by:
I want a good site that will show clearly how much more functionality GDI+ has. I cannot seem to find anything other than sites that list "some" of the new functionality that GDI+ offers. A...
3
by: Boni | last post by:
Dear all, I need a picturebox on which I can with GDI+ draw rectangles. The scroll and zoom should be supported. Do I have to manually resize rectangles,when zoom button clicked and change...
7
by: Peter Row | last post by:
Hi, I've started work on my own control some parts of which use standard controls, others I need to draw on my controls surface to get the display output I require, however.... I seem to be...
7
by: Marcin Rzeznicki | last post by:
Hello, Do you think it is legitimate practice to mix GDI+ and GDI calls (via Get/ReleaseHDC()) in paint event of a control? I've heard there is possibility of performance loss while "locking"...
3
by: Fabio | last post by:
Hi all! A question about transformations. Let's have this piece of code that transforms the coordinates of the Graphics object: --------- Graphics g = e.Graphics; Matrix m = g.Transform;
10
by: sklett | last post by:
I have a situation where I'm getting in Image that has a gray (solid, same color) background with a smaller white rectangle inside. The position is not always the same. What I need to do is...
1
by: sunnyluthra1 | last post by:
Hi, I was creating an Application in MS Access for Geocoding a particular Address from Google to get the Lat & Long. I successfully able to did that. Here is the code:...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.