tabpages

  • Thread starter Thread starter yener
  • Start date Start date
Hi yener,
i can't change the color of caption of tabpages..
is there way to do that?

I'm afraid that its impossible to change color of
fonts or background.

There are hidden properties ForeColor & BackColor
but they doesn't work...

Marcin
 
i found a VB version here:

http://www.onteorasoftware.com/VBControls.aspx#AnsTQ1

csharp version:

//Dont forget to set tabControl's drawMode to ownerDrawFixed..
private void tabControl1_DrawItem(object sender,
System.Windows.Forms.DrawItemEventArgs e)

{

Graphics g = e.Graphics ;

TabPage tp = tabControl1.TabPages[e.Index] ;


StringFormat sf = new StringFormat();

RectangleF r = new RectangleF(e.Bounds.X, e.Bounds.Y + 2, e.Bounds.Width,
e.Bounds.Height - 2);

sf.Alignment = StringAlignment.Center ;

string strTitle = tp.Text;

Brush br = new SolidBrush(Color.Red) ;

g.FillRectangle(br, e.Bounds);

g.DrawString(strTitle, tabControl1.Font, Brushes.White, r, sf) ;

}

thnx anyway..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top