Ignore:
Timestamp:
Jul 26, 2025, 10:38:53 PM (14 hours ago)
Author:
chronos
Message:
  • Modified: Improved forms painting if resized to bigger dimensions.
File:
1 edited

Legend:

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

    r666 r684  
    11231123
    11241124procedure Fill(Canvas: TCanvas; Left, Top, Width, Height, xOffset, yOffset: Integer);
    1125 begin
    1126   //Assert((Left + xOffset >= 0) and (Left + xOffset + Width <= MainTexture.Width) and
    1127   //  (Top + yOffset >= 0) and (Top + yOffset + Height <= MainTexture.Height));
    1128   BitBltCanvas(Canvas, Left, Top, Width, Height, MainTexture.Image.Canvas,
    1129     Left + xOffset, Top + yOffset);
     1125var
     1126  X, Y: Integer;
     1127  XX, YY: Integer;
     1128  W, H: Integer;
     1129begin
     1130  // BitBltCanvas(Canvas, Left, Top, Width, Height, MainTexture.Image.Canvas,
     1131  //   Left + xOffset, Top + yOffset);
     1132  if Width < MainTexture.Width then W := Width
     1133    else W := MainTexture.Width;
     1134  if Height < MainTexture.Height then H := Height
     1135    else H := MainTexture.Height;
     1136  if MainTexture.Height > 0 then YY := Trunc(Height / MainTexture.Height)
     1137    else YY := 0;
     1138  if MainTexture.Width > 0 then XX := Trunc(Width / MainTexture.Width)
     1139    else XX := 0;
     1140  for Y := 0 to YY do
     1141  for X := 0 to XX do
     1142    begin
     1143    BitBltCanvas(Canvas, Left + X * MainTexture.Width, Top + Y * MainTexture.Height,
     1144      W, H, MainTexture.Image.Canvas, 0, 0);
     1145  end;
    11301146end;
    11311147
     
    12121228procedure PaintBackground(Canvas: TCanvas; Left, Top, Width, Height, FormWidth,
    12131229  FormHeight: Integer);
    1214 var
    1215   X, Y: Integer;
    1216   XX, YY: Integer;
    1217 begin
    1218   if MainTexture.Height > 0 then YY := Trunc(Height / MainTexture.Height)
    1219     else YY := 0;
    1220   if MainTexture.Width > 0 then XX := Trunc(Width / MainTexture.Width)
    1221     else XX := 0;
    1222   for Y := 0 to YY do
    1223   for X := 0 to XX do
    1224   begin
    1225     Fill(Canvas, Left + X * MainTexture.Width, Top + Y * MainTexture.Height, Width, Height,
    1226       -(Left + X * MainTexture.Width), -(Top + Y * MainTexture.Height));
    1227   end;
     1230begin
     1231  Fill(Canvas, Left, Top, Width, Height, 0, 0)
    12281232end;
    12291233
Note: See TracChangeset for help on using the changeset viewer.