Results 1 to 9 of 9

Thread: Inherit Designer for custom control

  1. #1

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Inherit Designer for custom control

    Ok, I am 'trying' to make a SuperTabPage that inherits from TabPage. So I make a new class, inherit TabPage.

    Of course, the problem is, you can't use the IDE to help you visually layout the controls in the tab page.

    There is however, a TabPageDesigner class that if implemented properly by using the <Designer> attribute ... ie. <Designer("System.....") Public My Class SuperTabPAge...
    should allow you to visually configure the visual aspect using the IDE.

    So, does anyone know jack about assigning .Net Designers to a class?
    Last edited by nemaroller; Sep 30th, 2003 at 12:09 PM.

  2. #2
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    I believe tabpages only get a designer when they have been added to a tabcontrol

  3. #3

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Well, as funny as it may seem, TabControlDesigner is also marked as private. The base designer for both is IDesigner, so I believe the syntax is probably incorrect.

  4. #4
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    can't you just add the controls in code??

  5. #5

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Sure... I could just create a Form using code without a designer too.. but then what's the point of having a Visual IDE?

    You mentioned that tabpages need a tabcontrol as parent, and that's obvious, but something I may have overlook as I was trying to implement this. But regardless, now that I know TabControlDesigner is private and cannot be accessed, how the heck does .Net expect anyone to visually design this tab page?

  6. #6
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    what I mean is, you can't double click a tabpage on the toolbox and place one on a form, and start adding controls. The only way you can add controls in design-mode to a tabpage, is when the tabpage has been added in design view to the tabcontrol. I have created a custom tabcontrol, so I have been through all this crap. Fortunatley I got away with using the standard tabpages, hiding the buttons and drawing my own.

  7. #7

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Well, I have found a way to do it, just simply tricking the IDE into thinking its a UserControl.

    See I needed to create a class that inherited TabPage, so I can use the same tabpage elsewhere in our project, and simply use a line of code like:
    VB Code:
    1. TabControl1.TabPages.Add(myTabPageClass)


    But basically, all I did was add a new User Control, and then lay out my componenets, and then go into code view and simply switch Inherits UserControl to Inherits TabPage, and that did the trick.

  8. #8
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158

    Re: Inherit Designer for custom control

    Originally posted by nemaroller
    Of course, the problem is, you can't use the IDE to help you visually layout the controls in the tab page.
    I thought your problem was not being able to place other controls on your tabpage, not putting your own TabPages into the tab control's tabpage collection.

  9. #9

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Re: Inherit Designer for custom control

    Originally posted by PeteD
    I thought your problem was not being able to place other controls on your tabpage, not putting your own TabPages into the tab control's tabpage collection.
    That was my problem. Solved it by tricking the IDE by switching Inherits TabPage to Inherits UserControl to lay out the controls, and then switching it back to Inherits Tabpage when I was finished.

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