Vectorial Drawing

  • Thread starter Thread starter Leo
  • Start date Start date
L

Leo

Hi :

I search some articles explaining how to make a little VectorialDesign
application with simple shape like line circles etc ... in C#


thx !!!

~leo~
 
Leo said:
Hi :

I search some articles explaining how to make a little VectorialDesign
application with simple shape like line circles etc ... in C#


thx !!!

~leo~

some examples from sdk:

class PlainForm : Form

{

protected override void OnPaint(PaintEventArgs e)

{

Pen myPen = new Pen(Color.Red, 3);

Graphics myGraphics = e.Graphics;

myGraphics.DrawLine(myPen, 20, 10, 200, 100);

}

}



then just create object of PlainForm :

PlainForm Frm = new PlainForm();

Frm.Show();



put the needed code into OnPaint

for drawing arcs use something like

myGraphics.DrawArc(myPen, 100, 50, 140, 70, 30, 180);

for rectangle

myGraphics.DrawRectangle(myPen, 20, 10, 100, 50);

for polygons

Point[] myPointArray =
{new Point(0, 0), new Point(50, 30), new Point(30, 60)};
myGraphics.DrawPolygon(myPen, myPointArray);

for images something like

Bitmap myBMP = new Bitmap("SpaceCadet.bmp");
Bitmap myGIF = new Bitmap("Soda.gif");
Bitmap myJPEG = new Bitmap("Mango.jpg");
Bitmap myPNG = new Bitmap("Flowers.png");
Bitmap myTIFF = new Bitmap("MS.tif");

myGraphics.DrawImage(myBMP, 10, 10);
myGraphics.DrawImage(myGIF, 220, 10);
myGraphics.DrawImage(myJPEG, 280, 10);
myGraphics.DrawImage(myPNG, 150, 200);
myGraphics.DrawImage(myTIFF, 300, 200);
 
ok thx but it is just some gdi method not handeling the vectorial aspect !
no ?


Scherbina Vladimir said:
Leo said:
Hi :

I search some articles explaining how to make a little VectorialDesign
application with simple shape like line circles etc ... in C#


thx !!!

leo~

some examples from sdk:

class PlainForm : Form

{

protected override void OnPaint(PaintEventArgs e)

{

Pen myPen = new Pen(Color.Red, 3);

Graphics myGraphics = e.Graphics;

myGraphics.DrawLine(myPen, 20, 10, 200, 100);

}

}



then just create object of PlainForm :

PlainForm Frm = new PlainForm();

Frm.Show();



put the needed code into OnPaint

for drawing arcs use something like

myGraphics.DrawArc(myPen, 100, 50, 140, 70, 30, 180);

for rectangle

myGraphics.DrawRectangle(myPen, 20, 10, 100, 50);

for polygons

Point[] myPointArray =
{new Point(0, 0), new Point(50, 30), new Point(30, 60)};
myGraphics.DrawPolygon(myPen, myPointArray);

for images something like

Bitmap myBMP = new Bitmap("SpaceCadet.bmp");
Bitmap myGIF = new Bitmap("Soda.gif");
Bitmap myJPEG = new Bitmap("Mango.jpg");
Bitmap myPNG = new Bitmap("Flowers.png");
Bitmap myTIFF = new Bitmap("MS.tif");

myGraphics.DrawImage(myBMP, 10, 10);
myGraphics.DrawImage(myGIF, 220, 10);
myGraphics.DrawImage(myJPEG, 280, 10);
myGraphics.DrawImage(myPNG, 150, 200);
myGraphics.DrawImage(myTIFF, 300, 200);

What you have to do is have virtual Canvas. Have objects that should be
drawn on the virutal canvas. At this point, you have to map the virtual
canvas to the Graphics that you can call gdi+ calls.

j
 
Back
Top