Changeset 622 for trunk/Packages/DpiControls
- Timestamp:
- Sep 15, 2024, 10:04:45 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/DpiControls/Dpi.Forms.pas
r500 r622 202 202 end; 203 203 204 { TMonitor } 205 206 TMonitor = class 207 private 208 function GetLeft: Integer; 209 function GetHeight: Integer; 210 function GetTop: Integer; 211 function GetWidth: Integer; 212 function GetBoundsRect: TRect; 213 public 214 NativeMonitor: Forms.TMonitor; 215 property Left: Integer read GetLeft; 216 property Height: Integer read GetHeight; 217 property Top: Integer read GetTop; 218 property Width: Integer read GetWidth; 219 property BoundsRect: TRect read GetBoundsRect; 220 end; 221 204 222 { TScreen } 205 223 … … 209 227 FActiveForm: TForm; 210 228 FPrevActiveForms: TForms; 229 FPrimaryMonitor: TMonitor; 211 230 FForms: TForms; 212 231 procedure AddForm(AForm: TForm); … … 215 234 function GetDesktopTop: Integer; 216 235 function GetDesktopWidth: Integer; 236 function GetPrimaryMonitor: TMonitor; 217 237 procedure RemoveForm(AForm: TForm); 218 238 function GetActiveForm: TForm; … … 248 268 property DesktopWidth: Integer read GetDesktopWidth; 249 269 property DesktopHeight: Integer read GetDesktopHeight; 270 property PrimaryMonitor: TMonitor read GetPrimaryMonitor; 250 271 end; 251 272 … … 477 498 begin 478 499 Result := Application.MessageBox(Text, Caption, Flags); 500 end; 501 502 { TMonitor } 503 504 function TMonitor.GetLeft: Integer; 505 begin 506 Result := ScaleFromNative(NativeMonitor.Left); 507 end; 508 509 function TMonitor.GetHeight: Integer; 510 begin 511 Result := ScaleFromNative(NativeMonitor.Height); 512 end; 513 514 function TMonitor.GetTop: Integer; 515 begin 516 Result := ScaleFromNative(NativeMonitor.Top); 517 end; 518 519 function TMonitor.GetWidth: Integer; 520 begin 521 Result := ScaleFromNative(NativeMonitor.Width); 522 end; 523 524 function TMonitor.GetBoundsRect: TRect; 525 begin 526 Result := ScaleRectFromNative(NativeMonitor.BoundsRect); 479 527 end; 480 528 … … 944 992 end; 945 993 994 function TScreen.GetPrimaryMonitor: TMonitor; 995 begin 996 if not Assigned(FPrimaryMonitor) then begin 997 FPrimaryMonitor := TMonitor.Create; 998 FPrimaryMonitor.NativeMonitor := LCLScreen.PrimaryMonitor; 999 end; 1000 Result := FPrimaryMonitor; 1001 end; 1002 946 1003 procedure TScreen.RemoveForm(AForm: TForm); 947 1004 begin … … 1006 1063 FreeAndNil(FForms); 1007 1064 FreeAndNil(FPrevActiveForms); 1065 if Assigned(FPrimaryMonitor) then 1066 FreeAndNil(FPrimaryMonitor); 1008 1067 inherited; 1009 1068 end;
Note:
See TracChangeset
for help on using the changeset viewer.