473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

GDI+: Problem with PictureBox

MAY
Hello,
I drew some lines and rectangles with pen and brush on a picturebox, i want
convert these lines into bitmap. How can i do that??
Thanks in advance!

MAY
Nov 16 '05 #1
6 2330
Jax
Yeah, you gotta remember that a picturebox is for displaying and not editing
What you want to do is this

Bitmap myBitmap = new Bitmap(100, 100)
Graphics g = Graphics.FromImage(myBitmap)
/// do stuff with
pictureBox1.Image = myBitmap

Here is an awesome FAQ on the GDI that helped me out tons

http://www.dotnet247.com/247referenc...diplus_faq.htm
Nov 16 '05 #2
MAY
Thx Jax

In the other side, how to convert lines that drew on a picturebox into
bitmap??

MAY
"Jax" <an*******@discussions.microsoft.com> ¦b¶l¥ó
news:AC**********************************@microsof t.com ¤¤¼¶¼g...
Yeah, you gotta remember that a picturebox is for displaying and not editing. What you want to do is this:

Bitmap myBitmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(myBitmap);
/// do stuff with g
pictureBox1.Image = myBitmap;

Here is an awesome FAQ on the GDI that helped me out tons.

http://www.dotnet247.com/247referenc...diplus_faq.htm
Nov 16 '05 #3
What he's saying is you don't want to draw the lines on the picturebox itself.
Rather make an Image and put the image on the pictureBox. You can then use
something like
Bitmap myBitmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(myBitmap);
/// do stuff with g
pictureBox1.Image = myBitmap; //displays the Image

then you could

myBitmap.Save("C:\\stuff.png"); //or bmp but the defaul is png

On 13/04/2004 "MAY" <pa****@hotmail.com> wrote:Thx Jax

In the other side, how to convert lines that drew on a picturebox into
bitmap??

MAY
"Jax" <an*******@discussions.microsoft.com> ¦b¶l¥ó
news:AC**********************************@microso ft.com ¤¤¼¶¼g...
Yeah, you gotta remember that a picturebox is for displaying and notediting.
What you want to do is this:

Bitmap myBitmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(myBitmap);
/// do stuff with g
pictureBox1.Image = myBitmap;

Here is an awesome FAQ on the GDI that helped me out tons.

http://www.dotnet247.com/247referenc...ll.net/gdiplus

_faq.htm

Nov 16 '05 #4
Hi MAY,
Thx Jax

In the other side, how to convert lines that drew on a picturebox into
bitmap??

MAY
"Jax" <an*******@discussions.microsoft.com> ¦b¶l¥ó
news:AC**********************************@microsof t.com ¤¤¼¶¼g...
Yeah, you gotta remember that a picturebox is for displaying and not


editing.
What you want to do is this:

Bitmap myBitmap = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(myBitmap);
/// do stuff with g
This is the part you're interested in.
:)
pictureBox1.Image = myBitmap;

Here is an awesome FAQ on the GDI that helped me out tons.


http://www.dotnet247.com/247referenc...diplus_faq.htm


Marcin
Nov 16 '05 #5
Jax
I gotta work on my communication skills, if two other people have to explain my post after i've written it. :
Thanks guys!
Nov 16 '05 #6
Hi Jax,
I gotta work on my communication skills, if two other people have to explain my post after i've written it. :)
Thanks guys!


I'm sure that You really don't have to!

We have tried to make this news branch deeper... and deeper...
.... but that subject was not so philosophical as we have expected.

;)

Marcin
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: MAY | last post by:
Hello, I drew some lines and rectangles with pen and brush on a picturebox, i want convert these lines into bitmap. How can i do that?? Thanks in advance! MAY
2
by: pixel | last post by:
hi i know there is no ExtFloodFill in GDI+ so i decided to use GDI but there is something that i don't understand when i got DC from ie PictureBox like this Graphics g =...
2
by: Jaxson Tammaru | last post by:
Create a new form, chuck a panel on and place within the panel a picturebox of about 1000 * 5000, make an image that size set that to the image property of the picturebox, then set the minimum size...
5
by: anonymous | last post by:
I'm writing a program that deals extensively with the printer. For the most part my application runs fine, but occasionally I run into some Exceptions. The most common exceptions I run into are...
7
by: news | last post by:
This may be a stupid question, but if I don't ask I'll never know ;) Ok, here it goes.... I am writing an application that renders an image in one picturebox and a graph in another. The image...
3
by: Ger | last post by:
I have a form with a panel (Panel1) in which I dynamically create picturebox controls. Works like a dream with static pictures, but not when the picturebox.image is an animated gif. GDI+ throws the...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
8
by: =?Utf-8?B?QWxpY2U=?= | last post by:
Sorry for reposting here but I apparantly managed to pick the wrong discussion group earlier. Here's my story: Hi all, I am developping a simple application that displays an animated weather...
6
by: Cruithne3753 | last post by:
I'm trying to create a Windows app with a clickable index of images within a local folder. Within a loop I've got:- PictureBox pb = new PictureBox(); pb.Image = Image.FromFile(file); .......
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.