By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,987 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,987 IT Pros & Developers. It's quick & easy.

How can I get a bitmap of a Form using .NET 1.1 (ie NO CopyFromScreen)

P: n/a
How can I get a bitmap of a Form using .NET 1.1 (ie NO CopyFromScreen)

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200605/1
May 18 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Paul,

if you want to implement .NET 2.0's Control.DrawToBitmap
you can do this only by using PInvoke and win32 API.
There are two approaches: sending WM_PRINT message and calling PrintWindow
API.
Both produce similar results, even though they do it in a different way and
both has issues. DrawToBitmap uses WM_PRINT, but I personally found that
PrintWindow produces better results. There are controls such as richeditbox
that doesn't print itself when using either of those methods.

As far as it goes for Graphics.CopyFromScreen you also need to resort to
windows API and use BitBlt method + some of the API methods for obtaining a
device context (HDC) such as GetDC.
--
HTH
Stoitcho Goutsev (100)
"Paul_Madden via DotNetMonster.com" <u21795@uwe> wrote in message
news:606e536381437@uwe...
How can I get a bitmap of a Form using .NET 1.1 (ie NO CopyFromScreen)

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200605/1

May 18 '06 #2

P: n/a
There's always good ol' PrintScreen.
I don't have the code with me, but I've written a screen-grabber app that
sends a PrintScreen key press and gets the bitmap from the clipboard. My app
then crops the bitmap based on its size and position. That could be useful.
May 18 '06 #3

P: n/a
The worst think to do is to use the clipboard without the knoledge of the
user. The user needs to be the one that initiates all clipboard operation.
I'll be really frustrated if I keep some data in the clipboard and when the
time for paste comes to find out that there is some bitmap that I know
nothing about.
--

Stoitcho Goutsev (100)

"PIEBALD" <PI*****@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
There's always good ol' PrintScreen.
I don't have the code with me, but I've written a screen-grabber app that
sends a PrintScreen key press and gets the bitmap from the clipboard. My
app
then crops the bitmap based on its size and position. That could be
useful.

May 18 '06 #4

P: n/a
> The worst think to do is to use the clipboard without the knoledge of the
user. The user needs to be the one that initiates all clipboard operation.
I'll be really frustrated if I keep some data in the clipboard and when the
time for paste comes to find out that there is some bitmap that I know
nothing about.


You have to weigh the benefits against the costs. If the application is for
only personal/internal use then why go to the trouble of a more difficult
solution?

other than for educational purposes.
May 18 '06 #5

P: n/a
Also, I wrote the thing in V1.1 and hadn't heard of CopyFromScreen until now
so I'll go back and try that.
May 18 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.