CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2010
    Posts
    136

    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
    Attached Images Attached Images  

  2. #2
    Join Date
    Jun 2010
    Posts
    136

    Re: Custom Control with Triangle Shape on One Side

    Anyone cal help me with this. Please

  3. #3
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    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

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Custom Control with Triangle Shape on One Side

    To me that sounds like a owner drawn control.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  5. #5
    Join Date
    Jun 2010
    Posts
    136

    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

  6. #6
    Join Date
    Jan 2007
    Location
    Italy
    Posts
    156

    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
    - Buzzyous -

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    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.
    Last edited by ovidiucucu; April 21st, 2012 at 04:42 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  8. #8
    Join Date
    Jun 2010
    Posts
    136

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured