|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Print ScreenHi,
Could someone help me with regards to a Print Screen button? Ideally, I'd like the Users to be able to click a button and then a screen print, print to their default printer. If possible, only a screen print of the current form? Any help would be greatly appreciated Many thanks Barry Barry wrote:
> Ideally, I'd like the Users to be able to click a button and then a How To Capture and Print the Screen, a Form, or Any Window> screen print, print to their default printer. > > If possible, only a screen print of the current form? http://support.microsoft.com/kb/q161299/ Barry wrote:
> Thanks Karl - that's just what I'm looking for. You probably wouldn't believe how I found it, either?http://www.google.com/search?q=screen+capture+vb+site%3Amicrosoft.com ;-) LOL!
Guess I should stop being lazy and look first! ;-) Although, there is nothing worse then searching Google for 30 mins and finding nothing and then posting a question and bang - 5 mins later you've got your answer. Have a good weekend! Barry wrote:
> LOL! To be fair, I knew the article was there. I've referred dozens (hundreds?) of folks> > Guess I should stop being lazy and look first! ;-) > > Although, there is nothing worse then searching Google for 30 mins and > finding nothing and then posting a question and bang - 5 mins later > you've got your answer. to it over the years. > Have a good weekend! You too... :-)"Barry" <barry.ocon***@singers.co.im> wrote in message There are almost as many ways of getting a bitmap of the screen (or of a news:1127497515.792933.60980@g44g2000cwa.googlegroups.com... > Could someone help me with regards to a Print Screen button? > Ideally, I'd like the Users to be able to click a button and then a > screen print, print to their default printer. window) as there are ways of . . . erm . . . "gettin' it away" in the Kama Sutra ;-) Here is some code (no apologies for it being a bit "rough and ready") that will allow you to get a bitmap of either the entire Form or just its client area. Once you've got the bitmap you can easily print it using the VB PaintPicture method. Mike Option Explicit Private Declare Function GetDC Lib "user32" _ (ByVal hwnd As Long) As Long Private Declare Function GetWindowDC Lib "user32" _ (ByVal hwnd As Long) As Long Private Declare Function BitBlt Lib "gdi32" _ (ByVal hDestDC As Long, _ ByVal x As Long, ByVal y As Long, _ ByVal nWidth As Long, ByVal nHeight As Long, _ ByVal hSrcDC As Long, _ ByVal xSrc As Long, ByVal ySrc As Long, _ ByVal dwRop As Long) As Long Private Sub Command1_Click() Dim oldscale As Long oldscale = Me.ScaleMode Me.ScaleMode = vbPixels ' ' the Form's client area 'Picture1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight 'Picture1.Cls ' ensure picbox Image property is properly resized 'DoEvents 'BitBlt Picture1.hDC, 0, 0, Me.ScaleWidth, Me.ScaleHeight, _ GetDC(Me.hwnd), 0, 0, vbSrcCopy ' ' the entire Form Picture1.Move 0, 0, Me.ScaleX(Me.Width, vbTwips, vbPixels), _ Me.ScaleY(Me.Height, vbTwips, vbPixels) Picture1.Cls ' ensure picbox Image property is properly resized DoEvents BitBlt Picture1.hDC, 0, 0, Me.ScaleX(Me.Width, vbTwips, _ vbPixels), Me.ScaleY(Me.Height, vbTwips, vbPixels), _ GetWindowDC(Me.hwnd), 0, 0, vbSrcCopy ' Me.ScaleMode = oldscale ' SavePicture Picture1.Image, "c:\myformpic.bmp" Caption = Me.ScaleWidth End Sub Private Sub Form_Load() 'Me.ScaleMode = vbPixels Picture1.Visible = False Picture1.AutoRedraw = True Picture1.BorderStyle = vbBSNone End Sub Thanks for the reply Mike..... interesting comparision by the way -
I'll er take a look at that! ;-)
Advice for PDF printer driver (VB6)
sendkeys doesnt sometimes send keys Folders- First layer only Visual Studio 6.0 Product ID Number locking of DB Responding to horizontal scroll messages from MS mice HELP! Menu commands - Cut, Copy, Paste, & Find How to comment a block codes outlook Design Question - Long(ish) Post |
|||||||||||||||||||||||