SetWindowRgn() for buttons
-
Hi I am trying to set a region for buttons. here is code: CRect the_rect; m_SearchBtn->GetClientRect(the_rect); HRGN region_handle = CreateEllipticRgnIndirect(the_rect); int nRet=m_SearchBtn->SetWindowRgn(region_handle,TRUE); nRet value is always non-zero. But still the button shape won't change. Could anyone tell me what is wrong? Regards
-
Hi I am trying to set a region for buttons. here is code: CRect the_rect; m_SearchBtn->GetClientRect(the_rect); HRGN region_handle = CreateEllipticRgnIndirect(the_rect); int nRet=m_SearchBtn->SetWindowRgn(region_handle,TRUE); nRet value is always non-zero. But still the button shape won't change. Could anyone tell me what is wrong? Regards
Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(**&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&**the_rect); ....
-
Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(**&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&**the_rect); ....
It won't work even with reference.
-
It won't work even with reference.
First Set the Style of Button to Owner Draw!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
First Set the Style of Button to Owner Draw!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.
-
If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.
For more information see one of stuff on this site such as: http://www.codeproject.com/buttonctrl/cxskinbutton.asp[^] I think you must use SelectClipRgn(...) after SetWindowRgn(...) BeB
-
Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(**&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&**the_rect); ....
Behzad Ebrahimi wrote: Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&the_rect); CRect has an operator that returns an LPRECT or LPCRECT, so his code was perfectly valid.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
For more information see one of stuff on this site such as: http://www.codeproject.com/buttonctrl/cxskinbutton.asp[^] I think you must use SelectClipRgn(...) after SetWindowRgn(...) BeB
SelectClipRgn(..) didn't help........
-
If I enable OWNERDRAW, button is not been visible. Otherwise it displays in a default rectangle shape.
After Setting Owner Draw Style, You have to use [CButton::DrawItem]to draw button. Or take a look at button wrapper classes here at CP [Link] http://www.codeproject.com/buttonctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
After Setting Owner Draw Style, You have to use [CButton::DrawItem]to draw button. Or take a look at button wrapper classes here at CP [Link] http://www.codeproject.com/buttonctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
I don't want to owner draw the button. I just need to change the shape of it. Any other solution?
-
I don't want to owner draw the button. I just need to change the shape of it. Any other solution?
I Belive I have to make one for you. Wait for hour,I will send you demo application!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
I don't want to owner draw the button. I just need to change the shape of it. Any other solution?
I found some good article relating to your problem:- http://www.codeproject.com/buttonctrl/polybtn.asp[^] http://www.codeproject.com/buttonctrl/roundbuttons.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
Behzad Ebrahimi wrote: Do NOT conflit refrence and value! In MSDN --> void GetClientRect( LPRECT lpRect ) const; So use m_SearchBtn->GetClientRect(&the_rect); HRGN region_handle = CreateEllipticRgnIndirect(&the_rect); CRect has an operator that returns an LPRECT or LPCRECT, so his code was perfectly valid.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
Thanks Ryan. You are right.:-O:doh: I always use refrence tag to take my code more readable.:rolleyes: