- Timestamp:
- Apr 20, 2024, 6:20:48 PM (8 months ago)
- Location:
- trunk/Packages/DpiControls
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/DpiControls/Dpi.Common.pas
r545 r546 248 248 function ScaleToNative(Value: Integer): Integer; 249 249 begin 250 Result := Ceil(Value * ScreenInfo. Dpi / 96);250 Result := Ceil(Value * ScreenInfo.ToNative); 251 251 end; 252 252 … … 258 258 function ScaleFromNative(Value: Integer): Integer; 259 259 begin 260 Result := Floor(Value * 96 / ScreenInfo.Dpi);260 Result := Floor(Value * ScreenInfo.FromNative); 261 261 end; 262 262 … … 303 303 function ScaleFloatToNative(Value: Double): Double; 304 304 begin 305 Result := Value * ScreenInfo. Dpi / 96;305 Result := Value * ScreenInfo.ToNative; 306 306 end; 307 307 308 308 function ScaleFloatFromNative(Value: Double): Double; 309 309 begin 310 Result := Value * 96 / ScreenInfo.Dpi;310 Result := Value * ScreenInfo.FromNative; 311 311 end; 312 312 -
trunk/Packages/DpiControls/Dpi.Graphics.pas
r538 r546 340 340 end; 341 341 342 { TScreenInfo } 343 342 344 TScreenInfo = record 343 Dpi: Integer; 345 private 346 FDpi: Integer; 347 procedure SetDpi(AValue: Integer); 348 public 349 ToNative: Double; 350 FromNative: Double; 351 property Dpi: Integer read FDpi write SetDpi; 344 352 end; 345 353 … … 1325 1333 end; 1326 1334 1335 { TScreenInfo } 1336 1337 procedure TScreenInfo.SetDpi(AValue: Integer); 1338 begin 1339 if FDpi = AValue then Exit; 1340 FDpi := AValue; 1341 ToNative := ScreenInfo.Dpi / 96; 1342 FromNative := 96 / ScreenInfo.Dpi; 1343 end; 1344 1327 1345 { TPortableNetworkGraphic } 1328 1346
Note:
See TracChangeset
for help on using the changeset viewer.