Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / June 2006

Tip: Looking for answers? Try searching our database.

Graphics -> Bitmap

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Thielen - 26 Jun 2006 05:34 GMT
Hi;

If I have a Graphics object and want to get a Bitmap object that is what is
drawn in the Graphics object - how do I do that?

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

"Peter Huang" [MSFT] - 26 Jun 2006 07:59 GMT
Hi

I think we need to create a graphics from the Bitmap, so the following
drawing will be on the Bitmap.
Create from an Image Object
http://msdn2.microsoft.com/en-us/library/5y289054.aspx

If you means an existing graphics, I think you have to P/Invoke the BitBlt
GDI function.
Here is a link for your reference.

Screen Capturing a Form in .NET - Using GDI and GDI+
http://www.c-sharpcorner.com/Graphics/ScreenCaptFormMG.asp

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 26 Jun 2006 16:59 GMT
That's what I was afraid of - thanks. (I dislike P-Invoke because we're all
supposed to be 100% managed code.)

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

> Hi
>
[quoted text clipped - 20 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Ben Voigt - 26 Jun 2006 18:34 GMT
> That's what I was afraid of - thanks. (I dislike P-Invoke because we're
> all
> supposed to be 100% managed code.)

Don't know why you'd need P/Invoke here.  Do you know where the Graphics
object came from?  If it's from an exposed window onscreen, use the
CopyFromScreen method to get it into a Bitmap.  If it's from another Image
(Bitmap/Icon/Metafile, etc) you can use that Image directly or use
DrawImage.  If the Graphics object is to an obscured window (another window
overlaps it) or a DirectX surface, then BitBlt isn't going to get you the
data either, because it isn't in any GDI buffer.

>> Hi
>>
[quoted text clipped - 22 lines]
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
David Thielen - 26 Jun 2006 18:41 GMT
It's from a J# (not .NET) Graphics2D object. The only way to get the bitmap
is it will give me a .NET Graphics object.

Signature

thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

> > That's what I was afraid of - thanks. (I dislike P-Invoke because we're
> > all
[quoted text clipped - 34 lines]
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.