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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:19:23+00:00 2026-05-23T19:19:23+00:00

i am using TabControl in my windows form application (c#) and i want draw

  • 0

i am using TabControl in my windows form application (c#)

and

i want draw the Highlight over the top of the tabpage headers using hightlightcolor.

http://img4up.com/up2/83871411772596923665.jpg

thanks

  • 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-23T19:19:26+00:00Added an answer on May 23, 2026 at 7:19 pm

    I hope this will help you. Just apply this below mentioned code in OnDrawItem Event of Tab Control

    if (e.Index == SelectedIndex)
    {
        Rectangle rect = new Rectangle(e.Bounds.X + 4, e.Bounds.Y, e.Bounds.Width - 6, e.Bounds.Height);
        backColorBrush = new SolidBrush(Color.CornflowerBlue);
        e.Graphics.FillRectangle(backColorBrush, rect);
        string tabName = this.TabPages[e.Index].Text;
    
        TabPages[e.Index].BackColor = Color.AliceBlue;
        TabPages[e.Index].BorderStyle = BorderStyle.None;
    
        TabPages[e.Index].UseVisualStyleBackColor = false;
        TabPages[e.Index].RightToLeft = RightToLeft.No;
        myFormat.Alignment = StringAlignment.Near;
        myFont = new Font(e.Font, FontStyle.Bold);
        RectangleF r1 = new RectangleF(e.Bounds.X + 1, e.Bounds.Y + 4, e.Bounds.Width, e.Bounds.Height - 4);
        foreColorBrush = new System.Drawing.SolidBrush(Color.Black);
        e.Graphics.DrawString(tabName, myFont, foreColorBrush, r1, myFormat);
        // e.Graphics.DrawImage(img, new Point(rect.X + (GetTabRect(e.Index).Width - _imageLocation.X), _imageLocation.Y));
    }
    else
    {
        myFont = new Font(e.Font, FontStyle.Bold);
        backColorBrush = new System.Drawing.SolidBrush(Color.CadetBlue);
        foreColorBrush = new System.Drawing.SolidBrush(Color.Black);
    
        TabPages[e.Index].BackColor = Color.AliceBlue;
        string tabName = TabPages[e.Index].Text;
    
        Rectangle rect = new Rectangle(e.Bounds.X + 1, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height + 1);
        myFormat.Alignment = StringAlignment.Near;
        e.Graphics.FillRectangle(backColorBrush, rect);
        RectangleF r1 = new RectangleF(e.Bounds.X, e.Bounds.Y + 4, e.Bounds.Width, e.Bounds.Height - 4);
        e.Graphics.DrawString(tabName, myFont, foreColorBrush, r1, myFormat);
        //e.Graphics.DrawImage(img, new Point(rect.X + (GetTabRect(e.Index).Width - _imageLocation.X), _imageLocation.Y));
    }
    myFormat.Dispose();
    myFont.Dispose();
    backColorBrush.Dispose();
    foreColorBrush.Dispose();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a Windows Form Application with several pages. I am using a
Hi friends, Am newbie for windows Development .i have created Grid With tabcontrol using
I was using System.Windows.Forms.TabControl to list custom pages, but there seems be a Hardcoded
I have a VS2008 C++ application for Windows XP SP3 developed using WTL 8.1.
I am using Windows.Forms and .Net 2.0. In Windows TabControl; how can I catch
I'm using Windows Forms in C#. I have a main form with a couple
I'm using a TabControl in my form and it made me wonder. Right now
I want to remove a particular tabpage from the tabcontrol. For which i have
I have a tabcontrol and I want to put some tabitem headers aligned to
I have created a taskbar using tabcontrols which works similarly to the Windows taskbar.

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.