Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/CevoComponents/ButtonB.pas

    r179 r210  
    44
    55uses
    6   ButtonBase, Classes, Graphics, LCLIntf, LCLType, UDpiControls;
     6  UDpiControls, ButtonBase, Classes, Graphics, LCLIntf, LCLType;
    77
    88type
     
    1212    FMask: TDpiBitmap;
    1313    FIndex: integer;
    14     procedure SetIndex(x: integer);
     14    procedure SetIndex(Text: integer);
    1515  public
    1616    property Mask: TDpiBitmap read FMask write FMask;
     
    2525procedure Register;
    2626
     27
    2728implementation
     29
     30uses
     31  ScreenTools;
    2832
    2933procedure Register;
    3034begin
    31   RegisterComponents('Samples', [TButtonB]);
     35  RegisterComponents('C-evo', [TButtonB]);
    3236end;
    3337
     
    3539begin
    3640  inherited Create(aOwner);
    37   ShowHint := true;
     41  ShowHint := True;
    3842  SetBounds(0, 0, 25, 25);
    3943end;
     
    4246begin
    4347  with Canvas do
    44     if FGraphic <> nil then
    45     begin
    46       DpiBitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle, 169,
    47         243 + 26 * Byte(FDown), SRCCOPY);
    48       if FIndex >= 0 then
    49       begin
    50         DpiBitBlt(Canvas.Handle, 0, 0, 25, 25, FMask.Canvas.Handle,
     48    if FGraphic <> nil then begin
     49      DpiBitCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas, 169,
     50        243 + 26 * Byte(FDown));
     51      if FIndex >= 0 then begin
     52        DpiBitCanvas(Canvas, 0, 0, 25, 25, FMask.Canvas,
    5153          1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCAND);
    52         DpiBitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle,
     54        DpiBitCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas,
    5355          1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCPAINT);
    5456      end
    55     end
    56     else
    57     begin
     57    end else begin
    5858      Brush.Color := $0000FF;
    59       FrameRect(Rect(0, 0, 25, 25))
    60     end
     59      FrameRect(Rect(0, 0, 25, 25));
     60    end;
    6161end;
    6262
    63 procedure TButtonB.SetIndex(x: integer);
     63procedure TButtonB.SetIndex(Text: integer);
    6464begin
    65   if x <> FIndex then
    66   begin
    67     FIndex := x;
    68     Invalidate
    69   end
     65  if Text <> FIndex then begin
     66    FIndex := Text;
     67    Invalidate;
     68  end;
    7069end;
    7170
Note: See TracChangeset for help on using the changeset viewer.