Drawing Question

  • Thread starter Jared Miniman [MVP]
  • Start date
J

Jared Miniman [MVP]

Let's say my form has an ImageList, and I wish at runtime, to dynamically
create some drawing objects (for simplicity sake a filled rectangle) and
fill up my ImageList with those objects. Is this feasible? Could someone
point me to some sample code to illustrate this?

--
_________________________________
Jared Miniman
MS-MVP Mobile Devices
Accenture Mobile Solutions Group

ActiveSync problems?
http://www.microsoft.com/mobile/pocketpc/support/help/activesync.asp
Connection Mngr Q's?
http://www.microsoft.com/mobile/pocketpc/tutorials/connectionmanager
 
A

Alex Feinman [MVP]

It is possible. Create a new Bitmap object. Create a Graphics object on it
using Graphics.FromImage. Draw whatever you want on this bitmap. Destroy
Graphics object. Set the bitmap as one of the ImageList images
 
J

Javier Campos

Jared Miniman said:
Let's say my form has an ImageList, and I wish at runtime, to dynamically
create some drawing objects (for simplicity sake a filled rectangle) and
fill up my ImageList with those objects. Is this feasible? Could someone
point me to some sample code to illustrate this?

This is off my mind, so it might be wrong:

using System.Drawing;

Bitmap bmp = new Bitmap(64,64);
Graphics g = Graphics.FromImage(bmp);
g.FillRectangle(new SolidBrush(Color.FromArgb(0xFF0000)),0,0,64,64);
imageList1.Images.Add(bmp);
g.Dispose();

And that should do it

Hope this helps,

- Javier Campos
 

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

Top