1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| private void tabMain_DrawItem(object sender, DrawItemEventArgs e)
{
TabControl tc = (TabControl)sender;
//e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(203, 179, 179)), 0, 0, tc.Bounds.Width, tc.Bounds.Height);
e.DrawBackground();
// Dessine le contenu des onglets
Brush brushFoncee;
Brush brushClaire;
if (e.Index == tabMain.SelectedIndex)
{
brushFoncee = new SolidBrush(Color.FromArgb(231, 217, 217));
brushClaire = new SolidBrush(Color.FromArgb(0, 0, 0 ));
}
else
{
brushFoncee = new SolidBrush(Color.FromArgb(203,179,179));
brushClaire = new SolidBrush(Color.FromArgb(0, 0, 0 ));
}
// Dessin des onglets
e.Graphics.FillRectangle(brushFoncee, e.Bounds.X + 2, e.Bounds.Y, e.Bounds.Width - 2, e.Bounds.Height);
e.Graphics.DrawString(tc.TabPages[e.Index].Text, tabMain.TabPages[e.Index].Font, brushClaire, e.Bounds.X + 30, e.Bounds.Y + (e.Bounds.Height/4));
e.Graphics.DrawImage(imageOnglets.Images[tc.TabPages[e.Index].ImageIndex], e.Bounds.X, e.Bounds.Y);
//e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(0, 255, 0)), tc.Bounds.X, tc.Bounds.Y, tc.Bounds.Width, tc.Bounds.Height);
// Coloriage du contenu de l'onglet
tc.TabPages[e.Index].BackColor = Color.FromArgb(231, 217, 217);
//tc.TabPages[e.Index].BackColor.
brushClaire.Dispose();
brushFoncee.Dispose();
} |
Partager