![]() ![]() ![]() However, we can also hard code something at this point.Īdditionally, probably you also need the procedure OnMeasureItem of each MenuItem. As caption, we are using the string stored in the property "Caption" and writing it with TextOut onto the canvas. In this example, we are changing the font to Consolas in bold style, size 14 and yellow color with a black background. This procedure gives you access to the item's canvas (ACanvas) on which you can draw and write everything you want: procedure TForm1.MenuItem11DrawItem(Sender: TObject ĪCanvas: TCanvas ARect: TRect Selected: Boolean) ĪCanvas.TextOut(ARect.Left + 2, ARect.Top + 2, s) For that, select one item after each other and double click the event OnDrawItem (you can also assign the same procedure to all items if you want the same drawing). ![]() Then, you have to care about the drawing that is carried out in the OnDrawItem procedure of each TMenuItem. You can also do that via the Object Inspector. In order to change the font, color or background of a TPopupMenu or TMainMenu, you have to draw the corresponding items on your own.įirst, you have to change the property "OwnerDraw" of the PopupMenu or MainMenu to "true". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |