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 62581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:29:54+00:00 2026-05-10T18:29:54+00:00

I have derived a TabControl with the express purpose of enabling double buffering, except

  • 0

I have derived a TabControl with the express purpose of enabling double buffering, except nothing is working as expected. Here is the TabControl code:

class DoubleBufferedTabControl : TabControl {     public DoubleBufferedTabControl() : base()     {         this.DoubleBuffered = true;         this.SetStyle             (                 ControlStyles.UserPaint |                 ControlStyles.AllPaintingInWmPaint |                 ControlStyles.ResizeRedraw |                 ControlStyles.OptimizedDoubleBuffer |                 ControlStyles.SupportsTransparentBackColor,                 false             );     } } 

This Tabcontrol is then set with it’s draw mode as ‘OwnerDrawnFixed’ so i can changed the colours. Here is the custom drawing method:

    private void Navigation_PageContent_DrawItem(object sender, DrawItemEventArgs e)     {         //Structure.         Graphics g = e.Graphics;         TabControl t = (TabControl)sender;         TabPage CurrentPage = t.TabPages[e.Index];          //Get the current tab         Rectangle CurrentTabRect = t.GetTabRect(e.Index);          //Get the last tab.         Rectangle LastTab = t.GetTabRect(t.TabPages.Count - 1);          //Main background rectangle.         Rectangle BackgroundRect = new Rectangle(LastTab.Width, t.Bounds.Y - 4, t.Width - (LastTab.Width), t.Height);          //Tab background rectangle.         Rectangle TabBackgroundRect = new Rectangle(0, LastTab.Y + LastTab.Height, LastTab.Width, t.Bounds.Height - (LastTab.Y + LastTab.Height));          //Set anitialiasing for the text.         e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;          //String format for the text.         StringFormat StringFormat = new StringFormat();         StringFormat.Alignment = StringAlignment.Center;         StringFormat.LineAlignment = StringAlignment.Center;          //Fill the background.         g.FillRectangle(Brushes.LightGray, BackgroundRect);         g.FillRectangle(Brushes.Bisque, TabBackgroundRect);          //Draw the selected tab.         if(e.State == DrawItemState.Selected)         {             g.FillRectangle(Brushes.White, e.Bounds);             Rectangle SelectedTabOutline = new Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Height - 4);             g.DrawRectangle(new Pen(Brushes.LightGray, 4f), SelectedTabOutline);             g.DrawString(CurrentPage.Text, new Font('Arial', 12f, FontStyle.Bold, GraphicsUnit.Point), new SolidBrush(Color.FromArgb(70, 70, 70)), CurrentTabRect, StringFormat);         }         else         {             g.FillRectangle(new SolidBrush(Color.FromArgb(230, 230, 230)), e.Bounds);             g.DrawString(CurrentPage.Text, new Font('Arial', 12f, FontStyle.Regular, GraphicsUnit.Point), Brushes.Gray, CurrentTabRect, StringFormat);         }      } 

All to no avail however, as this control is not double buffered and still flickers when resized.

Any ideas?

  • 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. 2026-05-10T18:29:54+00:00Added an answer on May 10, 2026 at 6:29 pm

    If you read the documentation, it says, ‘This member is not meaningful for this control.’ If you want the control to be drawn utilizing double-buffering, you’ll have to implement it yourself. Besides the fact that if you owner-draw the control, you would have to implement double-buffering yourself anyhow.

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

Sidebar

Ask A Question

Stats

  • Questions 79k
  • Answers 79k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can iterate over the individual forms in your formset,… May 11, 2026 at 4:09 pm
  • Editorial Team
    Editorial Team added an answer One problem with your code is that JavaScript interprets 0… May 11, 2026 at 4:09 pm
  • Editorial Team
    Editorial Team added an answer The problem is that the data keeps writing to the… May 11, 2026 at 4:09 pm

Related Questions

I'm having some problems with a datagridview element I'm using in VS2008. This DataGridView
Can anyone figure out a nice way to get the following code to work?
I have a (derived) Menu control, that displays a rather large list of items
Is there a way to Invoke an overloaded method using reflection in .NET (2.0).

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.