⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editformunit.pas

📁 一个报表控件TRepoEdit
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  else   EditEnabled.Checked:=(thcomp as TCustomControl).Enabled;

  EditTop.Value:=(thcomp as TCustomControl).Top;
  EditWidth.Value:=(thcomp as TCustomControl).Width;
  EditLeft.Value:=(thcomp as TCustomControl).Left;
  EditHeight.Value:=(thcomp as TCustomControl).Height;
  ThBrush:=(thcomp as TCustomControl).Brush;

  if thcomp is TQRShape then ThPen:=(thcomp as TQRShape).pen
  else EditPen.Enabled:=false;

  if thcomp is TQuickRep then begin
     ThPrinterSettings:=(thcomp as TQuickRep).PrinterSettings;
     thPage:=(thcomp as TQuickRep).Page;
  end
  else begin
     EditPrinter.Enabled:=false;
     EditPage.Enabled:=false;
  end;

//  if (thcomp is
  if thcomp is TQRCustomLabel then  EditWordWrap.Checked:= (thcomp as TQRCustomLabel).WordWrap
  else EditWordWrap.Enabled:=false;

  if (thcomp is TQRCustomLabel) then  EditAutoSize.Checked:=(thcomp as TQRCustomLabel).AutoSize
  else if (thcomp is TQRImage) then  EditAutoSize.Checked:=(thcomp as TQRImage).AutoSize
  else EditAutoSize.Enabled:=false;

  if (thcomp is TQRCustomLabel) then EditStretch.Checked:=(thcomp as TQRCustomLabel).AutoStretch
  else if (thcomp is TQRImage) then EditStretch.Checked:=(thcomp as TQRImage).Stretch
  else if (thcomp is TQRDBImage) then EditStretch.Checked:=(thcomp as TQRDBImage).Stretch
  else if (thcomp is TQRCustomRichText) then EditStretch.Checked:=(thcomp as TQRCustomRichText).AutoStretch
  else EditStretch.Enabled:=false;

  if (thcomp is TQRLabel) then  EditTransparent.Checked:=(thcomp as TQRLabel).Transparent
  else if (thcomp is TQRDBText) then  EditTransparent.Checked:=(thcomp as TQRDBText).Transparent
  else if (thcomp is TQRMemo) then  EditTransparent.Checked:=(thcomp as TQRMemo).Transparent
  else if (thcomp is TQRExpr) then  EditTransparent.Checked:=(thcomp as TQRExpr).Transparent
  else if (thcomp is TQRSysData) then  EditTransparent.Checked:=(thcomp as TQRSysData).Transparent
  else EditTransparent.Enabled:=false;


  if thcomp is TQRCustomLabel then EditAlignMent.ItemIndex:=
     ORD((thcomp as TQRCustomLabel).Alignment)
  else if thcomp is TQRCustomRichText then EditAlignMent.ItemIndex:=
     ORD((thcomp as TQRCustomRichText).Alignment)
  else begin
    EditAlignMent.Enabled:=false;
    LabAlignment.Enabled:=false;
  end;


  if thcomp is TQuickRep then EditPrintIfEmpty.Checked:=(thcomp as TQuickRep).PrintIfEmpty
  else EditPrintIfEmpty.Enabled:=false;

  if thcomp is TQRCustomBand then EditBandType.ItemIndex:=
     ORD((thcomp as TQrCustomBand).BandType)
  else begin
    EditBandType.Enabled:=false;
    LabBandType.Enabled:=false;
  end;

  if thcomp is TQRCustomBand then begin
    EditAlignToBottom.Checked:=(thcomp as TQRCustomband).AlignToBottom;
    EditForceNewColumn.Checked:=(thcomp as TQRCustomband).ForceNewColumn;
    EditForceNewPage.Checked:=(thcomp as TQRCustomband).ForceNewpage;
  end
  else begin
    EditAlignToBottom.Enabled:=false;
    EditForceNewColumn.Enabled:=false;
    EditForceNewPage.Enabled:=false;
  end;

  if thcomp is TQRDBText then begin
    EditCaption.Style:=csDropDown;
    EditCaption.Items.Clear;
    for i:=0 to thcomp.Owner.ComponentCount-1 do
      if (thcomp.Owner.components[i] is TDataSet) then begin
         ThDataSet:=TDataSet(thcomp.Owner.components[i]);
         for k:=0 to ThDataSet.FieldCount-1 do begin
           EditCaption.Items.Add(ThDataSet.Fields[k].FieldName);
         end;
      end;
    EditCaption.Text:=(thcomp as TQRDBText).DataField;
  end
  else
  if thcomp is TQRDBImage then begin
    EditCaption.Style:=csDropDown;
    EditCaption.Items.Clear;
    for i:=0 to thcomp.Owner.ComponentCount-1 do
      if (thcomp.Owner.components[i] is TDataSet) then begin
         ThDataSet:=TDataSet(thcomp.Owner.components[i]);
         for k:=0 to ThDataSet.FieldCount-1 do begin
           EditCaption.Items.Add(ThDataSet.Fields[k].FieldName);
         end;
      end;
    EditCaption.Text:=(thcomp as TQRDBImage).DataField;
  end
  else
  if thcomp is TQREXPR then EditCaption.Text:=(thcomp as TQREXPR).Expression
  else
  if thcomp is TQRSysData then EditCaption.Text:=(thcomp as TQRsysdata).Text
  else
  if thcomp is TQRCustomLabel then EditCaption.Text:=(thcomp as TQRCustomlabel).Caption
  else begin
     EditCaption.Enabled:=false;
     if not (thcomp is TQRRichText) then EditLines.Enabled:=false;
  end;

  if thcomp is TQRDBText then EditMask.Text:=(thcomp as TQRDBText).Mask
  else if thcomp is TQRExpr then EditMask.Text:=(thcomp as TQrExpr).Mask
  else begin
     EditMask.Enabled:=false;
     LabMask.Enabled:=false;
  end;

  if thcomp is TqrExpr then CheckReset.Checked:=(thcomp as TqrExpr).ResetAfterPrint
  else begin
     CheckReset.Enabled:=false;
  end;

  if thcomp is TQRImage then EditCenter.Checked:=(thcomp as TQRImage).Center
  else if thcomp is TQRDBImage then EditCenter.Checked:=(thcomp as TQRDBImage).Center
  else begin
    EditCenter.Enabled:=false;
    if not (thcomp is TQRShape) then  EditPicture.Enabled:=false;
  end;

  if thcomp is TQRSysData then EditDATA.ItemIndex:=ord((thcomp as TQRSysData).Data)
  else EditDATA.Enabled:=false;

  if thcomp is TQRCustomLabel then FontDialog.Font:=(thcomp as TQRCustomLabel).Font
  else if thcomp is TQRCustomRichText then FontDialog.Font:=(thcomp as TQRCustomRichText).Font
  else if thcomp is TQRCustomBand then   FontDialog.Font:=(thcomp as TQRCustomBand).Font
  else if thcomp is TQuickRep then   FontDialog.Font:=(thcomp as TQuickRep).Font
  else EditFont.Enabled:=false;


  if thcomp is TQRCustomLabel then ColorDialog.Color:= (thcomp as TQRCustomLabel).Color
  else if thcomp is TQRCustomRichText then ColorDialog.Color:= (thcomp as TQRCustomRichText).Color
  else if thcomp is TQRCustomBand then ColorDialog.Color:= (thcomp as TQRCustomBand).Color
  else EditColor.Enabled:=false;

  if (thcomp is TQRPrintable) then ThFrame:=(thcomp as TQRPrintable).Frame
  else if (thcomp is TQRBasePanel) then ThFrame:=(thcomp as TQRBasePanel).Frame
  else EditFrame.Enabled:=false;

  if thcomp is TQRPrintable then EditZoom.Value:=(thcomp as TQRPrintable).Zoom
  else if thcomp is TQRBasePanel then EditZOOM.Value:=(thcomp as TQRBasepanel).Zoom
  else begin
    EditZOOM.Enabled:=false;
    LabZOOM.enabled:=false;
  end;


  if thcomp is TQRBasePanel then begin
    EditNotFrontBack.Enabled:=false;
  end
  else if (ThComp.Owner is TRepoEdit) then begin
    EditNotFrontBack.ItemIndex:=(ThComp.Owner as TRepoEdit).RestoreNotFrontBack(thcomp.Name);
  end;

end;

procedure TEditForm.EditFontClick(Sender: TObject);
begin
  FontDialog.Execute;
end;

procedure TEditForm.EditFrameClick(Sender: TObject);
var FrEd:TFrameEditForm;
begin
   FrEd:=TFrameEditForm.Create(Self);
   FrEd.ThFrame:=ThFrame;
   FrEd.ShowModal;
   FrEd.Free;
end;

procedure TEditForm.EditBrushClick(Sender: TObject);
var EdBr:TEditBrushForm;
begin
  EdBr:=TEditBrushForm.Create(Self);
  EdBR.ThBrush:=ThBrush;
  EdBr.ShowModal;
  EdBr.Free;
end;

procedure TEditForm.EditPenClick(Sender: TObject);
var EdPen:TEditPenForm;
begin
  EdPen:=TEditPenForm.Create(Self);
  EdPen.ThPen:=ThPen;
  Edpen.ShowModal;
  EdPen.Free;
end;

procedure TEditForm.EditColorClick(Sender: TObject);
begin
  ColorDialog.Execute;
end;

procedure TEditForm.EditPrinterClick(Sender: TObject);
var ThF:TPrinterSettingsForm;
begin
  ThF:=TPrinterSettingsForm.Create(Application);
  ThF.ThprinterSettings:=ThPrinterSettings;
  ThF.ShowModal;
  ThF.Free;
end;

procedure TEditForm.EditPageClick(Sender: TObject);
var EdP:TEditPageForm;
begin
  EdP:=TEditPageForm.Create(Application);
  Edp.thPage:=ThPage;
  Edp.Showmodal;
  EdP.Free;
end;

procedure TEditForm.EditPictureClick(Sender: TObject);
var ShF:TEditShapeForm;
begin
  if ThComp is TQRShape then begin
    ShF:=TEditShapeForm.Create(Application);
    ShF.EditShapeType.itemIndex:=ord((ThComp as TQRShape).Shape);
    ShF.SetImage;
    if ShF.ShowModal=mrOk then (ThComp as TQRShape).Shape:=
       TQRShapeType(ShF.EditShapeType.ItemIndex);
    ShF.Free;
  end
  else if ThComp is TQRImage then begin

    OpenPictureDialog.FileName:=(ThComp.Owner as TRepoEdit).GetDopParam(ThComp,'PICTURE');

    if (OpenPictureDialog.Execute) then begin

//     (ThComp.Owner as TRepoEdit).SaveFileName((ThComp as TEditlabel).OBJ,OpenPictureDialog.FileName);
    (ThComp.Owner as TRepoEdit).SetDopParam(ThComp,'PICTURE',OpenPictureDialog.FileName);

     try
       (ThComp as TQRImage).Picture.LoadFromFile(OpenPictureDialog.FileName);
     except
       on e:exception do bvMessError('Cannot open file'+#13+
                  'Message:'+E.Message);
     end;
    end;
  end;
end;

procedure TEditForm.EditLinesClick(Sender: TObject);
var str:string;
begin
  if (ThComp is TQRRichText) or (ThComp is TQRMemo) then begin

    OpenDialog.FileName:=(ThComp.Owner as TRepoEdit).GetDopParam(ThComp,'LINES');

    if (OpenDialog.Execute) then begin
     (ThComp.Owner as TRepoEdit).SetDopParam(ThComp,'LINES',OpenDialog.FileName);
     try
      if (ThComp is TQRRichText)
         then (ThComp as TQRRichText).Lines.LoadFromFile(OpenDialog.FileName)
      else (ThComp as TQRMemo).Lines.LoadFromFile(OpenDialog.FileName);
     except
       on e:exception do bvMessError('Cannot open file'+#13+
                  'Message:'+E.Message);
     end;
    end;
  end
  else if thComp is TQRExpr then begin
    str:=editcaption.text;
    GetExpression( 'Input expression',str,nil,nil,nil);
    editcaption.text:=str;
  end
  else if thComp is TQRExpr then begin
    str:=editcaption.text;
    GetExpression( '骡邃栩

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -