I have a tabControl application in C # Windows. It has several tabs. Does anyone know how to make TabPage text become bold?
private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { Graphics g = e.Graphics; Brush _TextBrush; // Get the item from the collection. TabPage _TabPage = tabControl1.TabPages[e.Index]; // Get the real bounds for the tab rectangle. Rectangle _TabBounds = tabControl1.GetTabRect(e.Index); if (e.State == DrawItemState.Selected) { // Draw a different background color, and don't paint a focus rectangle. _TextBrush = new SolidBrush(Color.Blue); g.FillRectangle(Brushes.Gray, e.Bounds); } else { _TextBrush = new System.Drawing.SolidBrush(e.ForeColor); // e.DrawBackground(); } // Use our own font. Because we CAN. Font _TabFont = new Font(e.Font.FontFamily, (float)9, FontStyle.Bold, GraphicsUnit.Pixel); //Font fnt = new Font(e.Font.FontFamily, (float)7.5, FontStyle.Bold); // Draw string. Center the text. StringFormat _StringFlags = new StringFormat(); _StringFlags.Alignment = StringAlignment.Center; _StringFlags.LineAlignment = StringAlignment.Center; g.DrawString(tabControl1.TabPages[e.Index].Text, _TabFont, _TextBrush, _TabBounds, new StringFormat(_StringFlags)); }
In Winforms, you can change the DrawMode and draw all the labels on yourself.
See MSDN Example .
Source: https://habr.com/ru/post/1302236/More articles:Validation and jQuery tabs - jqueryCLI-based "V" in Rails MVC? - ruby | fooobar.comCross Domain Exclusion Using WcfSvcHost - c #How to create xhtml query strings using Scala? - xmlHow can we get the location relative to the shape of the window? - c #What is the best practice for accessing a model using the MVVM pattern - c #https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1302238/adding-xml-files-to-the-build&usg=ALkJrhhAG0HAWATK7kYOCTORDxMS1LUZRAHow can I cut the image from below using PHP? - phpCopyFileEx and partially blocked files - winapiXOR reversibility operation task - bit-manipulationAll Articles