1 Attachment(s)
Custom Control with Triangle Shape on One Side
Hi,
I want to make a control which has triangle on one side and a text box and a spin control. I know how to combine control to make a control but I don't know how to change the shape of mfc controls. I attached the copy of the control which I want to make. Any inputs would be really appreciated.
Regards,
ABM
Re: Custom Control with Triangle Shape on One Side
Anyone cal help me with this. Please
Re: Custom Control with Triangle Shape on One Side
What is the purpose of the triangle? Without the triangle, you are looking at a standard spin control with a buddy edit control. Search on the word "buddy", or start here: "About Up-Down Controls" at http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
If your triangle is just a non-functional do-dad, then omit it. Pretty GUIs with no added functionality are meaningless to most serious users.
Mike
Re: Custom Control with Triangle Shape on One Side
To me that sounds like a owner drawn control.
Re: Custom Control with Triangle Shape on One Side
Thanks for the reply. I assumed too it is a owner draw control. For my application i need to be triangle on the side because it is pointing to something. My user will have the ability to move the control up and down too. I have seen this control in various applications but I have no idea how to make this. That's why I am here to get some help from all your experience programmers. Please someone can give me some information how to make this I would really appreciate it.
Regards,
abm
Re: Custom Control with Triangle Shape on One Side
I made 2 years ago a custom control; it was a button, with extendend functionalities, and hexagonally shaped.
I made a CWnd derived class, and used it as a control, analazing the mouse events and their occurence position to define control behaviour.
On the ondraw event of the cWnd you can shape it in any way you want, using background color to left undrawn areas
Re: Custom Control with Triangle Shape on One Side
Unlike buttons, menus, static controls, list boxes, and combo boxes, edit controls CANNOT be owner-drawn.
I.e. a style like ES_OWNERDRAW (similar to BS_OWNERDRAW and so on) does not exist.
See Edit Control Styles.
So, thinking to make an owner-drawn edit control is a dead end. Just forget it!
If you really want that fancy picture aside it, then can use a separate control (may be a static picture control).
That is the fastest and easiest solution.
However, if want to put all together (picture, edit and spin control), create your own custom or ActiveX control. That requires a little bit to sweat and makes sense if you have to put it in other tens of places.
Re: Custom Control with Triangle Shape on One Side
Could plz give me an example of how to change the shape of CStatic or CPictureCtrl? I don't need to change the shape of the Edit control, I can add next to the edit control and make it one control.
Regards,
ABM