Home > Software engineering >  How to draw a CDC good copy to another CDC
How to draw a CDC good copy to another CDC

Time:11-10

I have two Windows A class called A, another name is B, A as A navigation bar (nagative), used to preview the B (for details see picture) , I was in A drawing onpaint function with the CDC object of the class can all see in the window, A window, and B, but I use A third-party library C can draw form or something like that I just need to set the rows and columns in the binding A parent window is painted himself in the B window, such as

C x=new (C)
 
C x=new (C);
C - & gt; Create (/* */);/B/a number of parameters including the parent window;
C - setrowcount (1);
C - & gt; Setcolcount (1);


But such paintings can B in the parent window shows A preview of the window but can't see because with the CDC object is not A drawing, bosses how to deal with this situation, the library C painting the CDC also seems to be able to specify with my class A CDC, it can draw A good form of class A copy of the library let he displayed in the navigation bar, if it seems as copy and more out of window B A form, ask for help

CodePudding user response:

Try PrintWindow

CodePudding user response:

reference 1st floor zgl7903 response: try
PrintWindow
thank you, brothers, I try tomorrow

CodePudding user response:

Through the clipboard

CodePudding user response:

bitblt

CodePudding user response:

The
reference 3 floor schlafenhamster response:
through the clipboard


How to use a brother,

CodePudding user response:

The
reference 4 floor zjq9931 reply:
bitblt
there's no way I've tried,,
 
C - & gt; ShowWindow (true);

pDC-> BitBlt (0, 0, gridrect Width (), lprect. Height (), pGrid - & gt; GetDC (), 0, 0, SRCCOPY);


After he became so

CodePudding user response:

reference 4 floor zjq9931 response:
bitblt
is this display can show a large residual film so I move a third-party library that draw good grid can see two grid, one is the ghosting is bitblt painted and size and the third party to draw a good library of laughter, and then move the grid near the ghosting can see the ghosting effect or not in the thumbnail of the grid

CodePudding user response:

refer to 7th floor Zxy0918520 response:
Quote: refer to 4th floor zjq9931 response:

Bitblt
is this display can show a large residual film so I move a third-party library that draw good grid can see two grid, one is the ghosting is bitblt painted and size also, and the third party to draw a good library of laughter, and then move the grid near the ghosting can see the ghosting effect or not in the thumbnail grid

Bitblt painted just pictures, cannot distinguish between object, if there are changes in the original image, you want to erase, and then only can redraw, remember to erase,

CodePudding user response:

 
BOOL CopyWnd2DC (HDC HDC, the RECT rcRect, HWND HWND)
{
BOOL bRet=FALSE;
If (hDC & amp; & HWnd & amp; & IsWindow (hWnd))
{
//save DC
Int nSaveDC=SaveDC (hDC);

//get window coordinates
The RECT rcWnd;
GetWindowRect (hWnd, & amp; RcWnd);

//get window DC
HDC hWndDC=GetWindowDC (hWnd);
If (hWndDC!=NULL)
{
//set the zoom mode
SetStretchBltMode (hDC, HALFTONE);

//zoom the map
StretchBlt (hDC,
RcRect left, rcRect. Top,
RcRect. Right - rcRect. Left, rcRect bottom - rcRect. Top,
HWndDC,
0, 0,
RcWnd. Right - rcWnd. Left, rcWnd bottom - rcWnd. Top,
SRCCOPY);

//release DC
ReleaseDC (hWnd, hWndDC);

BRet=TRUE;
}

//restore DC
RestoreDC (hDC, nSaveDC);
}

Return bRet.
}

Void CSdi7View: : ontouch * pDC (CDC)
{
/*
CSdi7Doc * pDoc=GetDocument ();
ASSERT_VALID (pDoc);
If (! PDoc)
return;
*/
//calculator
HWND HWND=: : FindWindow (_T (" CalcFrame "), NULL);
CopyWnd2DC (pDC - & gt; M_hDC, CRect (0, 0, 200, 200), the hWnd);

}





CodePudding user response:

pDC-> BitBlt (0, 0, gridrect Width (), lprect. Height (), pGrid - & gt; GetDC ()
What is the pDC pGrid - & gt; GetDC ()

CodePudding user response:

references 9 f zgl7903 response:
 
BOOL CopyWnd2DC (HDC HDC, the RECT rcRect, HWND HWND)
{
BOOL bRet=FALSE;
If (hDC & amp; & HWnd & amp; & IsWindow (hWnd))
{
//save DC
Int nSaveDC=SaveDC (hDC);

//get window coordinates
The RECT rcWnd;
GetWindowRect (hWnd, & amp; RcWnd);

//get window DC
HDC hWndDC=GetWindowDC (hWnd);
If (hWndDC!=NULL)
{
//set the zoom mode
SetStretchBltMode (hDC, HALFTONE);

//zoom the map
StretchBlt (hDC,
RcRect left, rcRect. Top,
RcRect. Right - rcRect. Left, rcRect bottom - rcRect. Top,
HWndDC,
0, 0,
RcWnd. Right - rcWnd. Left, rcWnd bottom - rcWnd. Top,
SRCCOPY);

//release DC
ReleaseDC (hWnd, hWndDC);

BRet=TRUE;
}

//restore DC
RestoreDC (hDC, nSaveDC);
}

Return bRet.
}

Void CSdi7View: : ontouch * pDC (CDC)
{
/*
CSdi7Doc * pDoc=GetDocument ();
ASSERT_VALID (pDoc);
If (! PDoc)
return;
*/
//calculator
HWND HWND=: : FindWindow (_T (" CalcFrame "), NULL);
CopyWnd2DC (pDC - & gt; M_hDC, CRect (0, 0, 200, 200), the hWnd);

}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related