Ticket A2252
Visible to All Users

How to create a new Painter for a PageControl component

created 20 years ago

Description:
I have a problem with the PageControl Component. All my Forms have a white background and the PageControl with a white background doesn't have a good appearance. The tab color is fixed and in some cases (i.e. using the Tabs style) the Tab background is fixed too.
I've noticed the PageControl is painted using a Painter so is it possible to define a custom painter to paint it?

Answer:
Yes, first you should create a descendant of the painter class (any descendant of an existing painter in the cxPCPainters.pas unit). Then override the following methods in it:
    class function GetStyleID: TcxPCStyleID; - the style identifier
    class function GetStyleName: TCaption; - the style name which will be displayed in the ObjectInspector
Finally, you should register your painter in the initialization section and unregister it in the finalization section as shown below:

Delphi
uses cxPCPaintersFactory; ... initialization RegisterPCPainterClass(TcxPCmyPainter); finalization UnregisterPCPainterClass(TcxPCmyPainter);

For more information please see the attached project.

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.