Click here to Skip to main content
15,354,853 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Graeme_Grant8-Apr-09 10:43
professionalGraeme_Grant8-Apr-09 10:43 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Eslam Afifi10-Apr-09 3:07
MemberEslam Afifi10-Apr-09 3:07 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Graeme_Grant10-Apr-09 14:21
professionalGraeme_Grant10-Apr-09 14:21 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Eslam Afifi10-Apr-09 15:28
MemberEslam Afifi10-Apr-09 15:28 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Graeme_Grant10-Apr-09 17:11
professionalGraeme_Grant10-Apr-09 17:11 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Eslam Afifi11-Apr-09 8:04
MemberEslam Afifi11-Apr-09 8:04 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Graeme_Grant11-Apr-09 12:03
professionalGraeme_Grant11-Apr-09 12:03 
GeneralRe: Snapshot of a Form in a thumbnail Pin
Eslam Afifi11-Apr-09 23:30
MemberEslam Afifi11-Apr-09 23:30 
Private Const WM_PRINT As Integer = &H317
Private Const PRF_NON_CLIENT As Integer = &H2
Private Const PRF_CLIENT As Integer = &H4

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageW" (ByVal hWnd As IntPtr, _
                                                                            ByVal Msg As Integer, _
                                                                            ByVal wParam As Integer, _
                                                                            ByVal lParam As Integer) As Integer

Public Sub DrawToBitmap(ByVal hWnd As IntPtr, ByVal bitmap As System.Drawing.Bitmap, _
                        ByVal targetBounds As System.Drawing.Rectangle)
    If (bitmap Is Nothing) Then Throw New ArgumentNullException("bitmap")
    If (((targetBounds.Width <= 0) OrElse (targetBounds.Height <= 0)) _
        OrElse ((targetBounds.X < 0) OrElse (targetBounds.Y < 0))) Then _
        Throw New ArgumentException("targetBounds")

    Using graphics = System.Drawing.Graphics.FromImage(bitmap)
        Dim hDC = graphics.GetHdc()
        SendMessage(hWnd, WM_PRINT, hDC.ToInt32(), PRF_CLIENT + PRF_NON_CLIENT)
        graphics.ReleaseHdc(hDC)
    End Using
End Sub


But you'll have to get the exact width and height of the window in case the window is maximized.
Althought WPF uses DirectX, I think they could have made WM_Print work by composing the client and non-client bitmaps the same way you would do with the code.

Eslam Afifi

QuestionWPF layout manager - resize,maximise minimise Pin
smita.si6-Apr-09 22:14
Membersmita.si6-Apr-09 22:14 
QuestionIssue's with WCF and WPF XBAP's Pin
Gretna6-Apr-09 21:42
MemberGretna6-Apr-09 21:42 
QuestionWPFtoolkit's DataGrid and DatagridColumnHeader Pin
wazzzuup6-Apr-09 11:10
Memberwazzzuup6-Apr-09 11:10 
AnswerRe: WPFtoolkit's DataGrid and DatagridColumnHeader Pin
Wes Aday7-Apr-09 8:05
professionalWes Aday7-Apr-09 8:05 
QuestionHow to deploy Silverlight application on IIS server? Pin
sumit70346-Apr-09 2:57
Membersumit70346-Apr-09 2:57 
AnswerRe: How to deploy Silverlight application on IIS server? Pin
Mark Salsbery6-Apr-09 6:28
MemberMark Salsbery6-Apr-09 6:28 
GeneralRe: How to deploy Silverlight application on IIS server? Pin
Piyush Vardhan Singh6-Apr-09 20:46
MemberPiyush Vardhan Singh6-Apr-09 20:46 
GeneralRe: How to deploy Silverlight application on IIS server? Pin
sumit70346-Apr-09 22:46
Membersumit70346-Apr-09 22:46 
GeneralRe: How to deploy Silverlight application on IIS server? Pin
Braulio Dez12-Apr-09 7:25
MemberBraulio Dez12-Apr-09 7:25 
GeneralRe: How to deploy Silverlight application on IIS server? Pin
Braulio Dez12-Apr-09 7:26
MemberBraulio Dez12-Apr-09 7:26 
AnswerRe: How to deploy Silverlight application on IIS server? Pin
souidi abderrahman16-Jul-10 6:21
Membersouidi abderrahman16-Jul-10 6:21 
QuestionDeepearth in Silverlight [modified] Pin
samfisher14125-Apr-09 21:39
Membersamfisher14125-Apr-09 21:39 
QuestionRe: Deepearth in Silverlight Pin
Mark Salsbery6-Apr-09 6:22
MemberMark Salsbery6-Apr-09 6:22 
QuestionWPF Drag & Drop Pin
Etienne_1235-Apr-09 8:14
MemberEtienne_1235-Apr-09 8:14 
AnswerRe: WPF Drag & Drop Pin
Prajeesh6-Apr-09 1:01
MemberPrajeesh6-Apr-09 1:01 
QuestionAmbitious "First" Project Pin
#realJSOP5-Apr-09 5:39
mva#realJSOP5-Apr-09 5:39 
AnswerRe: Ambitious "First" Project Pin
Insincere Dave5-Apr-09 13:25
MemberInsincere Dave5-Apr-09 13:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.