I want to draw on a control,but the Dialog app will draw it automatic!
-
In a DLG based app,I want to draw something on a CONTROL (static) and there are some another CONTROL on the Dialog. I Get the DC of the Static control and draw something on it,but failed.I see nothing on the static control.So I delete the sentnce
CDialog::OnPaint()
And then,all of these control except the staitc can't be seen.(they are not being paint) I want to paint the Static control but hope the other control will draw it themself! How can I do? Thank you for your help! Don't look at me in that way! -
In a DLG based app,I want to draw something on a CONTROL (static) and there are some another CONTROL on the Dialog. I Get the DC of the Static control and draw something on it,but failed.I see nothing on the static control.So I delete the sentnce
CDialog::OnPaint()
And then,all of these control except the staitc can't be seen.(they are not being paint) I want to paint the Static control but hope the other control will draw it themself! How can I do? Thank you for your help! Don't look at me in that way!from the MSDN under GetDlgItem, changed to be a CStatic, assuming you are using the MFC // uses GetDlgItem to return a pointer to a user interface control CStatic* pStatic; pStatic= (CStatic*) GetDlgItem(IDC_STATIC1); pStatic->SetWindowText(_T("Hello world"));
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
-
from the MSDN under GetDlgItem, changed to be a CStatic, assuming you are using the MFC // uses GetDlgItem to return a pointer to a user interface control CStatic* pStatic; pStatic= (CStatic*) GetDlgItem(IDC_STATIC1); pStatic->SetWindowText(_T("Hello world"));
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
I just want to draw a picture on it! exmaple: I want to draw some lines on the static control! when I do this ,nothing can be seen in the control. Don't look at me in that way!
-
I just want to draw a picture on it! exmaple: I want to draw some lines on the static control! when I do this ,nothing can be seen in the control. Don't look at me in that way!
I am working from memory here. In that case the best method, I think, would be to subclass the control. Or you could try get the CDC of the static control, using my #1 method and use this to paint, also add the paint logic into the OnPaint. BUT the control may decide to paint it it's slef therefore overwriting what you have put there! I use this method to place a bitmap into a static control.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
-
I am working from memory here. In that case the best method, I think, would be to subclass the control. Or you could try get the CDC of the static control, using my #1 method and use this to paint, also add the paint logic into the OnPaint. BUT the control may decide to paint it it's slef therefore overwriting what you have put there! I use this method to place a bitmap into a static control.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
Thank you! I got it! Don't look at me in that way!