When the vs2005 MFC interface is self-drawing graphic BMP buttons, the position of the button is set

Step 1: The property Owner Draw of the button button is set to True;

Step 2: Call SetWindowPos( HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, _In_ int cy, UINT in the BOOL CChargeDlg::OnInitDialog() function        uFlags ) to set the position of the button, as follows

        CWnd *pWnd;
//The following is to modify the button position
pWnd = GetDlgItem( IDC_BUTTON__B ); //Switch to B  
pWnd->SetWindowPos( NULL,584,333,755,382,SWP_NOZORDER | SWP_NOSIZE );

     Note: SWP_NOZORDER: This button is at the top level, and it will get the first response when it is triggered;

           SWP_NOSIZEmaintain the current size (ignoring the cx and Cy parameters), and a white rectangle area will appear around the button if it is not added;

           SWP_NOMOVE : maintain current position (ignore X and Y parameters);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326521373&siteId=291194637