自己重画(paint)可以实现你所说的情况

解决方案 »

  1.   

    private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
    {

    // Rectangle rect = new Rectangle(e.Bounds.X-1 , 
    // e.Bounds.Y -1 , 
    // e.Bounds.Width + 1, 
    // e.Bounds.Height+1 );
    //
    // Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(rect, 
    // Color.Lavender, 
    // Color.FromArgb(186,192,208),
    // 90f, false);
    // //    Brush b =  new SolidBrush(Globals.UnCheckBoxColor);
    // // Fill the rectangle
    // e.Graphics.FillRectangle(b, rect);
    StringFormat sf = new StringFormat(); // set the Alignment to center
    sf.LineAlignment = StringAlignment.Center;
    sf.Alignment = StringAlignment.Center;
    // Draw the text
    e.Graphics.DrawString(((TabControl)sender).TabPages[e.Index].Text, 
    System.Windows.Forms.SystemInformation.MenuFont, 
    new SolidBrush(Color.Black), 
    e.Bounds, 
    sf);
    }
    private void Form1_Load(object sender, System.EventArgs e)
    {
    this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Left;
    this.tabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
    }