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

  • Home
  • SEARCH
  • 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 went to http://www.json.org/js.html and downloaded the json2.js, thinking i'd be fine, afterall that
Dealing with an employee that went over my head
As recently as several years ago, the developers actually made the builds that went
I went to all the documentation, also I went to the IRC channel (BTW
I went to school for programming years ago and when I got out I
I went through a period of being interested in how quantum computers work and
I just went through some MVC tutorials after checking this site out for a
I was just reading up a lecture which breifly went over Container Interface. I
I recently started learning Emacs . I went through the tutorial, read some introductory
The other day I set up an Ubuntu installation in a VM and went

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.