Click to See Complete Forum and Search --> : userControl Graphics
melkor12
June 16th, 2006, 12:22 PM
Hi,
I am developing a paint application and I have a problem:
The user draws on a UserControl object, then the user has to save the drawings on the UserControl object as a Bitmap file. How can I save the paintings on the UserControl object as a Bitmap file?
thank you
Mike Harnad
June 16th, 2006, 01:53 PM
Have you tried the articles in the Bitmap and Palettes (http://www.codeguru.com/Cpp/G-M/bitmap/) section?
melkor12
June 17th, 2006, 03:15 PM
I have taken a look at them but couldn't find anything useful.
Any suggestions?
nolxev
June 17th, 2006, 03:52 PM
Is it possible to access to UserControl's pixels array? If yes, all you have to do is to study the Bitmap file format and save those pixels. The bitmap file format is very simple.
melkor12
June 17th, 2006, 03:56 PM
I don't think so. I looked for that one but couldn't find it.
nolxev
June 17th, 2006, 04:02 PM
If you can't access to pixels array I think there is only one way. If you can access to the object window and device context you can grab the screen and save those pixels.
melkor12
June 17th, 2006, 04:07 PM
Can you be more spesific? I couldn't fully understand what you meant.
nolxev
June 18th, 2006, 03:24 PM
If you don't know what a DC is I think it's hard to explain. See code samples within articles.
melkor12
June 19th, 2006, 06:20 AM
Hi,
Now I got a new problem!
I have lots of shapes on the userControl object such as rectangles, circles, lines...
I want to "fill with color" just like MSPaint does,that is: fill the closed regions with color. I am aware of the complexity of this task and since I am new to C#, I don't know which class whould help me.
I researched the web but couldn't find anything,
any suggestions?
Mike Harnad
June 19th, 2006, 08:39 AM
All drawing is handled through a device context (DC). As nolxev indicated, you'll need to understand how to use a DC. Take a look at the CDC class (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_MFC_CDC.asp) .
cindyonlyone
June 22nd, 2006, 11:26 PM
For simple drawing application, the drawcli sample is a good start I think, if you want to build much Visio like drawing application, another good choice is to XD++ MFC Library, this will save you much long time, you can find it as below:
http://www.********.net/XDFeature/feature.htm
Hope it is useful to you!
Ciny
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.