Download Now

    Reference TDrawControlHelper

    Declared in Codebot.Graphics.pas on line 345

    TDrawControlHelper adds drawing methods to controls
      TDrawControlHelper = class helper for TControl
      public
        { The height of a line of text in the control font }
        function TextHeight: Integer;
        { The size of a line of text in the control font }
        function TextSize(const Text: string): TPointI;
        { Draw a placeholder block }
        procedure DrawDummyBlock(Surface: ISurface; const Rect: TRectI; State: TDrawState);
        { Draw a bitmap at a point, optionally scaled }
        procedure DrawBitmap(Surface: ISurface; Bitmap: IBitmap; X, Y: Integer); overload;
        procedure DrawBitmap(Surface: ISurface; Bitmap: IBitmap; X, Y: Single; Scale: Single); overload;
        { Draw a caption in the control font, grayed if not enabled }
        procedure DrawCaption(Surface: ISurface; const Caption: string; const Rect: TRectI; Enabled: Boolean = True);
        { Draw text in the control font }
        procedure DrawText(Surface: ISurface; const Text: string; const Rect: TRectI; Direction: TDirection);
        { Draw a state background then text in the control font }
        procedure DrawTextState(Surface: ISurface; const Text: string; const Rect: TRectI; State: TDrawState; Radius: Float = 0);
        { Draw a background for a draw state }
        procedure DrawRectState(Surface: ISurface; const Rect: TRectI; State: TDrawState; Radius: Float = 0);
        { The control color resolving parent colors }
        property CurrentColor: TColorB read GetCurrentColor;
        { The parent control color }
        property ParentCurrentColor: TColorB read GetParentCurrentColor;
        { ParentEnabled is true if the control and all its parents are enabled }
        property ParentEnabled: Boolean read GetParentEnabled;
      end;

    See also

    Float in Codebot.System.pas
    IBitmap in Codebot.Graphics.Types.pas
    ISurface in Codebot.Graphics.Types.pas
    TColorB in Codebot.Graphics.Types.pas
    TDirection in Codebot.Graphics.Types.pas
    TDrawState in Codebot.Graphics.Types.pas
    TPointI in Codebot.Graphics.Types.pas
    TRectI in Codebot.Graphics.Types.pas