Home > Software engineering >  WINdows window background picture, is there any way to move the background picture?
WINdows window background picture, is there any way to move the background picture?

Time:09-20

I saw a c + + written procedures, he is only a window, images on the window background picture, but he can move the scroll bar image coordinates, could you tell me how to do, is no moving components to moving pictures, only moving images

CodePudding user response:

With the CScrollView Class or window add corresponding rolling processing

CodePudding user response:

CRect WRC.
GetWindowRect (WRC);
The ScreenToClient (& amp; WRC);
MapWindowPoints (pDlg, WRC);
SetBrushOrgEx (dc m_hDC, - WRC. Left, - WRC. Top, 0).

CodePudding user response:

Quote: refer to the second floor schlafenhamster response:

//initialize window size structure
M_hDC=: : GetDC (m_hWnd);
M_hMemDC=CreateCompatibleDC (m_hDC);
M_hFullBitmap=CreateDIBSection (m_hDC, m_lpbmi, DIB_RGB_COLORS, & amp; M_lpScreenDIB, NULL, NULL);
SelectObject (m_hMemDC m_hFullBitmap);
SetScrollRange (SB_HORZ, 0, m_lpbmi - & gt; BmiHeader. BiWidth);
SetScrollRange (SB_VERT, 0, m_lpbmi - & gt; BmiHeader. BiHeight);

InitMMI ();
SendNext ();
return TRUE;//return TRUE unless you set the focus to a control
//the EXCEPTION: OCX Property Pages should return FALSE
}


Void CScreenSpyDlg: : ResetScreen ()
{
UINT nBISize=m_pContext - & gt; M_DeCompressionBuffer. GetBufferLen () - 1;
If (m_lpbmi!=NULL)
{
Int nOldWidth=m_lpbmi - & gt; BmiHeader. BiWidth;
Int nOldHeight=m_lpbmi - & gt; BmiHeader. BiHeight;

The delete [] m_lpbmi;
The delete [] m_lpbmi_rect;

M_lpbmi=(BITMAPINFO *) new BYTE [nBISize];
M_lpbmi_rect=(BITMAPINFO *) new BYTE [nBISize];

Memcpy (m_lpbmi m_pContext - & gt; M_DeCompressionBuffer. GetBuffer (1), nBISize);
Memcpy (m_lpbmi_rect m_pContext - & gt; M_DeCompressionBuffer. GetBuffer (1), nBISize);

DeleteObject (m_hFullBitmap);
M_hFullBitmap=CreateDIBSection (m_hDC, m_lpbmi, DIB_RGB_COLORS, & amp; M_lpScreenDIB, NULL, NULL);
SelectObject (m_hMemDC m_hFullBitmap);

Memset (& amp; M_MMI, 0, sizeof (MINMAXINFO));
InitMMI ();

//resolution change
If (nOldWidth!=m_lpbmi - & gt; BmiHeader. BiWidth | | nOldHeight!=m_lpbmi - & gt; BmiHeader. BiHeight)
{
The RECT rectClient rectWindow;
GetWindowRect (& amp; RectWindow);
GetClientRect (& amp; RectClient);
ClientToScreen (& amp; RectClient);

//calculate the gap with ClientRect WindowRect (title bar and scroll bars)
RectWindow. Right=m_lpbmi - & gt; BmiHeader. BiWidth + rectClient. Left + (rectWindow. Right - rectClient. Right);
RectWindow. Bottom=m_lpbmi - & gt; BmiHeader. BiHeight + rectClient. Top + (rectWindow. Bottom - rectClient. Bottom);
MoveWindow (& amp; RectWindow);
}
}

CodePudding user response:

I saw a source he write so, what is this, can say it to me

CodePudding user response:

https://www.codeproject.com/Articles/3175/Displaying-Bitmap-with-Scrolling

CodePudding user response:


redraw
  • Related