HighTechTalks DotNet Forums  

how to: draw a rectangular region into a Bitmap?

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss how to: draw a rectangular region into a Bitmap? in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
assaf
 
Posts: n/a

Default how to: draw a rectangular region into a Bitmap? - 10-08-2004 , 05:33 AM






hi all

i would like to draw a rectangular region into a Bitmap.
how can i do this?


assaf




Reply With Quote
  #2  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: how to: draw a rectangular region into a Bitmap? - 10-08-2004 , 05:50 AM






Provided the bitmap uses a non indexed pixel format:

Graphics g=Graphics.FromImage(theBitmap);
g.FillRectangle(Brushes.Red,10,10,100,100);

The image now has a red square on it...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml






"assaf" <assafwo (AT) hotmail (DOT) com> wrote

Quote:
hi all

i would like to draw a rectangular region into a Bitmap.
how can i do this?


assaf






Reply With Quote
  #3  
Old   
Lau Lei Cheong
 
Posts: n/a

Default Re: how to: draw a rectangular region into a Bitmap? - 10-08-2004 , 05:56 AM



Create a Graphic object using System.Drawing.Graphics.FromImage() then
you'll have lots of methods to use.

"assaf" <assafwo (AT) hotmail (DOT) com> 在郵件
news:%23wnlCtRrEHA.1992 (AT) TK2MSFTNGP09 (DOT) phx.gbl 中撰寫...
Quote:
hi all

i would like to draw a rectangular region into a Bitmap.
how can i do this?


assaf






Reply With Quote
  #4  
Old   
assaf
 
Posts: n/a

Default Re: how to: draw a rectangular region into a Bitmap? - 10-08-2004 , 07:02 AM



thanks lau

your comment together with pauls's
worked.

assaf


"Lau Lei Cheong" <leu_lc (AT) yehoo (DOT) com.hk> wrote

Quote:
Create a Graphic object using System.Drawing.Graphics.FromImage() then
you'll have lots of methods to use.

"assaf" <assafwo (AT) hotmail (DOT) com> 在郵件
news:%23wnlCtRrEHA.1992 (AT) TK2MSFTNGP09 (DOT) phx.gbl 中撰寫...
hi all

i would like to draw a rectangular region into a Bitmap.
how can i do this?


assaf








Reply With Quote
  #5  
Old   
assaf
 
Posts: n/a

Default Re: how to: draw a rectangular region into a Bitmap? - 10-08-2004 , 07:02 AM



thanks bob
it now works so well.

assaf

"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> wrote

Quote:
Provided the bitmap uses a non indexed pixel format:

Graphics g=Graphics.FromImage(theBitmap);
g.FillRectangle(Brushes.Red,10,10,100,100);

The image now has a red square on it...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml






"assaf" <assafwo (AT) hotmail (DOT) com> wrote in message
news:%23wnlCtRrEHA.1992 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
hi all

i would like to draw a rectangular region into a Bitmap.
how can i do this?


assaf








Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.