1+ { $I PythonTools.inc}
12unit PythonTools.Design.Forms;
23
34interface
@@ -15,6 +16,9 @@ interface
1516 TDBGrid = class (Vcl.DBGrids.TDBGrid)
1617 protected
1718 procedure DrawCell (ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override;
19+ public
20+ function ScaleValue (const Value : Integer): Integer; overload;
21+ function ScaleValue (const Value : TSize): TSize; overload;
1822 end ;
1923
2024 TFormsExportDialog = class (TDesignForm)
@@ -94,8 +98,6 @@ procedure DrawCheckBox(const ADBGrid: TDBGrid; const AColumn: TColumn;
9498const
9599 IS_CHECKED: array [boolean] of integer = (DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED);
96100var
97- LhTheme: Cardinal;
98- LSize: TSize;
99101 LStyle: TCustomStyleServices;
100102 LBoxSize: TSize;
101103 LDetail: TThemedButton;
@@ -117,7 +119,7 @@ procedure DrawCheckBox(const ADBGrid: TDBGrid; const AColumn: TColumn;
117119 LDetail := TThemedButton(Integer(LDetail) + 4 );
118120
119121 LDetails := LStyle.GetElementDetails(tbCheckBoxUncheckedNormal);
120- if not LStyle.GetElementSize(gCheckBoxElement.Handle, LDetails, esActual, LBoxSize, ADBGrid.CurrentPPI) then
122+ if not LStyle.GetElementSize(gCheckBoxElement.Handle, LDetails, esActual, LBoxSize { $IFDEF DELPHI10_3_UP } , ADBGrid.CurrentPPI { $ENDIF } ) then
121123 begin
122124 LBoxSize.cx := GetSystemMetrics(SM_CXMENUCHECK);
123125 LBoxSize.cy := GetSystemMetrics(SM_CYMENUCHECK);
@@ -130,7 +132,7 @@ procedure DrawCheckBox(const ADBGrid: TDBGrid; const AColumn: TColumn;
130132 RectVCenter(LRect, Rect(0 , ARect.Top, ARect.Right, ARect.Bottom));
131133
132134 LDetails := LStyle.GetElementDetails(LDetail);
133- LStyle.DrawElement(ADBGrid.Canvas.Handle, LDetails, LRect, nil , ADBGrid.CurrentPPI);
135+ LStyle.DrawElement(ADBGrid.Canvas.Handle, LDetails, LRect, nil { $IFDEF DELPHI10_3_UP } , ADBGrid.CurrentPPI { $ENDIF } );
134136
135137 if not (gdFocused in AState) then
136138 ADBGrid.Canvas.Brush.Color := LStyle.GetSystemColor(clHighlight);
@@ -213,10 +215,12 @@ procedure TFormsExportDialog.grFormsColEnter(Sender: TObject);
213215
214216procedure TFormsExportDialog.grFormsDrawColumnCell (Sender: TObject;
215217 const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
218+ var
219+ LRect: TRect;
216220begin
217221 inherited ;
218222 if Column.Field.DataType = ftBoolean then begin
219- var LRect := System.Classes.Rect(
223+ LRect := System.Classes.Rect(
220224 Rect.Left,
221225 Rect.Top,
222226 Rect.Right - (Column.Width div 2 ),
@@ -363,4 +367,22 @@ procedure TDBGrid.DrawCell(ACol, ARow: Longint; ARect: TRect;
363367 end ;
364368end ;
365369
370+ function TDBGrid.ScaleValue (const Value : TSize): TSize;
371+ begin
372+ { $IFDEF DELPHI10_4_UP}
373+ Result := inherited ;
374+ { $ELSE}
375+ Result := Value ;
376+ { $ENDIF}
377+ end ;
378+
379+ function TDBGrid.ScaleValue (const Value : Integer): Integer;
380+ begin
381+ { $IFDEF DELPHI10_4_UP}
382+ Result := inherited ;
383+ { $ELSE}
384+ Result := Value ;
385+ { $ENDIF}
386+ end ;
387+
366388end .
0 commit comments