Wednesday, January 1, 2020
TColorButton Delphi Component Source Code
The background color of aà TButtonà is controlled by Windows,à not Delphi. TButton is a simple wrapper around the standard Windows button, and Windows does not allow it to be colored except by choosing the colors in Control Panel.à This means you can not set the background color of a TButton, nor you can change the background color of TBitBtn or TSpeedButton. Since Windows insists on doing the background coloring with clBtnFace, the only way to change it is to draw the button yourself by making an owner-drawn button component. TColorButton Source Code The TColorButton adds three new properties to the standard TButton: BackColorà - Specifies the background color of the buttonForeColorà - Specifies the color of the button text. Note that this overrides the Font.Color propertyHoverColorà - Specifies the color used to paint the buttons background when the mouse hovers over the button. Heres how to set color-related properties of the TColorButton at runtime: ColorButton1.BackColor : clOlive; //background ColorButton1.ForeColor : clYelow; //text ColorButton1.HoverColor : clNavy; //mouse over Installing Into a Component Palette The TColorButton comesà asà a single unit file with the .PAS file extension. After downloading the component, you need to install the source component into an existing package.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.