CMenu - how to draw the popup arrow yourself?
-
since windows draw it for , i counldn't find any way to avoid it when i was creating my own ownerdrawn menu... any1? thanks in advanced Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
-
since windows draw it for , i counldn't find any way to avoid it when i was creating my own ownerdrawn menu... any1? thanks in advanced Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
What about putting a bitmap there? hope you are aware about drawing triangles using PolyLine method or MoveTo, LineTo combination in GDI. All you need to specify the cordinates... You can adopt that method. Another tweak is that using lines you can draw a pooup triangle. Here I have drawn a triangle using three lines. Assume that each "|" represents a pixel and each column with "|" represents a line. You can use this method. | || ||| || | Sorry no time to write code for the same :)
-Sarath. The more you can dream the more you can do - Michael Korda"
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
What about putting a bitmap there? hope you are aware about drawing triangles using PolyLine method or MoveTo, LineTo combination in GDI. All you need to specify the cordinates... You can adopt that method. Another tweak is that using lines you can draw a pooup triangle. Here I have drawn a triangle using three lines. Assume that each "|" represents a pixel and each column with "|" represents a line. You can use this method. | || ||| || | Sorry no time to write code for the same :)
-Sarath. The more you can dream the more you can do - Michael Korda"
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
i can draw what ever i want, the problem is that after the 'DrawItem' is finished, windows calls its own methods to draw the arrow by itself, so it overwrite my drawings... :( anyway to bypass this problem? thanks Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
-
i can draw what ever i want, the problem is that after the 'DrawItem' is finished, windows calls its own methods to draw the arrow by itself, so it overwrite my drawings... :( anyway to bypass this problem? thanks Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
Just subclass the menu and handle your own painting.
-
Just subclass the menu and handle your own painting.
subclass as in inherite a class from CMenu and implement DrawItem? if this is what you suggest, i've already done that, and still the problem remains, because after draw item, windows draw the arrows itself.... Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
-
subclass as in inherite a class from CMenu and implement DrawItem? if this is what you suggest, i've already done that, and still the problem remains, because after draw item, windows draw the arrows itself.... Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
-
since windows draw it for , i counldn't find any way to avoid it when i was creating my own ownerdrawn menu... any1? thanks in advanced Yaron
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)
I used the following trick: At the end of your DrawItem(), just before returning, set an empty clipping region. This will effectively prevent Windows from drawing over your arrow. At the beginning, reset the clipping region to ensure you can draw back. Code:
void CMyMenu::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
// Reset clipping region
pDC->SelectClipRgn(NULL);// Your drawing code goes here // Set clipping region. This will ensure Windows doesn't draw // the popup icon, which we are drawing ourselves. pDC->IntersectClipRect(0,0,0,0);
}
-
I used the following trick: At the end of your DrawItem(), just before returning, set an empty clipping region. This will effectively prevent Windows from drawing over your arrow. At the beginning, reset the clipping region to ensure you can draw back. Code:
void CMyMenu::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
// Reset clipping region
pDC->SelectClipRgn(NULL);// Your drawing code goes here // Set clipping region. This will ensure Windows doesn't draw // the popup icon, which we are drawing ourselves. pDC->IntersectClipRect(0,0,0,0);
}
Sounds interesting, will try it thanks a lot man :)
Interface basics click here : http://www.codeproject.com/com/COMBasics.asp don't forget to vote :)