You've already forked lazarus-ccr
fpspreadsheet: Add cell inspector to spready demo (shows properties of selected cell).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3489 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4,7 +4,7 @@ object Form1: TForm1
|
||||
Top = 258
|
||||
Width = 884
|
||||
Caption = 'spready'
|
||||
ClientHeight = 614
|
||||
ClientHeight = 619
|
||||
ClientWidth = 884
|
||||
Menu = MainMenu
|
||||
OnActivate = FormActivate
|
||||
@ -14,7 +14,7 @@ object Form1: TForm1
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 78
|
||||
Top = 536
|
||||
Top = 541
|
||||
Width = 884
|
||||
Align = alBottom
|
||||
BevelOuter = bvNone
|
||||
@ -23,9 +23,9 @@ object Form1: TForm1
|
||||
TabOrder = 0
|
||||
object CbShowHeaders: TCheckBox
|
||||
Left = 8
|
||||
Height = 24
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 116
|
||||
Width = 93
|
||||
Caption = 'Show headers'
|
||||
Checked = True
|
||||
OnClick = CbShowHeadersClick
|
||||
@ -34,9 +34,9 @@ object Form1: TForm1
|
||||
end
|
||||
object CbShowGridLines: TCheckBox
|
||||
Left = 8
|
||||
Height = 24
|
||||
Height = 19
|
||||
Top = 39
|
||||
Width = 125
|
||||
Width = 100
|
||||
Caption = 'Show grid lines'
|
||||
Checked = True
|
||||
OnClick = CbShowGridLinesClick
|
||||
@ -45,7 +45,7 @@ object Form1: TForm1
|
||||
end
|
||||
object EdFrozenCols: TSpinEdit
|
||||
Left = 645
|
||||
Height = 28
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 52
|
||||
OnChange = EdFrozenColsChange
|
||||
@ -53,7 +53,7 @@ object Form1: TForm1
|
||||
end
|
||||
object EdFrozenRows: TSpinEdit
|
||||
Left = 645
|
||||
Height = 28
|
||||
Height = 23
|
||||
Top = 39
|
||||
Width = 52
|
||||
OnChange = EdFrozenRowsChange
|
||||
@ -61,37 +61,37 @@ object Form1: TForm1
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 560
|
||||
Height = 20
|
||||
Height = 15
|
||||
Top = 13
|
||||
Width = 77
|
||||
Width = 62
|
||||
Caption = 'Frozen cols:'
|
||||
FocusControl = EdFrozenCols
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 560
|
||||
Height = 20
|
||||
Height = 15
|
||||
Top = 40
|
||||
Width = 82
|
||||
Width = 66
|
||||
Caption = 'Frozen rows:'
|
||||
FocusControl = EdFrozenRows
|
||||
ParentColor = False
|
||||
end
|
||||
object CbReadFormulas: TCheckBox
|
||||
Left = 160
|
||||
Height = 24
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 120
|
||||
Width = 96
|
||||
Caption = 'Read formulas'
|
||||
OnChange = CbReadFormulasChange
|
||||
TabOrder = 2
|
||||
end
|
||||
object CbHeaderStyle: TComboBox
|
||||
Left = 408
|
||||
Height = 28
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 116
|
||||
ItemHeight = 20
|
||||
ItemHeight = 15
|
||||
ItemIndex = 2
|
||||
Items.Strings = (
|
||||
'Lazarus'
|
||||
@ -105,9 +105,9 @@ object Form1: TForm1
|
||||
end
|
||||
object CbAutoCalcFormulas: TCheckBox
|
||||
Left = 160
|
||||
Height = 24
|
||||
Height = 19
|
||||
Top = 39
|
||||
Width = 158
|
||||
Width = 128
|
||||
Caption = 'Calculate on change'
|
||||
OnChange = CbAutoCalcFormulasChange
|
||||
TabOrder = 3
|
||||
@ -115,9 +115,9 @@ object Form1: TForm1
|
||||
end
|
||||
object PageControl1: TPageControl
|
||||
Left = 0
|
||||
Height = 457
|
||||
Height = 462
|
||||
Top = 79
|
||||
Width = 884
|
||||
Width = 648
|
||||
ActivePage = TabSheet1
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
@ -125,13 +125,13 @@ object Form1: TForm1
|
||||
OnChange = PageControl1Change
|
||||
object TabSheet1: TTabSheet
|
||||
Caption = 'Sheet1'
|
||||
ClientHeight = 424
|
||||
ClientWidth = 876
|
||||
ClientHeight = 434
|
||||
ClientWidth = 640
|
||||
object WorksheetGrid: TsWorksheetGrid
|
||||
Left = 0
|
||||
Height = 424
|
||||
Height = 434
|
||||
Top = 0
|
||||
Width = 876
|
||||
Width = 640
|
||||
FrozenCols = 0
|
||||
FrozenRows = 0
|
||||
ReadFormulas = False
|
||||
@ -145,7 +145,7 @@ object Form1: TForm1
|
||||
TitleStyle = tsNative
|
||||
OnSelection = WorksheetGridSelection
|
||||
ColWidths = (
|
||||
56
|
||||
42
|
||||
64
|
||||
64
|
||||
64
|
||||
@ -263,19 +263,19 @@ object Form1: TForm1
|
||||
end
|
||||
object FontComboBox: TComboBox
|
||||
Left = 52
|
||||
Height = 28
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 127
|
||||
ItemHeight = 20
|
||||
ItemHeight = 15
|
||||
OnSelect = FontComboBoxSelect
|
||||
TabOrder = 0
|
||||
end
|
||||
object FontSizeComboBox: TComboBox
|
||||
Left = 179
|
||||
Height = 28
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 48
|
||||
ItemHeight = 20
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
'8'
|
||||
'9'
|
||||
@ -441,6 +441,69 @@ object Form1: TForm1
|
||||
Width = 5
|
||||
end
|
||||
end
|
||||
object InspectorSplitter: TSplitter
|
||||
Left = 648
|
||||
Height = 462
|
||||
Top = 79
|
||||
Width = 5
|
||||
Align = alRight
|
||||
ResizeAnchor = akRight
|
||||
end
|
||||
object InspectorPageControl: TPageControl
|
||||
Left = 653
|
||||
Height = 462
|
||||
Top = 79
|
||||
Width = 231
|
||||
ActivePage = PgCellValue
|
||||
Align = alRight
|
||||
TabIndex = 0
|
||||
TabOrder = 6
|
||||
OnChange = InspectorPageControlChange
|
||||
object PgCellValue: TTabSheet
|
||||
Caption = 'Cell value'
|
||||
ClientHeight = 434
|
||||
ClientWidth = 223
|
||||
object CellInspector: TValueListEditor
|
||||
Left = 0
|
||||
Height = 434
|
||||
Top = 0
|
||||
Width = 223
|
||||
Align = alClient
|
||||
FixedCols = 0
|
||||
RowCount = 15
|
||||
TabOrder = 0
|
||||
TitleStyle = tsNative
|
||||
DisplayOptions = [doColumnTitles, doAutoColResize]
|
||||
Strings.Strings = (
|
||||
'Row='
|
||||
'Column='
|
||||
'ContentType='
|
||||
'NumberValue='
|
||||
'DateTimeValue='
|
||||
'UTF8StringValue='
|
||||
'BoolValue='
|
||||
'ErrorValue='
|
||||
'RPNFormulaValue='
|
||||
'StringFormula.FormulaStr='
|
||||
'SharedFormulaBase='
|
||||
''
|
||||
''
|
||||
''
|
||||
)
|
||||
TitleCaptions.Strings = (
|
||||
''
|
||||
''
|
||||
)
|
||||
ColWidths = (
|
||||
109
|
||||
110
|
||||
)
|
||||
end
|
||||
end
|
||||
object PgProperties: TTabSheet
|
||||
Caption = 'Properties'
|
||||
end
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = '.xls'
|
||||
Filter = 'Excel spreadsheet (*.xls)|*.xls|Excel XML spreadsheet (*.xlsx)|*.xlsx|LibreOffice/OpenOffice spreadsheet (*.ods)|*.ods|Wikitable (pipes) (.wikitable_pipes)|.wikitable_pipes|All files (*.*)|*.*'
|
||||
@ -1162,6 +1225,13 @@ object Form1: TForm1
|
||||
AutoCheck = True
|
||||
end
|
||||
end
|
||||
object mnuView: TMenuItem
|
||||
Caption = 'View'
|
||||
object mnuInspector: TMenuItem
|
||||
Action = AcViewInspector
|
||||
AutoCheck = True
|
||||
end
|
||||
end
|
||||
end
|
||||
object ImageList: TImageList
|
||||
left = 272
|
||||
@ -2797,6 +2867,12 @@ object Form1: TForm1
|
||||
ImageIndex = 35
|
||||
OnExecute = AcAddRowExecute
|
||||
end
|
||||
object AcViewInspector: TAction
|
||||
AutoCheck = True
|
||||
Caption = 'Inspector'
|
||||
Checked = True
|
||||
OnExecute = AcViewInspectorExecute
|
||||
end
|
||||
end
|
||||
object FontDialog: TFontDialog
|
||||
MinFontSize = 0
|
||||
|
@ -7,7 +7,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, Grids,
|
||||
ColorBox, fpspreadsheetgrid, fpspreadsheet, fpsallformats;
|
||||
ColorBox, ValEdit, fpspreadsheetgrid, fpspreadsheet, fpsallformats;
|
||||
|
||||
type
|
||||
|
||||
@ -71,6 +71,7 @@ type
|
||||
AcNew: TAction;
|
||||
AcAddColumn: TAction;
|
||||
AcAddRow: TAction;
|
||||
AcViewInspector: TAction;
|
||||
AcWordwrap: TAction;
|
||||
AcVAlignDefault: TAction;
|
||||
AcVAlignTop: TAction;
|
||||
@ -152,6 +153,8 @@ type
|
||||
MenuItem64: TMenuItem;
|
||||
MenuItem65: TMenuItem;
|
||||
MenuItem66: TMenuItem;
|
||||
mnuInspector: TMenuItem;
|
||||
mnuView: TMenuItem;
|
||||
MnuFmtDateTimeMSZ: TMenuItem;
|
||||
MnuTimeInterval: TMenuItem;
|
||||
MnuShortTimeAM: TMenuItem;
|
||||
@ -196,6 +199,7 @@ type
|
||||
mnuSaveAs: TMenuItem;
|
||||
OpenDialog: TOpenDialog;
|
||||
PageControl1: TPageControl;
|
||||
InspectorPageControl: TPageControl;
|
||||
Panel1: TPanel;
|
||||
BordersPopupMenu: TPopupMenu;
|
||||
NumFormatPopupMenu: TPopupMenu;
|
||||
@ -203,9 +207,13 @@ type
|
||||
EdFrozenCols: TSpinEdit;
|
||||
FormulaToolBar: TToolBar;
|
||||
FormulaToolbarSplitter: TSplitter;
|
||||
InspectorSplitter: TSplitter;
|
||||
PgCellValue: TTabSheet;
|
||||
PgProperties: TTabSheet;
|
||||
ToolButton22: TToolButton;
|
||||
ToolButton23: TToolButton;
|
||||
ToolButton27: TToolButton;
|
||||
CellInspector: TValueListEditor;
|
||||
WorksheetGrid: TsWorksheetGrid;
|
||||
TabSheet1: TTabSheet;
|
||||
ToolBar1: TToolBar;
|
||||
@ -252,6 +260,7 @@ type
|
||||
procedure AcSaveAsExecute(Sender: TObject);
|
||||
procedure AcTextRotationExecute(Sender: TObject);
|
||||
procedure AcVertAlignmentExecute(Sender: TObject);
|
||||
procedure AcViewInspectorExecute(Sender: TObject);
|
||||
procedure AcWordwrapExecute(Sender: TObject);
|
||||
procedure CbAutoCalcFormulasChange(Sender: TObject);
|
||||
procedure CbBackgroundColorSelect(Sender: TObject);
|
||||
@ -268,14 +277,17 @@ type
|
||||
procedure FontSizeComboBoxSelect(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure InspectorPageControlChange(Sender: TObject);
|
||||
procedure PageControl1Change(Sender: TObject);
|
||||
procedure WorksheetGridSelection(Sender: TObject; aCol, aRow: Integer);
|
||||
|
||||
private
|
||||
{ private declarations }
|
||||
FCopiedFormat: TCell;
|
||||
procedure LoadFile(const AFileName: String);
|
||||
procedure SetupBackgroundColorBox;
|
||||
procedure UpdateBackgroundColorIndex;
|
||||
procedure UpdateCellInfo(ACell: PCell);
|
||||
procedure UpdateFontNameIndex;
|
||||
procedure UpdateFontSizeIndex;
|
||||
procedure UpdateFontStyleActions;
|
||||
@ -294,6 +306,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
StrUtils, TypInfo,
|
||||
fpcanvas, fpsutils, fpsnumformatparser;
|
||||
|
||||
const
|
||||
@ -518,6 +531,14 @@ end;
|
||||
procedure TForm1.AcNewExecute(Sender: TObject);
|
||||
begin
|
||||
WorksheetGrid.NewWorkbook(26, 100);
|
||||
|
||||
WorksheetGrid.BeginUpdate;
|
||||
try
|
||||
WorksheetGrid.Col := WorksheetGrid.FixedCols;
|
||||
WorksheetGrid.Row := WorksheetGrid.FixedRows;
|
||||
finally
|
||||
WorksheetGrid.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.AcNumFormatExecute(Sender: TObject);
|
||||
@ -600,6 +621,13 @@ begin
|
||||
UpdateVertAlignmentActions;
|
||||
end;
|
||||
|
||||
procedure TForm1.AcViewInspectorExecute(Sender: TObject);
|
||||
begin
|
||||
InspectorPageControl.Visible := AcViewInspector.Checked;
|
||||
InspectorSplitter.Visible := AcViewInspector.Checked;
|
||||
InspectorSplitter.Left := 0;
|
||||
end;
|
||||
|
||||
procedure TForm1.AcWordwrapExecute(Sender: TObject);
|
||||
begin
|
||||
with WorksheetGrid do Wordwraps[Selection] := TAction(Sender).Checked;
|
||||
@ -772,6 +800,19 @@ begin
|
||||
CbBackgroundColor.DropDownCount := DROPDOWN_COUNT;
|
||||
end;
|
||||
|
||||
procedure TForm1.InspectorPageControlChange(Sender: TObject);
|
||||
var
|
||||
r,c: Cardinal;
|
||||
cell: PCell;
|
||||
begin
|
||||
CellInspector.Parent := InspectorPageControl.ActivePage;
|
||||
|
||||
r := WorksheetGrid.GetWorksheetRow(WorksheetGrid.Row);
|
||||
c := WorksheetGrid.GetWorksheetCol(WorksheetGrid.Col);
|
||||
cell := WorksheetGrid.Worksheet.FindCell(r, c);
|
||||
UpdateCellInfo(cell);
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadFile(const AFileName: String);
|
||||
// Loads first worksheet from file into grid
|
||||
var
|
||||
@ -886,6 +927,8 @@ begin
|
||||
UpdateTextRotationActions;
|
||||
UpdateNumFormatActions;
|
||||
|
||||
UpdateCellInfo(cell);
|
||||
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateBackgroundColorIndex;
|
||||
@ -913,6 +956,110 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateCellInfo(ACell: PCell);
|
||||
var
|
||||
i: Integer;
|
||||
s: String;
|
||||
cb: TsCellBorder;
|
||||
begin
|
||||
with CellInspector do begin
|
||||
TitleCaptions[0] := 'Properties';
|
||||
TitleCaptions[1] := 'Values';
|
||||
Strings.Clear;
|
||||
if InspectorPageControl.ActivePage = PgCellValue then
|
||||
begin
|
||||
if ACell=nil
|
||||
then Strings.Add('Row=')
|
||||
else Strings.Add(Format('Row=%d', [ACell^.Row]));
|
||||
if ACell=nil
|
||||
then Strings.Add('Column=')
|
||||
else Strings.Add(Format('Column=%d', [ACell^.Col]));
|
||||
if ACell=nil
|
||||
then Strings.Add('ContentType=')
|
||||
else Strings.Add(Format('ContentType=%s', [GetEnumName(TypeInfo(TCellContentType), ord(ACell^.ContentType))]));
|
||||
if ACell=nil
|
||||
then Strings.Add('NumberValue=')
|
||||
else Strings.Add(Format('NumberValue=%g', [ACell^.NumberValue]));
|
||||
if ACell=nil
|
||||
then Strings.Add('DateTimeValue=')
|
||||
else Strings.Add(Format('DateTimeValue=%g', [ACell^.DateTimeValue]));
|
||||
if ACell=nil
|
||||
then Strings.Add('UTF8StringValue=')
|
||||
else Strings.Add(Format('UTF8StringValue=%s', [ACell^.UTF8StringValue]));
|
||||
if ACell=nil
|
||||
then Strings.Add('BoolValue=')
|
||||
else Strings.Add(Format('BoolValue=%s', [BoolToStr(ACell^.BoolValue)]));
|
||||
if ACell=nil
|
||||
then Strings.Add('ErrorValue=')
|
||||
else Strings.Add(Format('ErrorValue=%s', [
|
||||
GetEnumName(TypeInfo(TsErrorValue), ord(ACell^.ErrorValue)) ]));
|
||||
if (ACell=nil) or (Length(ACell^.RPNFormulaValue) = 0)
|
||||
then Strings.Add('RPNFormulaValue=')
|
||||
else Strings.Add(Format('RPNFormulaValue=(%d tokens)', [Length(ACell^.RPNFormulaValue)]));
|
||||
if (ACell=nil) or (Length(ACell^.FormulaValue.FormulaStr)=0)
|
||||
then Strings.Add('FormulaValue.FormulaStr=')
|
||||
else Strings.Add(Format('FormulaValue.FormulaStr="%s"', [ACell^.FormulaValue.FormulaStr]));
|
||||
if (ACell=nil) or (ACell^.SharedFormulaBase=nil)
|
||||
then Strings.Add('SharedFormulaBase=')
|
||||
else Strings.Add(Format('SharedFormulaBase=%s', [GetCellString(
|
||||
ACell^.SharedFormulaBase^.Row, ACell^.SharedFormulaBase^.Col)]));
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (ACell=nil) or not (uffFont in ACell^.UsedFormattingFields)
|
||||
then Strings.Add('FontIndex=')
|
||||
else Strings.Add(Format('FontIndex=%d (%s(', [
|
||||
ACell^.FontIndex,
|
||||
WorksheetGrid.Workbook.GetFontAsString(ACell^.FontIndex)]));
|
||||
if (ACell=nil) or not (uffTextRotation in ACell^.UsedFormattingFields)
|
||||
then Strings.Add('TextRotation=')
|
||||
else Strings.Add(Format('TextRotation=%s', [GetEnumName(TypeInfo(TsTextRotation), ord(ACell^.TextRotation))]));
|
||||
if (ACell=nil) or not (uffHorAlign in ACell^.UsedFormattingFields)
|
||||
then Strings.Add('HorAlignment=')
|
||||
else Strings.Add(Format('HorAlignment=%s', [GetEnumName(TypeInfo(TsHorAlignment), ord(ACell^.HorAlignment))]));
|
||||
if (ACell=nil) or not (uffVertAlign in ACell^.UsedFormattingFields)
|
||||
then Strings.Add('VertAlignment=')
|
||||
else Strings.Add(Format('VertAlignment=%s', [GetEnumName(TypeInfo(TsVertAlignment), ord(ACell^.VertAlignment))]));
|
||||
if (ACell=nil) or not (uffBorder in ACell^.UsedFormattingFields) then
|
||||
Strings.Add('Borders=')
|
||||
else begin
|
||||
s := '';
|
||||
if cbNorth in ACell^.Border then s := s + ', cbNorth';
|
||||
if cbSouth in ACell^.Border then s := s + ', cbSouth';
|
||||
if cbEast in ACell^.Border then s := s + ', cbEast';
|
||||
if cbWest in ACell^.Border then s := s + ', cbWest';
|
||||
if cbDiagUp in ACell^.Border then s := s + ', cbDiagUp';
|
||||
if cbDiagDown in ACell^.Border then s := s + ', cbDiagDown';
|
||||
if s <> '' then Delete(s, 1, 2);
|
||||
Strings.Add('Borders='+s);
|
||||
end;
|
||||
for cb in TsCellBorder do
|
||||
if ACell=nil then
|
||||
Strings.Add(Format('BorderStyles[%s]=', [
|
||||
GetEnumName(TypeInfo(TsCellBorder), ord(cb))
|
||||
]))
|
||||
else
|
||||
Strings.Add(Format('BorderStyles[%s]=%s, %s', [
|
||||
GetEnumName(TypeInfo(TsCellBorder), ord(cb)),
|
||||
GetEnumName(TypeInfo(TsLineStyle), ord(ACell^.BorderStyles[cbEast].LineStyle)),
|
||||
WorksheetGrid.Workbook.GetColorName(ACell^.BorderStyles[cbEast].Color)
|
||||
]));
|
||||
if (ACell=nil) or not (uffBackgroundColor in ACell^.UsedformattingFields)
|
||||
then Strings.Add('BackgroundColor=')
|
||||
else Strings.Add(Format('BackgroundColor=%d (%s)', [
|
||||
ACell^.BackgroundColor,
|
||||
WorksheetGrid.Workbook.GetColorName(Acell^.BackgroundColor)
|
||||
]));
|
||||
if (ACell=nil) or not (uffNumberFormat in ACell^.UsedFormattingFields)
|
||||
then Strings.Add('NumberFormat=')
|
||||
else Strings.Add(Format('NumberFormat=%s', [GetEnumName(TypeInfo(TsNumberFormat), ord(ACell^.NumberFormat))]));
|
||||
if (ACell=nil) or not (uffNumberFormat in ACell^.UsedFormattingFields)
|
||||
then Strings.Add('NumberFormatStr=')
|
||||
else Strings.Add('NumberFormatStr=' + ACell^.NumberFormatStr);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateFontNameIndex;
|
||||
var
|
||||
fname: String;
|
||||
|
@ -863,6 +863,7 @@ type
|
||||
function GetDefaultFont: TsFont;
|
||||
function GetDefaultFontSize: Single;
|
||||
function GetFont(AIndex: Integer): TsFont;
|
||||
function GetFontAsString(AIndex: Integer): String;
|
||||
function GetFontCount: Integer;
|
||||
procedure InitFonts;
|
||||
procedure RemoveAllFonts;
|
||||
@ -5588,6 +5589,28 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
{@@
|
||||
Returns a string which identifies the font with a given index.
|
||||
|
||||
@param AIndex Index of the font
|
||||
@return String with font name, font size etc.
|
||||
}
|
||||
function TsWorkbook.GetFontAsString(AIndex: Integer): String;
|
||||
var
|
||||
fnt: TsFont;
|
||||
begin
|
||||
fnt := GetFont(AIndex);
|
||||
if fnt <> nil then begin
|
||||
Result := Format('%s, size %.1f, color %s', [
|
||||
fnt.FontName, fnt.Size, GetColorName(fnt.Color)]);
|
||||
if (fssBold in fnt.Style) then Result := Result + ', bold';
|
||||
if (fssItalic in fnt.Style) then Result := Result + ', italic';
|
||||
if (fssUnderline in fnt.Style) then Result := Result + ', underline';
|
||||
if (fssStrikeout in fnt.Style) then result := Result + ', strikeout';
|
||||
end else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
{@@
|
||||
Returns the count of registered fonts
|
||||
}
|
||||
|
Reference in New Issue
Block a user