Ignore:
Timestamp:
May 1, 2024, 12:08:20 PM (7 months ago)
Author:
chronos
Message:
  • Modified: Start form changed to use Offscreen bitmap for drawing as Qt5 doesn't support copying from form canvas.
Location:
trunk/Packages/CevoComponents
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r554 r565  
    2121    procedure DoDeactivate(Sender: TObject);
    2222  protected
     23    // Defines area to grip the window for moving (from top)
    2324    TitleHeight: Integer;
    24     // defines area to grip the window for moving (from top)
    2525    procedure InitButtons;
    2626    procedure OnEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
     
    237237procedure TDrawDlg.SmartInvalidate;
    238238var
    239   i: Integer;
    240   r0, r1: HRgn;
    241 begin
    242   r0 := CreateRectRgn(0, 0, Width, Height);
    243   for i := 0 to ControlCount - 1 do
    244     if not (Controls[i] is TArea) and Controls[i].Visible then
    245     begin
    246       with Controls[i].BoundsRect do
    247         r1 := CreateRectRgn(Left, Top, Right, Bottom);
    248       CombineRgn(r0, r0, r1, RGN_DIFF);
    249       DeleteObject(r1);
    250     end;
    251   InvalidateRgn(Handle, r0, False);
    252   DeleteObject(r0);
     239  I: Integer;
     240  R0, R1: HRgn;
     241begin
     242  R0 := CreateRectRgn(0, 0, Width, Height);
     243  for I := 0 to ControlCount - 1 do
     244    if not (Controls[I] is TArea) and Controls[I].Visible then begin
     245      with Controls[I].BoundsRect do
     246        R1 := CreateRectRgn(Left, Top, Right, Bottom);
     247      CombineRgn(R0, R0, R1, RGN_DIFF);
     248      DeleteObject(R1);
     249    end;
     250  InvalidateRgn(Handle, R0, False);
     251  DeleteObject(R0);
    253252end;
    254253
     
    272271begin
    273272  if csDesigning in ComponentState then Exit;
    274   PaintBackground(Self, 3 + Border, 3 + Border, Width - (6 + 2 * Border),
    275     Height - (6 + 2 * Border));
     273  PaintBackground(Canvas, 3 + Border, 3 + Border, Width - (6 + 2 * Border),
     274    Height - (6 + 2 * Border), Width, Height);
    276275  for I := 0 to Border do
    277     Frame(Canvas, I, I, Width - 1 - I, Height - 1 - I,
    278       $000000, $000000);
     276    Frame(Canvas, I, I, Width - 1 - I, Height - 1 - I, $000000, $000000);
    279277  Frame(Canvas, Border + 1, Border + 1, Width - (2 + Border),
    280278    Height - (2 + Border), MainTexture.ColorBevelLight,
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r548 r565  
    7575procedure FillRectSeamless(Canvas: TCanvas; x0, y0, x1, y1, xOffset, yOffset: Integer;
    7676  const Texture: TBitmap);
    77 procedure PaintBackground(Form: TForm; Left, Top, Width, Height: Integer);
     77procedure PaintBackground(Canvas: TCanvas; Left, Top, Width, Height, FormWidth,
     78  FormHeight: Integer);
    7879procedure Corner(Canvas: TCanvas; X, Y, Kind: Integer; T: TTexture);
    7980procedure BiColorTextOut(Canvas: TCanvas; clMain, clBack: TColor; X, Y: Integer; S: string);
     
    12021203end;
    12031204
    1204 procedure PaintBackground(Form: TForm; Left, Top, Width, Height: Integer);
    1205 begin
    1206   Fill(Form.Canvas, Left, Top, Width, Height, (MainTexture.Width - Form.ClientWidth) div
    1207     2, (MainTexture.Height - Form.ClientHeight) div 2);
     1205procedure PaintBackground(Canvas: TCanvas; Left, Top, Width, Height, FormWidth,
     1206  FormHeight: Integer);
     1207begin
     1208  Fill(Canvas, Left, Top, Width, Height, (MainTexture.Width - FormWidth) div
     1209    2, (MainTexture.Height - FormHeight) div 2);
    12081210end;
    12091211
Note: See TracChangeset for help on using the changeset viewer.