Changeset 684 for trunk/Packages


Ignore:
Timestamp:
Jul 26, 2025, 10:38:53 PM (5 days ago)
Author:
chronos
Message:
  • Modified: Improved forms painting if resized to bigger dimensions.
Location:
trunk/Packages
Files:
4 edited

Legend:

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

    r657 r684  
    2323    procedure OffscreenPaint; virtual;
    2424    procedure VPaint; virtual;
     25    procedure DoOnResize; override;
    2526  public
    2627    UserLeft: Integer;
     
    4041  end;
    4142
     43  { TFramedDlg }
     44
    4245  TFramedDlg = class(TBufferedDrawDlg)
    4346  protected
     
    5356    procedure VPaint; override;
    5457    procedure FillOffscreen(Left, Top, Width, Height: Integer);
     58    procedure DoOnResize; override;
    5559  public
    5660    constructor Create(AOwner: TComponent); override;
     
    167171begin
    168172  BitBltCanvas(Canvas, 0, 0, ClientWidth, ClientHeight, Offscreen.Canvas, 0, 0);
     173end;
     174
     175procedure TBufferedDrawDlg.DoOnResize;
     176begin
     177  inherited;
     178  SmartUpdateContent;
    169179end;
    170180
     
    232242end;
    233243
    234 constructor TFramedDlg.Create;
     244constructor TFramedDlg.Create(AOwner: TComponent);
    235245begin
    236246  OnCreate := FormCreate;
     
    247257  ModalIndication := True;
    248258  Canvas.Brush.Style := TBrushStyle.bsClear;
    249   InnerWidth := Width - 2 * SideFrame;
    250   InnerHeight := Height - TitleHeight - NarrowFrame;
     259  DoOnResize;
    251260end;
    252261
     
    304313  L := BiColorTextWidth(Canvas, Caption);
    305314  Cut := (ClientWidth - L) div 2;
    306   xTexOffset := (Maintexture.Width - ClientWidth) div 2;
    307   yTexOffset := (Maintexture.Height - ClientHeight) div 2;
     315  xTexOffset := 0; //(Maintexture.Width - ClientWidth) div 2;
     316  yTexOffset := 0; //(Maintexture.Height - ClientHeight) div 2;
    308317  if WideBottom then
    309318    InnerBottom := ClientHeight - WideFrame
     
    332341  Frame(Canvas, SideFrame - 1, TitleHeight - 1, ClientWidth - SideFrame,
    333342    InnerBottom, MainTexture.ColorBevelShade, MainTexture.ColorBevelLight);
     343
    334344  // RFrame(Canvas,SideFrame - 2, TitleHeight - 2, ClientWidth - SideFrame + 1,
    335345  // InnerBottom + 1, MainTexture.ColorBevelShade, MainTexture.ColorBevelLight);
     
    471481begin
    472482  Fill(Offscreen.Canvas, Left, Top, Width, Height,
    473     SideFrame + (Maintexture.Width - ClientWidth) div 2,
    474     TitleHeight + (Maintexture.Height - ClientHeight) div 2);
     483    SideFrame, TitleHeight);
     484end;
     485
     486procedure TFramedDlg.DoOnResize;
     487begin
     488  inherited;
     489  InnerWidth := Width - 2 * SideFrame;
     490  InnerHeight := Height - TitleHeight - NarrowFrame;
     491  SmartUpdateContent;
    475492end;
    476493
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r622 r684  
    7373begin
    7474  inherited;
     75
     76  // Make all dialogs resizable
     77  //BorderStyle := TBorderStyle.bsSizeable;
     78  //BorderIcons := [TBorderIcon.biSystemMenu, TBorderIcon.biMinimize, TBorderIcon.biMaximize];
     79
    7580  Color := clBlack;
    7681  TitleHeight := 0;
  • 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
  • trunk/Packages/DpiControls/Dpi.Controls.pas

    r642 r684  
    122122    procedure SetParentFont(AValue: Boolean);
    123123    procedure SetShowHint(AValue: Boolean);
    124     procedure NativeFormResize(Sender: TObject);
     124    procedure NativeResize(Sender: TObject);
    125125    procedure NativeChangeBounds(Sender: TObject);
    126     procedure DoFormResize;
    127126    procedure DoChangeBounds;
    128127    procedure MouseDownHandler(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
     
    138137    function ColorIsStored: Boolean; virtual;
    139138  protected
     139    procedure DoOnResize; virtual;
    140140    procedure DoBorderSpacingChange(Sender: TObject; InnerSpaceChanged: Boolean); virtual;
    141141    function GetText: TCaption; virtual;
     
    604604begin
    605605  Font.NativeFont := GetNativeControl.Font;
    606   GetNativeControl.OnResize := NativeFormResize;
     606  GetNativeControl.OnResize := NativeResize;
    607607  GetNativeControl.OnChangeBounds := NativeChangeBounds;
    608608
     
    10341034end;
    10351035
    1036 procedure TControl.NativeFormResize(Sender: TObject);
     1036procedure TControl.NativeResize(Sender: TObject);
    10371037var
    10381038  R: TRect;
     
    10431043  FWidth := R.Width;
    10441044  FHeight := R.Height;
    1045   DoFormResize;
     1045  DoOnResize;
    10461046end;
    10471047
     
    10601060end;
    10611061
    1062 procedure TControl.DoFormResize;
     1062procedure TControl.DoOnResize;
    10631063begin
    10641064  if Assigned(FOnResize) then begin
Note: See TracChangeset for help on using the changeset viewer.