📄 editformunit.pas
字号:
{*********************************************}
{* RepoEdit - QuickReport Editor *}
{* for Delphi 4 *}
{* (R) Copyright *}
{* Borzov Vladimir borzov@rsm.ru *}
{*********************************************}
unit EditFormUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Spin, Buttons, ExtCtrls,
QuickRPT,QRCTRLS,QRPRNTR,
printers, ExtDlgs,RepoEdit,jpeg,ConfirmUnit1;
type
TEditForm = class(TForm)
EditTransparent: TCheckBox;
EditWordWrap: TCheckBox;
EditAutoSize: TCheckBox;
EditStretch: TCheckBox;
EditEnabled: TCheckBox;
EditFont: TBitBtn;
FontDialog: TFontDialog;
ColorDialog: TColorDialog;
EditColor: TBitBtn;
EditFrame: TBitBtn;
EditLeft: TSpinEdit;
EditTop: TSpinEdit;
EditWidth: TSpinEdit;
EditHeight: TSpinEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
EditNotFrontBack: TRadioGroup;
EditLines: TBitBtn;
EditPicture: TBitBtn;
BitBtnOk: TBitBtn;
BitBtnCancel: TBitBtn;
EditCenter: TCheckBox;
EditBrush: TBitBtn;
EditPen: TBitBtn;
EditDATA: TComboBox;
Bevel1: TBevel;
EditPage: TBitBtn;
EditZoom: TSpinEdit;
LabZOOM: TLabel;
EditPrintIfEmpty: TCheckBox;
EditPrinter: TBitBtn;
EditBandType: TComboBox;
EditForceNewColumn: TCheckBox;
EditForceNewPage: TCheckBox;
LabAlignment: TLabel;
EditAlignMent: TComboBox;
EditAlignToBottom: TCheckBox;
LabBandType: TLabel;
LabMask: TLabel;
EditMask: TEdit;
OpenPictureDialog: TOpenPictureDialog;
OpenDialog: TOpenDialog;
BitBtnDefault: TBitBtn;
EditCaption: TComboBox;
CheckReset: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure BitBtnOkClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure EditFontClick(Sender: TObject);
procedure EditFrameClick(Sender: TObject);
procedure EditBrushClick(Sender: TObject);
procedure EditPenClick(Sender: TObject);
procedure EditColorClick(Sender: TObject);
procedure EditPrinterClick(Sender: TObject);
procedure EditPageClick(Sender: TObject);
procedure EditPictureClick(Sender: TObject);
procedure EditLinesClick(Sender: TObject);
procedure BitBtnDefaultClick(Sender: TObject);
procedure BitBtnCancelClick(Sender: TObject);
private
{ Private declarations }
ThFrame:TQRFrame;
ThBrush:TBrush;
ThPen:TPen;
ThPrinterSettings:TQuickRepPrinterSettings;
ThPage:TQRpage;
public
{ Public declarations }
ThComp:TComponent;
ThRepEdit:TRepoEdit;
procedure SaveCompProp;
end;
var
EditForm: TEditForm;
implementation
uses FrameEditUnit,EditBrushUnit, EditPenUnit,
PrinterSettingsUnit, EditPageUnit, EditShapeUnit,DB, MessUnit,
qrExpbld,GEtMemoTextUnit;
{$R *.DFM}
procedure TEditForm.FormCreate(Sender: TObject);
begin
ThComp:=nil;
ThFrame:=nil;
ThBrush:=nil;
ThPen:=nil;
ThPrinterSettings:=nil;
ThPage:=nil;
ThRepEdit:=nil;
end;
procedure TEditForm.BitBtnOkClick(Sender: TObject);
begin
Close;
SaveCompProp;
end;
procedure TEditForm.SaveCompProp;
var i:integer;
begin
if Not Assigned(ThComp) then begin
bvMessError('Cannot define type of object!');
exit;
end;
if (ThComp is TQuickRep)
then ThRepEdit.enabled:=EditEnabled.Checked
else (ThComp as TCustomControl).Enabled:=EditEnabled.Checked;
for i:=0 to (ThComp as TCustomControl).ControlCount-1 do
if (ThComp as TCustomControl).Controls[i] is tEnabledLab then begin
(ThComp as TCustomControl).Controls[i].Visible:=not (ThComp as TCustomControl).Enabled;
break
end;
(ThComp as TCustomControl).Top:=EditTop.Value;
(ThComp as TCustomControl).Width:=EditWidth.Value;
(ThComp as TCustomControl).Left:=EditLeft.Value;
(ThComp as TCustomControl).Height:=EditHeight.Value;
if EditNotFrontBack.ItemIndex=1 then begin
(ThComp as TCustomControl).BringToFront;
if (ThComp.Owner is TRepoEdit) then
(ThComp.Owner as TRepoEdit).SaveNotFrontBack(thcomp.Name,editNotFrontBack.ItemIndex);
end
else if EditNotFrontBack.ItemIndex=2 then begin
(ThComp as TCustomControl).SendToBack;
if (ThComp.Owner is TRepoEdit) then
(ThComp.Owner as TRepoEdit).SaveNotFrontBack(ThComp.Name,editNotFrontBack.ItemIndex);
end;
if ThComp is TGraphicControl then begin
(ThComp as TGraphicControl).Left:=EditLeft.Value;
(ThComp as TGraphicControl).Top:=EditTop.Value;
(ThComp as TGraphicControl).Width:=EditWidth.Value;
(ThComp as TGraphicControl).height:=EditHeight.Value;
if EditNotFrontBack.ItemIndex=1 then begin
(ThComp as TGraphicControl).BringToFront;
end
else if EditNotFrontBack.ItemIndex=2 then begin
(ThComp as TGraphicControl).SendToBack;
end;
end;
if thcomp is TQRCustomLabel then (thcomp as TQRCustomLabel).Font:=FontDialog.Font
else if thcomp is TQRCustomRichText then (thcomp as TQRCustomRichText).Font:=FontDialog.Font
else if thcomp is TQRCustomBand then (thcomp as TQRCustomBand).Font:=FontDialog.Font
else if thcomp is TQuickRep then (thcomp as TQuickRep).Font:=FontDialog.Font;
// if ThComp is TEditLabel then (ThComp as TEditLabel).Font:=FontDialog.Font;
if thcomp is TQRCustomLabel
then (thcomp as TQRCustomLabel).WordWrap:=EditWordWrap.Checked;
if (thcomp is TQRCustomLabel) then (thcomp as TQRCustomLabel).AutoSize:=EditAutoSize.Checked
else if (thcomp is TQRImage) then (thcomp as TQRImage).AutoSize:=EditAutoSize.Checked;
if (thcomp is TQRCustomLabel) then (thcomp as TQRCustomLabel).AutoStretch:=EditStretch.Checked
else if (thcomp is TQRImage) then (thcomp as TQRImage).Stretch:=EditStretch.Checked
else if (thcomp is TQRDBImage) then (thcomp as TQRDBImage).Stretch:=EditStretch.Checked
else if (thcomp is TQRCustomRichText) then (thcomp as TQRCustomRichText).AutoStretch:=EditStretch.Checked;
if (thcomp is TQRLabel) then (thcomp as TQRLabel).Transparent:=EditTransparent.Checked
else if (thcomp is TQRDBText) then (thcomp as TQRDBText).Transparent:=EditTransparent.Checked
else if (thcomp is TQRMemo) then (thcomp as TQRMemo).Transparent:=EditTransparent.Checked
else if (thcomp is TQRExpr) then (thcomp as TQRExpr).Transparent:=EditTransparent.Checked
else if (thcomp is TQRSysData) then (thcomp as TQRSysData).Transparent:=EditTransparent.Checked;
// if ThComp is TEditlabel then (ThComp as TEditLabel).Transparent:=EditTransparent.Checked
// else if ThComp is TImage then (ThComp as TImage).Transparent:=EditTransparent.Checked;
if thcomp is TQRCustomLabel then (thcomp as TQRCustomLabel).Alignment:=TAlignment(EditAlignMent.ItemIndex)
else if thcomp is TQRCustomRichText then (thcomp as TQRCustomRichText).Alignment:=TAlignment(EditAlignMent.ItemIndex);
// if ThComp is TEditLabel then (THComp as TEditLabel).Alignment:=TAlignment(EditAlignMent.ItemIndex);
if thcomp is TQuickRep then (thcomp as TQuickRep).PrintIfEmpty:=EditPrintIfEmpty.Checked;
if thcomp is TQRCustomBand then (thcomp as TQrCustomBand).BandType:=TQRBandType(EditBandType.ItemIndex);
if thcomp is TQRCustomBand then begin
(thcomp as TQRCustomband).AlignToBottom:=EditAlignToBottom.Checked;
(thcomp as TQRCustomband).ForceNewColumn:=EditForceNewColumn.Checked;
(thcomp as TQRCustomband).ForceNewpage:=EditForceNewPage.Checked;
end;
if thcomp is TQRDBText then (thcomp as TQRDBText).DataField:=EditCaption.Text
else if thcomp is TQREXPr then begin
(thcomp as TQREXPR).Expression:=EditCaption.Text;
(thcomp as TQrExpr).ResetAfterPrint:=CheckReset.Checked;
end
else
if thcomp is TQRDBImage then (thcomp as TQRDBImage).DataField:=EditCaption.Text
else if thcomp is TQRSysData then (thcomp as TQRsysdata).Text:=EditCaption.Text
else if thcomp is TQRCustomLabel then (thcomp as TQRCustomlabel).Caption:=EditCaption.Text;
// if ThComp is TEditlabel then (ThComp as TEditLabel).caption:=EditCaption.Text;
if thcomp is TQRDBText then (thcomp as TQRDBText).Mask:=EditMask.Text
else if thcomp is TQRExpr then (thcomp as TQrExpr).Mask:=EditMask.Text;
if thcomp is TQRImage then (thcomp as TQRImage).Center:=EditCenter.Checked
else if thcomp is TQRDBImage then (thcomp as TQRDBImage).Center:=EditCenter.Checked;
if thcomp is TQRSysData then (thcomp as TQRSysData).Data:=TQRSysDATAType(EditDATA.ItemIndex);
if thcomp is TQRCustomLabel then (thcomp as TQRCustomLabel).Color:=ColorDialog.Color
else if thcomp is TQRCustomRichText then (thcomp as TQRCustomRichText).Color:=ColorDialog.Color
else if thcomp is TQRCustomBand then (thcomp as TQRCustomBand).Color:=ColorDialog.Color;
if (thcomp is TQRPrintable) then ThFrame:=(thcomp as TQRPrintable).Frame
else if (thcomp is TQRBasePanel) then ThFrame:=(thcomp as TQRBasePanel).Frame;
if thcomp is TQRPrintable then (thcomp as TQRPrintable).Zoom:=EditZoom.Value
else if thcomp is TQRBasePanel then (thcomp as TQRBasepanel).Zoom:=EditZOOM.Value;
if ThComp is TGraphicControl then
(ThComp as TGraphicControl).Repaint;
if Assigned(thRepEdit)
then begin
thRepEdit.SetRectCoord;
if assigned(thRepEdit.thPanel) then begin
thRepEdit.thPanel.SetFontButtons;
end
end;
end;
procedure TEditForm.FormShow(Sender: TObject);
var //thcomp:TComponent;
// ThNotFrontBack:integer;
i,k:integer;
ThDataSet:TDataSet;
begin
if Not Assigned(thcomp) then begin
bvMessError('Cannot define type of object!');
exit;
end;
self.Caption:='Component editor: ('+thComp.Name+')';
if (thcomp is TQuickRep)
then EditEnabled.Checked:=thRepEdit.Enabled
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -