| | |
creating shape like circle or oval(i wanted to design my own circle shape)
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2006
Posts: 14
Reputation:
Solved Threads: 0
Actually, I created other shape such as trapezium, parallelogram, by using the addlines.
I created them by having a middle point of the shape start from (x,y) - (100,100)
but when i straight use the build in function to draw ellipse, i can't find any ways to set the mid point of the ellipse start from (100,100)
I do that is because when the user need to change from one shape to another, the position of it wont be changing because all of the shape started from 100,100
Any idea of drawing my own ellipse so that i can start from position 100,100 ??
Any help would be very appreciated
I created them by having a middle point of the shape start from (x,y) - (100,100)
but when i straight use the build in function to draw ellipse, i can't find any ways to set the mid point of the ellipse start from (100,100)
I do that is because when the user need to change from one shape to another, the position of it wont be changing because all of the shape started from 100,100
Any idea of drawing my own ellipse so that i can start from position 100,100 ??
Any help would be very appreciated
Hi, You can perform the Transformation on your Points(By just adding or subtracting (100, 100) to each points). GDI+ uses (0,0) is the Mid point. But it provides Matrix class to Transform the Coordinate System.
Example to Transform the Coordinate System
Here first Circle will be drawn Blue color and (0,0) as the starting point
Second circle will use the Transformation and (100,100) as the starting Point
I think this may helpful to you
Example to Transform the Coordinate System
C# Syntax (Toggle Plain Text)
private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rect = new Rectangle (0,0,100,100); Matrix matrix = new Matrix(); g.DrawEllipse(Pens.Blue, rect); matrix.Translate(100, 100); g.Transform = matrix; g.DrawEllipse(Pens.Green, rect); }
Here first Circle will be drawn Blue color and (0,0) as the starting point
Second circle will use the Transformation and (100,100) as the starting Point
I think this may helpful to you
Last edited by selvaganapathy; Jul 27th, 2008 at 12:47 pm.
KSG
![]() |
Other Threads in the C# Forum
- Previous Thread: SaveFileDialog Extensions
- Next Thread: ListBox C#
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# cast check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mailmerge mandelbrot math mouseclick mysql operator path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox robot save saving serialization server sleep socket sockets sql sql-server statistics stream string stringformatting sun table tcp text textbox thread time timer update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





