Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 634035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:15:01+00:00 2026-05-13T20:15:01+00:00

I went about creating a custom TabControl widget so that I could accurately paint

  • 0

I went about creating a custom TabControl widget so that I could accurately paint the tab with a close X on the right edge of the tab. I have a custom array class that holds all of the tabs.

So I override the CreateControlsInstance instance class and redefine the Controls class so I can hide it during reflection serialization.

protected override Control.ControlCollection CreateControlsInstance() {
  return new ControlCollection( this );
}

[Browsable( false ), DesignerSerializationVisibility( DesignerSerializationVisibility.Hidden )]
private new Control.ControlCollection Controls {
  get { return base.Controls; }
}

I then create the override class.

public new class ControlCollection: Control.ControlCollection {
  private xTabControl owner;

  public ControlCollection( xTabControl owner ): base( owner ) {
    this.owner = owner;
  }

  public override void Add( Control value ) {
    if ( !(value is xTabPage) )
      throw new Exception( "The control must be of type xTabPage" );

    xTabPage tabPage = (xTabPage)value;

    if ( !owner.inTabEvent )
      owner._tabPages.Add( tabPage );

    base.Add( value );
  }

  public override void Remove( Control value ) {
    if ( !(value is xTabPage) )
      throw new Exception( "The control must be of type JDMX.Widget.xTabPage" );

    if ( !owner.inTabEvent ) {
      xTabPage tabPage = (xTabPage)value;
      owner._tabPages.Remove( tabPage );
    }

    base.Remove( value );
  }

  public override void Clear() {
    owner._tabPages.Clear();
  }
}

Currently this works but if the Controls class can still call methods SetChildIndex, etc which changes the underlying arraylist but not the tabPages array.

I would like to be able to eliminate the need for the new ControlCollection class to have to use the base class for registering the new xTabPage objects with the xTabControl.

I have already been through the class structure with .Net Reflector. I am hoping to not have to copy half of the Control class in order to get the registration of the new widget to work.

I know this is a long shot but has anyone had any success doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:15:01+00:00Added an answer on May 13, 2026 at 8:15 pm

    Throughout my research on this, I could not find an instance where UserControls could be managed without using System.Windows.Forms.Control.ControlCollection because of the number of functions the assignment of a Control to the Add function provides. It was even worse when I began to incorporate the Designer into the equation. So I have decided to embrace the Controls property using the custom override I gave above. I will now need to keep my private level _tabPages synced with the Control Collection and not the other way around.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried making a custom configuration class that went on like this: WatcherServiceInfoSection<TWatcherServiceDetailElement> where
I have a mid-size collection of records --about 20 million -- that I need
for that past couple of weeks I have been creating generic script that is
I have been reading about creating an RPM for Python 2.6.4. In this page:
This is how I went about, to display a Boolean model field in the
I went to http://www.json.org/js.html and downloaded the json2.js, thinking i'd be fine, afterall that
I went through a document at Adobe Livedocs that describes working with pdf: http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html
I've been reading a lot about this problem but I get nothing that suggests
I have little program creating a maze. It uses lots of collections (the default
I have a record class with 18 properties. Before that class can be submitted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.