canvas question

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Hi all,

I'm just starting with C# and VS (2005), and am looking for a way to
draw on a surface. In delphi i used the canvas property which had
among a lot of drawing options, the option to directly access the
canvas as an array and put pixels with a specific color on it using
this method. I've looked through the help files and haven't been able
to find anything like that so far. But i'm sure something like that
exists.

If anybody could point me in the right direction to solve this problem
i would really appreciate it.


Best regards,
Eric
 
See the following excellent introductory resource:

http://www.bobpowell.net/gdiplus_faq.htm

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.

Thanks for the link. What i don't get though is how i can draw on an
actual surface. Take for example a button component, which has an
image property. However it lacks SetPixel and GetPixel, which is only
available in the Bitmap object.

Right now i think i understand how to create a Bitmap and draw on it,
but have no idea how to tranfer it to an Image object so it shows on
the screen.

Again any help wil be greatly appreciated!

Best regards,
Eric
 
You can display a Bitmap in the PictureBox Control or grab Graphics object
of another control and draw on that.
private void Form1_Paint(object sender, PaintEventArgs e)

{

e.Graphics.DrawLine(Pens.Black, new Point(0, 0), new Point(Width, Height));

}


Graphics.FromHwnd().

HTH,
-Eric
 
Back
Top