Wednesday 15 May 2013

how to create transparent dialog ( not invisible) but image or text drawn on it is visible in MFC? -


How to create a transparent dialogue but the image or text drawn on it is visible in MFC. I searched for many articles, but what exactly do I want I want to deploy it in my project Help can be appreciated Please help.

OnInitDialog, you enter:

  set window ( M_Huddund, GWL_Xxtile, Gatevondo Long (M_Ahundand, GWL_XTSSEE) ^ WS_X_LairAid; SetLayeredWindowAttributes (m_hWnd, RGB (255,0255), 0, LWA_COLORKEY);   

RGB (255,0255) For magenta we believe that you do not use color magenta anywhere in your dialogue. All magenta pixels in your dialogue will be transparent. As you only want to make the background transparent, we will paint the background of the dialogue in Maganta. This is done by WM_ERASEBKGND message:

Send your dialog mapped ON_WM_ERASEBKGND () Add your message map should look like:

 < Code> BEGIN_MESSAGE_MAP (CYourDialogDlg, CDialog) // {{AFX_MSG_MAP (CYourDialogDlg) ...}} AFX_MSG_MAP ON_WM_ERASEBKGND () END_MESSAGE_MAP ()   

be afx_msg your dialog header file Should BOOL OnEraseBkgnd (CDC * PDC);

In your dialogue. Put this in the CP file:

  BOOL CYourDialogDlg :: OnRezBank (CDC * PDC) {CAMT Client; GetClientRect (& clientRect); PDC- & gt; FillSolidRect (ClientRCT, RGB (255,0255)); // Background color is wrong in Magenta return; }   

sample that appears in the dialog dialog dialogue and once executed Visible

No comments:

Post a Comment