Download Now

    Reference TSurfaceForm

    Declared in Codebot.Controls.pas on line 243

    TSurfaceForm is the base class for custom forms controls which require an ISurface object
      TSurfaceForm = class(TForm)
      protected
        { Allow controls direct access to draw state }
        FDrawState: TDrawState;
        { Override ThemeAware and return true to subscribe to global theme changes }
        function ThemeAware: Boolean; virtual;
        { Invoked when the theme is changed }
        procedure ThemeChanged; virtual;
        { Allow the form to be drawn at design time }
        procedure PaintWindow(DC: HDC); override;
        { Paint is now final, so use Draw to access Surface }
        procedure Paint; override; final;
        { While Draw is executing Surface refers to a valid ISurface }
        procedure Draw; virtual;
        { Surface is only valid while Draw is executing }
        property Surface: ISurface read GetSurface;
        { Visual representation of the control. Is it pressed, hot, checked, etc }
        property DrawState: TDrawState read FDrawState write SetDrawState;
      public
        { Create a new form without loading a form resource }
        constructor CreateNew(AOwner: TComponent; Num: Integer = 0); override;
        destructor Destroy; override;
      published
        { Draw event handler }
        property OnRender: TDrawEvent read FOnRender write FOnRender;
        { Theme name determines the styling for a control }
        property ThemeName: string read FThemeName write SetThemeName;
      end;

    See also

    ISurface in Codebot.Graphics.Types.pas
    TDrawEvent in Codebot.Graphics.pas
    TDrawState in Codebot.Graphics.Types.pas