Greetings,
I have a tab control and I want to have this text in 1 tab Color should have changed on an event. I have found such answers, but using these sets, all colors are set instead of one. I
So I was hoping that with a tab I Want to change as a method rather than an event?
Something like this:
Public Zero SetTabPageHeaderColor (TabPage page, color color) {// text here}
If you want to color the tab, try the following code:
this.tabControl1.DrawMode = TabDrawMode OwnDrawFixed; This.tabControl1.DrawItem + new system.window.form. Dirtmemevent handler (this.tabControl1_DrawItem); Private dictionary & lt; Tab page, color & gt; TabColors = New Dictionary & lt; Tab page, color & gt; (); Private Zero SetTabHeader (tab page page, color color) {tabcolors [page] = color; TabControl1.Invalidate (); } Private Zero Tab Control 1_DrawItem (Object Sender, DrawItemEventArgs e) {//e.DrawBackground (); (Brush BR = New Solidbrush (using TabControl 1.TabPages [e.Index]]) (E. Graphics .Filrextengle (BR, E. Bounds); SizeF sz = e.Graphics.MeasureString (tabControl1.TabPages [E.index] .text, e. Font); E.Graphics.DrawString (tabControl1.TabPages [e.Index] .text, e.font, brush.black, e.bounds.left + (e.bounds.without - Ses Wideth) / 2, E. Bounce. + (E. Bounds. High-sz.Height) / 2 + 1); Rectangle Rect = E. Bound; Rect.offset (0, 1); Rect.Inflate (0 , -1); E.Graphics.DrawRectangle (Pens.DarkGray, rect); e.DrawFocusRectangle ();}}
Comments
Post a Comment