-
May 22nd, 2020, 10:47 AM
#1
Coloring Rect of Create(lpszText,dwstyle,&rect,parentwnd,nID) white
I have below code
Code:
CStatic *text = new CStaic ;
CRect textrect(10,20,70,50);
MapDialogRect(&tectrect);
text -> Create(name.data(),WS_CHILD | WS_VISIBLE | SS_RIGHT,textrect,this);
The problem is text is displayed on rectangle with gray color. How can i paint that rectangle color to white?
-
May 22nd, 2020, 11:53 AM
#2
Re: Coloring Rect of Create(lpszText,dwstyle,&rect,parentwnd,nID) white
Try to handle WM_CTLCOLORSTATIC message.
BTW, have you solved your problem with Editbox control?
Victor Nijegorodov
-
May 22nd, 2020, 12:41 PM
#3
Re: Coloring Rect of Create(lpszText,dwstyle,&rect,parentwnd,nID) white
You really need to use the resource editor. You're developing a really bad habit.
-
May 22nd, 2020, 12:59 PM
#4
Re: Coloring Rect of Create(lpszText,dwstyle,&rect,parentwnd,nID) white
 Originally Posted by Beginner_MFC
I have below code
Code:
CStatic *text = new CStaic ;
CRect textrect(10,20,70,50);
MapDialogRect(&tectrect);
text -> Create(name.data(),WS_CHILD | WS_VISIBLE | SS_RIGHT,textrect,this);
The problem is text is displayed on rectangle with gray color. How can i paint that rectangle color to white?
You could also subclass this static control (deriving your own class from CStatic and overriding OnPaint method).
I'd also recommend you to check out this site where you will find a lot of very useful tips and tricks including Changing Dialog Box/CFormView Color and many others.
Victor Nijegorodov
-
May 22nd, 2020, 01:21 PM
#5
Re: Coloring Rect of Create(lpszText,dwstyle,&rect,parentwnd,nID) white
Yes i solved editbox problem by passing correct parameters in CRect()
-
May 22nd, 2020, 01:27 PM
#6
Re: Coloring Rect of Create(lpszText,dwstyle,&rect,parentwnd,nID) white
 Originally Posted by Beginner_MFC
Yes i solved editbox problem by passing correct parameters in CRect()
Then it would be a good idea to share the solution and mark that thread as resolved!
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|