CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Custom Control

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Indiana
    Posts
    261

    Custom Control

    OK although I have done some easy custom controls in the past this one is definitely a bit harder than others I have done. For the most part what I have is a MDI program and I have to manage several windows at once. So I will design a class to just manage all the windows. Basically keep an array pointed to each CMDIChildWnd. It has to be able to hide windows and show the right one depending on what is selected. Now I could go the tab route for window selection but I think tabs are getting a bit dated and don't fit my software so good.

    So I decided to come up with this design which I'm sure someone has used something similar to this but I don't know. Basically my thought was kind of like a CComboBox but instead of dropdown box(the arrow box on the far right of the control) there is an 'X' (close button) where the drop down box was. There will be an arrow on both sides of the combo box to cycle through the open windows (documents) and also if you click on the edit portion of the CComboBox then it will drop down a menu of all the open windows with a close button next to each name. Also in the ComboBox's edit control will be the name of the current CMDIChildWnd that has focus.

    I think this will be kind of simple. I think the hardest part will be drawing the Close button on the CComboBox and also on the CMenu. Also maybe disabling the dropdown button from dropping down the combobox list box and closing the said window instead. Which I doubt this is even that hard. But I also would like to change the appearance of the CComboBox some too and even thought about maybe making it more elliptical. I basically wanted to get ideas and feedback on this a long with any direction on this. I have gotten tons of help here in the past and I just like to see how to go about this whole thing.

    I put up a couple photos to show what I mean. But this is just a basic Combo Box with the menu. This isn't elliptical as I'm not sure exactly how I want it to look but I have a basic idea. Also I did this in photoshop.

    First one is just the control displaying the current open window (I didn't add the arrows here I which brings another question. Should the arrows be part of the control or just add button to cycle through the windows by sending message to custom control when clicked?)

    This image is what happens if you click inside the edit control of combo box.


    Other things to note it used the CMDIChildWnd title bar name to put in the control but the control should be able to tell if the name is too long for the control and let it tail off with periods (ex. Untitl... [x] )
    Also if there are so many windows open then the CMenu part of the control should be scrollable.

    So should I Subclass the CComboBox control for this and just have a Subclassed CMenu as well inside my new CComboBox?
    Last edited by left1none; September 21st, 2009 at 04:10 AM.

  2. #2
    Join Date
    Feb 2005
    Location
    Indiana
    Posts
    261

    Re: Custom Control

    Well is there any good tuts on making a round ComboBox? I thought I seen some tut on making round controls once. This may be a hard one to do and actually I may just keep it square after thinking about it.

    Jack

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