Looking for a long time find only set background monochrome,
M_mschart1. GetBackdrop (.) GetFill () SetStyle (1);
M_mschart1. GetBackdrop (.) GetFill () GetBrush () GetFillColor (). The Set (255255, 0);
I want to change the background image, consult a great god how?
CodePudding user response:
Since the drawing is to learn the skills in the morning and evening,
CodePudding user response:
https://stackoverflow.com/questions/17321587/mfc-set-a-background-image-on-a-control
CodePudding user response:
reference 1st floor zhao4zhong1 response: custom painting is to learn the skills in the morning and evening, Zhao four teacher can give a detailed steps? I built on the basis of mschart after class, in OnCtlColor and ondrawItem set the following two ways don't work, 1. The pDC - & gt; SetBkMode (TRANSPARENT); Return HBRUSH (GetStockObject (NULL_BRUSH)); 2. GetWindowRect (& amp; RcColorListBox);//get the static text box of rectangular PParent=GetParent ();//static text frame's parent window If (pParent) { PParent - & gt; The ScreenToClient (& amp; RcColorListBox);//the transition to the parent window area coordinates. PParent - & gt; The RedrawWindow (& amp; RcColorListBox);//to the parent window to redraw } CodePudding user response:
refer to the second floor oyljerry response: https://stackoverflow.com/questions/17321587/mfc-set-a-background-image-on-a-control According to the rewriting, or didn't appear transparent effect, did not change the background color to come... The CBrush m_br; M_br. CreateSolidBrush (RGB (0, 255)); LRESULT CMschartbg: : WindowProc (UINT message, WPARAM WPARAM, LPARAM LPARAM) { If (: : GetDlgCtrlID (lParam) (HWND)==IDC_MSCHART1) {HWND HWND=(HWND) lParam; HDC HDC=(HDC) wParam; The RECT rc; : : GetClientRect (hWnd, & amp; Rc); HBRUSH hOldBrush=(HBRUSH) : : SelectObject (hDC, m_br); : : a Rectangle (hDC, rc. Left, rc, top, rc. Right, rc, bottom); : : SelectObject (hDC, hOldBrush); } //return (LRESULT) m_br. GetSafeHandle (); Return the CWnd: : WindowProc (message, wParam, lParam); } CodePudding user response:
I am a novice, please give a detailed point slightly CodePudding user response:
TransparentBlt AlphaBlend function ?