📄 frxdesgneditors.pas
字号:
begin
e := GetFloatValue;
case TfrxDesignerForm(Designer).Units of
duCM: e := e / 10;
duInches: e := e / 25.4;
duPixels: e := e * 96 / 25.4;
duChars: e := e * 96 / 25.4 / FRatio;
end;
if e = Int(e) then
Result := FloatToStr(e) else
Result := Format('%f', [e]);
end;
procedure TfrxPaperXProperty.SetValue(const Value: String);
var
e: Extended;
begin
e := frxStrToFloat(Value);
case TfrxDesignerForm(Designer).Units of
duCM: e := e * 10;
duInches: e := e * 25.4;
duPixels: e := e * 25.4 / 96;
duChars: e := e * 25.4 / 96 * FRatio;
end;
SetFloatValue(e);
end;
{ TfrxPaperYProperty }
constructor TfrxPaperYProperty.Create(Designer: TfrxCustomDesigner);
begin
inherited;
FRatio := fr1CharY;
end;
{ TfrxEventProperty }
function TfrxEventProperty.Edit: Boolean;
var
i: Integer;
begin
if Value = '' then
begin
Value := frComponent.Name + GetName;
i := frxLocateEventHandler(Designer.Code, Designer.Report.ScriptLanguage,
Value);
if i = -1 then
i := frxAddEvent(Designer.Code, Designer.Report.ScriptLanguage,
PropInfo.PropType^, Value) else
Inc(i, 3);
TfrxDesignerForm(Designer).SwitchToCodeWindow;
TfrxDesignerForm(Designer).CodeWindow.UpdateView;
TfrxDesignerForm(Designer).CodeWindow.SetPos(3, i);
Result := True;
end
else
begin
i := frxLocateEventHandler(Designer.Code, Designer.Report.ScriptLanguage,
Value);
TfrxDesignerForm(Designer).SwitchToCodeWindow;
TfrxDesignerForm(Designer).CodeWindow.SetPos(1, i + 3);
Result := False;
end;
end;
function TfrxEventProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paMultiSelect, paValueList];
end;
procedure TfrxEventProperty.GetValues;
begin
inherited;
frxGetEventHandlersList(Designer.Code, Designer.Report.ScriptLanguage,
PropInfo.PropType^, Values);
end;
{ TfrxStringsProperty }
function TfrxStringsProperty.Edit: Boolean;
var
l: TStrings;
begin
with TfrxStringsEditorForm.Create(Designer) do
begin
l := TStrings(GetOrdValue);
Memo.Lines.Assign(l);
Result := ShowModal = mrOk;
if Result then
l.Assign(Memo.Lines);
Free;
end;
end;
function TfrxStringsProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paDialog, paReadOnly];
end;
{ TfrxBrushProperty }
function TfrxBrushProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paMultiSelect, paValueList, paOwnerDraw];
end;
procedure TfrxBrushProperty.OnDrawLBItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
begin
inherited;
with TListBox(Control), TListBox(Control).Canvas do
begin
Brush.Style := TBrushStyle(Index);
Brush.Color := clBlack;
Rectangle(ARect.Left + 2, ARect.Top + 2, ARect.Left + (ARect.Bottom - ARect.Top - 2), ARect.Bottom - 2);
end;
end;
procedure TfrxBrushProperty.OnDrawItem(Canvas: TCanvas; ARect: TRect);
begin
inherited;
with Canvas do
begin
Brush.Style := TBrushStyle(GetOrdValue);
Brush.Color := clBlack;
Rectangle(ARect.Left, ARect.Top + 1, ARect.Left + (ARect.Bottom - ARect.Top - 5), ARect.Bottom - 4);
end;
end;
{ TfrxFrameStyleProperty }
function TfrxFrameStyleProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paMultiSelect, paValueList, paOwnerDraw];
end;
procedure HLine(Canvas: TCanvas; X, Y, DX: Integer);
var
i: Integer;
begin
with Canvas do
begin
Pen.Color := clBlack;
if Pen.Style = psClear then
begin
Pen.Style := psSolid;
for i := 0 to 1 do
begin
MoveTo(X, Y - 2 + i * 2);
LineTo(X + DX, Y - 2 + i * 2);
end
end
else
for i := 0 to 1 do
begin
MoveTo(X, Y - 1 + i);
LineTo(X + DX, Y - 1 + i);
end;
end;
end;
procedure TfrxFrameStyleProperty.OnDrawLBItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
begin
with TListBox(Control), TListBox(Control).Canvas do
begin
FillRect(ARect);
TextOut(ARect.Left + 40, ARect.Top + 1, TListBox(Control).Items[Index]);
Pen.Color := clGray;
Brush.Color := clWhite;
Rectangle(ARect.Left + 2, ARect.Top + 2, ARect.Left + 36, ARect.Bottom - 2);
Pen.Style := TPenStyle(Index);
HLine(TListBox(Control).Canvas, ARect.Left + 3, ARect.Top + (ARect.Bottom - ARect.Top) div 2, 32);
Pen.Style := psSolid;
end;
end;
procedure TfrxFrameStyleProperty.OnDrawItem(Canvas: TCanvas; ARect: TRect);
begin
with Canvas do
begin
TextOut(ARect.Left + 38, ARect.Top, Value);
Pen.Color := clGray;
Brush.Color := clWhite;
Rectangle(ARect.Left, ARect.Top + 1, ARect.Left + 34, ARect.Bottom - 4);
Pen.Color := clBlack;
Pen.Style := TPenStyle(GetOrdValue);
HLine(Canvas, ARect.Left + 1, ARect.Top + (ARect.Bottom - ARect.Top) div 2 - 1, 32);
Pen.Style := psSolid;
end;
end;
function TfrxFrameStyleProperty.GetExtraLBSize: Integer;
begin
Result := 36;
end;
{ TfrxDisplayFormatProperty }
function TfrxDisplayFormatProperty.Edit: Boolean;
var
i: Integer;
c: TfrxComponent;
begin
with TfrxFormatEditorForm.Create(Designer) do
begin
Format.Assign(TfrxCustomMemoView(Component).DisplayFormat);
Result := ShowModal = mrOk;
if Result then
for i := 0 to Self.Designer.SelectedObjects.Count - 1 do
begin
c := Self.Designer.SelectedObjects[i];
if (c is TfrxCustomMemoView) and not (rfDontModify in c.Restrictions) then
TfrxCustomMemoView(c).DisplayFormat := Format;
end;
Free;
end;
end;
function TfrxDisplayFormatProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paDialog, paMultiSelect, paReadOnly];
end;
{ TfrxBooleanProperty }
function TfrxBooleanProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paMultiSelect, paValueList, paOwnerDraw];
end;
procedure TfrxBooleanProperty.OnDrawItem(Canvas: TCanvas; ARect: TRect);
var
add: Integer;
begin
inherited;
with Canvas do
begin
Rectangle(ARect.Left, ARect.Top + 1, ARect.Left + (ARect.Bottom - ARect.Top - 5), ARect.Bottom - 4);
Pen.Color := clBlack;
if Screen.PixelsPerInch > 96 then
add := 2
else
add := 0;
if Boolean(GetOrdValue) = True then
with ARect do
begin
PolyLine([Point(Left + 2 + add, Top + 5 + add), Point(Left + 4 + add, Top + 7 + add), Point(Left + 9 + add, Top + 2 + add)]);
PolyLine([Point(Left + 2 + add, Top + 6 + add), Point(Left + 4 + add, Top + 8 + add), Point(Left + 9 + add, Top + 3 + add)]);
PolyLine([Point(Left + 2 + add, Top + 7 + add), Point(Left + 4 + add, Top + 9 + add), Point(Left + 9 + add, Top + 4 + add)]);
end;
end;
end;
procedure TfrxBooleanProperty.OnDrawLBItem(Control: TWinControl;
Index: Integer; ARect: TRect; State: TOwnerDrawState);
var
add: Integer;
begin
inherited;
with TListBox(Control), TListBox(Control).Canvas do
begin
Brush.Color := clWindow;
Rectangle(ARect.Left + 2, ARect.Top + 2, ARect.Left + (ARect.Bottom - ARect.Top - 2), ARect.Bottom - 2);
Pen.Color := clBlack;
if Screen.PixelsPerInch > 96 then
add := 2
else
add := 0;
if Index = 1 then
with ARect do
begin
PolyLine([Point(Left + 5 + add, Top + 6 + add), Point(Left + 7 + add, Top + 8 + add), Point(Left + 12 + add, Top + 3 + add)]);
PolyLine([Point(Left + 5 + add, Top + 7 + add), Point(Left + 7 + add, Top + 9 + add), Point(Left + 12 + add, Top + 4 + add)]);
PolyLine([Point(Left + 5 + add, Top + 8 + add), Point(Left + 7 + add, Top + 10 + add), Point(Left + 12 + add, Top + 5 + add)]);
end;
end;
end;
{ TfrxPrinterProperty }
function TfrxPrinterProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paValueList];
end;
procedure TfrxPrinterProperty.GetValues;
begin
inherited;
Values.Assign(frxPrinters.Printers);
Values.Insert(0, frxResources.Get('prDefault'));
end;
{ TfrxPaperProperty }
function TfrxPaperProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paValueList];
end;
function TfrxPaperProperty.GetValue: String;
var
i: Integer;
begin
i := frxPrinters.Printer.PaperIndex(GetOrdValue);
if i = -1 then
i := frxPrinters.Printer.PaperIndex(256);
Result := frxPrinters.Printer.Papers[i];
end;
procedure TfrxPaperProperty.GetValues;
begin
inherited;
Values.Assign(frxPrinters.Printer.Papers);
end;
procedure TfrxPaperProperty.SetValue(const Value: String);
begin
SetOrdValue(frxPrinters.Printer.PaperNameToNumber(Value));
end;
{ TfrxStyleProperty }
function TfrxStyleProperty.GetAttributes: TfrxPropertyAttributes;
begin
Result := [paValueList, paMultiSelect];
end;
procedure TfrxStyleProperty.GetValues;
begin
inherited;
Designer.Report.Styles.GetList(Values);
end;
{ TfrxColumnFooterEditor }
function TfrxColumnFooterEditor.Execute(Tag: Integer; Checked: Boolean): Boolean;
begin
// do nothing
Result := False;
end;
procedure TfrxColumnFooterEditor.GetMenuItems;
begin
// do nothing
end;
{ TfrxColumnHeaderEditor }
function TfrxColumnHeaderEditor.Execute(Tag: Integer; Checked: Boolean): Boolean;
var
b: TfrxBand;
begin
Result := False;
b := Designer.SelectedObjects[0];
if not (rfDontModify in b.Restrictions) then
begin
case Tag of
10: b.Stretched := Checked;
end;
Result := True;
end;
end;
procedure TfrxColumnHeaderEditor.GetMenuItems;
var
b: TfrxBand;
begin
if Designer.SelectedObjects.Count > 1 then Exit;
b := TfrxBand(Component);
AddItem(frxResources.Get('mvStretch'), 10, b.Stretched);
end;
{ TfrxOverlayEditor }
function TfrxOverlayEditor.Execute(Tag: Integer; Checked: Boolean): Boolean;
begin
//do nothhing
Result := False;
end;
procedure TfrxOverlayEditor.GetMenuItems;
begin
//do nothhing
end;
initialization
frxObjects.RegisterObject1(TfrxMemoView, nil, '', '', 0, 2, [ctReport, ctData]);
frxObjects.RegisterObject1(TfrxPictureView, nil, '', '', 0, 3);
frxObjects.RegisterObject1(TfrxSubreport, nil, '', '', 0, 4, [ctReport, ctDMP]);
frxObjects.RegisterObject1(TfrxSysMemoView, nil, '', '', 0, 32);
frxObjects.RegisterCategory('Draw', nil, 'obCatDraw', 6);
frxObjects.RegisterCategory('Other', nil, 'obCatOther', 66);
{$IFDEF DB_CAT}
frxObjects.RegisterCategory('DATABASES',nil,'obDataBases',37);
frxObjects.RegisterCategory('TABLES',nil,'obTables',52);
frxObjects.RegisterCategory('QUERIES',nil,'obQueries',39);
{$ENDIF}
frxObjects.RegisterObject1(TfrxLineView, nil, '', 'Draw', 0, 5, [ctReport, ctData]);
frxObjects.RegisterObject1(TfrxLineView, nil, 'obDiagLine', 'Draw', 1, 7);
frxObjects.RegisterObject1(TfrxLineView, nil, 'obDiagLine', 'Draw', 2, 63);
frxObjects.RegisterObject1(TfrxLineView, nil, 'obDiagLine', 'Draw', 3, 64);
frxObjects.RegisterObject1(TfrxLineView, nil, 'obDiagLine', 'Draw', 4, 65);
frxObjects.RegisterObject1(TfrxShapeView, nil, 'obRect', 'Draw', 0, 8);
frxObjects.RegisterObject1(TfrxShapeView, nil, 'obRoundRect', 'Draw', 1, 9);
frxObjects.RegisterObject1(TfrxShapeView, nil, 'obEllipse', 'Draw', 2, 10);
frxObjects.RegisterObject1(TfrxShapeView, nil, 'obTrian', 'Draw', 3, 11);
frxObjects.RegisterObject1(TfrxShapeView, nil, 'obDiamond', 'Draw', 4, 31);
frxComponentEditors.Register(TfrxReportPage, TfrxPageEditor);
frxComponentEditors.Register(TfrxView, TfrxViewEditor);
frxComponentEditors.Register(TfrxMemoView, TfrxMemoEditor);
frxComponentEditors.Register(TfrxSysMemoView, TfrxSysMemoEditor);
frxComponentEditors.Register(TfrxDMPMemoView, TfrxMemoEditor);
frxComponentEditors.Register(TfrxLineView, TfrxLineEditor);
frxComponentEditors.Register(TfrxDMPLineView, TfrxLineEditor);
frxComponentEditors.Register(TfrxPictureView, TfrxPictureEditor);
frxComponentEditors.Register(TfrxBand, TfrxBandEditor);
frxComponentEditors.Register(TfrxDataBand, TfrxDataBandEditor);
frxComponentEditors.Register(TfrxHeader, TfrxHeaderEditor);
frxComponentEditors.Register(TfrxPageHeader, TfrxPageHeaderEditor);
frxComponentEditors.Register(TfrxPageFooter, TfrxPageFooterEditor);
frxComponentEditors.Register(TfrxGroupHeader, TfrxGroupHeaderEditor);
frxComponentEditors.Register(TfrxColumnHeader, TfrxColumnHeaderEditor);
frxComponentEditors.Register(TfrxColumnFooter, TfrxColumnFooterEditor);
frxComponentEditors.Register(TfrxOverlay, TfrxOverlayEditor);
frxComponentEditors.Register(TfrxDialogControl, TfrxDialogControlEditor);
frxComponentEditors.Register(TfrxSubreport, TfrxSubreportEditor);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxComponent, 'Left', TfrxLocSizeXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxComponent, 'Top', TfrxLocSizeYProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxComponent, 'Width', TfrxLocSizeXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxComponent, 'Height', TfrxLocSizeYProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxReportPage, 'PaperWidth', TfrxPaperXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxReportPage, 'PaperHeight', TfrxPaperYProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxReportPage, 'LeftMargin', TfrxPaperXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxReportPage, 'RightMargin', TfrxPaperXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxReportPage, 'TopMargin', TfrxPaperYProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxReportPage, 'BottomMargin', TfrxPaperYProperty);
frxPropertyEditors.Register(TypeInfo(Integer), TfrxReportPage, 'PaperSize', TfrxPaperProperty);
frxPropertyEditors.RegisterEventEditor(TfrxEventProperty);
frxPropertyEditors.Register(TypeInfo(Boolean), nil, '', TfrxBooleanProperty);
frxPropertyEditors.Register(TypeInfo(TfrxFrame), nil, '', TfrxFrameProperty);
frxPropertyEditors.Register(TypeInfo(TPicture), nil, '', TfrxPictureProperty);
frxPropertyEditors.Register(TypeInfo(TBitmap), nil, '', TfrxBitmapProperty);
frxPropertyEditors.Register(TypeInfo(TfrxDataSet), nil, '', TfrxDataSetProperty);
frxPropertyEditors.Register(TypeInfo(String), TfrxView, 'DataField', TfrxDataFieldProperty);
frxPropertyEditors.Register(TypeInfo(TStrings), nil, '', TfrxStringsProperty);
frxPropertyEditors.Register(TypeInfo(TWideStrings), TfrxCustomMemoView, 'Memo', TfrxMemoProperty);
frxPropertyEditors.Register(TypeInfo(TBrushStyle), nil, '', TfrxBrushProperty);
frxPropertyEditors.Register(TypeInfo(TfrxFrameStyle), nil, '', TfrxFrameStyleProperty);
frxPropertyEditors.Register(TypeInfo(String), TfrxMemoView, 'DisplayFormat', TfrxDisplayFormatProperty);
frxPropertyEditors.Register(TypeInfo(String), TfrxMemoView, 'Style', TfrxStyleProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxDataBand, 'ColumnWidth', TfrxLocSizeXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), TfrxDataBand, 'ColumnGap', TfrxLocSizeXProperty);
frxPropertyEditors.Register(TypeInfo(String), TfrxPrintOptions, 'Printer', TfrxPrinterProperty);
frxPropertyEditors.Register(TypeInfo(Integer), TfrxPrintOptions, 'PrintOnSheet', TfrxPaperProperty);
frxPropertyEditors.Register(TypeInfo(Extended), nil, 'NextCrossGap', TfrxLocSizeXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), nil, 'AddWidth', TfrxLocSizeXProperty);
frxPropertyEditors.Register(TypeInfo(Extended), nil, 'AddHeight', TfrxLocSizeYProperty);
frxHideProperties(TfrxReport, 'DefaultLanguage;IniFile;Name;Preview;ScriptLanguage;ScriptText;Tag;Variables;DataSetName;DotMatrixReport;OldStyleProgress;ShowProgress;StoreInDFM;ParentReport');
frxHideProperties(TfrxEngineOptions, 'NewSilentMode;MaxMemSize;PrintIfEmpty;SilentMode;TempDir;UseFileCache');
frxHideProperties(TfrxPreviewOptions, 'AllowEdit;Buttons;DoubleBuffered;Maximized;MDIChild;Modal;ShowCaptions;Zoom;ZoomMode');
frxHideProperties(TfrxReportOptions, 'CreateDate;LastChange;Compressed;Password');
frxHideProperties(TfrxReportPage, 'Bin;BinOtherPages;ColumnWidth;ColumnPositions;DataSetName;HGuides;VGuides');
frxHideProperties(TfrxDMPPage, 'BackPicture;Color;Font;Frame');
frxHideProperties(TfrxReportComponent, 'GroupIndex');
frxHideProperties(TfrxView, 'DataSetName');
frxHideProperties(TfrxBand, 'Vertical');
frxHideProperties(TfrxDataBand, 'DataSetName');
frxHideProperties(TFont, 'Height;Pitch');
frxHideProperties(TfrxHighlight, 'Active');
frxHideProperties(TfrxPictureView, 'ImageIndex');
frxHideProperties(TfrxSubreport, 'Page');
frxHideProperties(TfrxDataPage, 'Left;Tag;Top;Visible');
frxHideProperties(TfrxCustomMemoView, 'FirstParaBreak;LastParaBreak');
end.
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -