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

📄 repoedit.pas

📁 一个报表控件TRepoEdit
💻 PAS
📖 第 1 页 / 共 5 页
字号:
                  Values['LINES']:=GetDopParam(ThComp,'LINES');
                end
                else if thComp is TQRExpr then begin
                  FieldByname('Transparent').AsBoolean:=(ThComp as TQRExpr).Transparent;
                  Values['MASK']:=(ThComp as TQREXPR).MASK;
                  Values['EXPRESSION']:=(ThComp as TQREXPR).Expression;
                  VALUES['RESETAFTERPRINT']:= SetBool((ThComp as TQREXPR).ResetAfterPrint);
                end
                else if thComp is TQRSysData then begin
                  FieldByname('Transparent').AsBoolean:=(ThComp as TQRSysData).Transparent;
                  Values['TEXT']:=(ThComp as TQRSysData).Text;
                  Values['DATA']:=IntToStr(ORD((ThComp as TQRSysData).DATA));
                end

              end
              else if (ThComp is TQRCustomRichText) then begin
                FieldByname('Font.Charset').AsInteger:=ORD((ThComp as TQRCustomRichText).Font.Charset);
                FieldByname('Font.Color').AsInteger:=ORD((ThComp as TQRCustomRichText).Font.Color);
                FieldByname('Font.Height').AsInteger:=(ThComp as TQRCustomRichText).Font.Height;
                FieldByname('Font.Name').AsString:=(ThComp as TQRCustomRichText).Font.Name;
                FieldByname('Font.Pitch').AsInteger:=ORD((ThComp as TQRCustomRichText).Font.Pitch);
                FieldByname('Font.Size').AsInteger:=(ThComp as TQRCustomRichText).Font.Size;
                FieldByname('Font.Style.IsBold').AsBoolean:=fsBold in (ThComp as TQRCustomRichText).Font.Style;
                FieldByname('Font.Style.IsItalic').AsBoolean:=fsItalic in (ThComp as TQRCustomRichText).Font.Style;
                FieldByname('Font.Style.IsUnderline').AsBoolean:=fsUnderLine in (ThComp as TQRCustomRichText).Font.Style;
                FieldByname('Font.Style.IsStrikeOut').AsBoolean:=fsStrikeOut in (ThComp as TQRCustomRichText).Font.Style;

                FieldByname('Color').AsInteger:=ORD((ThComp as TQRCustomRichText).Color);
                FieldByname('Alignment').AsInteger:=ORD((ThComp as TQRCustomRichText).Alignment);
                FieldByname('Stretch').AsBoolean:=(ThComp as TQRCustomRichText).AutoStretch;


                if ThComp is TQRRichText then begin
                  Values['LINES']:=GetDopParam(ThComp,'LINES');
                end;

              end
              else if (ThComp is TQRImage) then begin
                FieldByname('Stretch').AsBoolean:=(ThComp as TQRImage).Stretch;
                FieldByname('AutoSize').AsBoolean:=(ThComp as TQRImage).AutoSize;
                Values['CENTER']:=SetBool((ThComp as TQRIMAGE).CENTER);
                Values['PICTURE']:=GetDopParam(ThComp,'PICTURE');
              end
              else if (ThComp is TQRDBImage) then begin
                FieldByname('Stretch').AsBoolean:=(ThComp as TQRDBImage).Stretch;
    //            FieldByname('AutoSize').AsBoolean:=(ThComp as TQRDBImage).AutoSie;

                Values['CENTER']:=SetBool((ThComp as TQRDBIMAGE).CENTER);
                Values['FIELD']:=(ThComp as TQRDBImage).DATAField;
              end
              else if (ThComp is TQRShape) then begin
                Values['SHAPE']:=inttostr(ord((ThComp as TQRSHAPE).SHAPE));
                Values['PEN.COLOR']:=inttostr(ord((ThComp as TQRSHAPE).Pen.Color));
                Values['PEN.MODE']:=inttostr(ord((ThComp as TQRSHAPE).Pen.MODE));
                Values['PEN.STYLE']:=inttostr(ord((ThComp as TQRSHAPE).Pen.Style));
                Values['PEN.WIDTH']:=inttostr((ThComp as TQRSHAPE).Pen.Width);
              end
           end
    ////////////////////
           else  if (ThComp is TQRBasePanel) then begin
              fieldByname('Frame.Color').AsInteger:=ORD((ThComp as TQRBasePanel).Frame.Color);
              fieldByname('Frame.DrawBottom').AsBoolean:=(ThComp as TQRBasePanel).Frame.DrawBottom;
              fieldByname('Frame.DrawLeft').AsBoolean:=(ThComp as TQRBasePanel).Frame.DrawLeft;
              FieldByName('Frame.DrawTop').AsBoolean:=(ThComp as TQRBasePanel).Frame.DrawTop;
              FieldByName('Frame.DrawRight').AsBoolean:=(ThComp as TQRBasePanel).Frame.DrawRight;
              FieldByName('Frame.Width').AsInteger:=(ThComp as TQRBasePanel).Frame.Width;
              FieldByName('Frame.Style').AsInteger:=ORD((ThComp as TQRBasePanel).Frame.Style);


             if (ThComp is TQuickRep) then begin
                FieldByname('Font.Charset').AsInteger:=ORD((ThComp as TQuickRep).Font.Charset);
                FieldByname('Font.Color').AsInteger:=ORD((ThComp as TQuickRep).Font.Color);
                FieldByname('Font.Height').AsInteger:=(ThComp as TQuickRep).Font.Height;
                FieldByname('Font.Name').AsString:=(ThComp as TQuickRep).Font.Name;
                FieldByname('Font.Pitch').AsInteger:=ORD((ThComp as TQuickRep).Font.Pitch);
                FieldByname('Font.Size').AsInteger:=(ThComp as TQuickRep).Font.Size;
                FieldByname('Font.Style.IsBold').AsBoolean:=fsBold in (ThComp as TQuickRep).Font.Style;
                FieldByname('Font.Style.IsItalic').AsBoolean:=fsItalic in (ThComp as TQuickRep).Font.Style;
                FieldByname('Font.Style.IsUnderline').AsBoolean:=fsUnderLine in (ThComp as TQuickRep).Font.Style;
                FieldByname('Font.Style.IsStrikeOut').AsBoolean:=fsStrikeOut in (ThComp as TQuickRep).Font.Style;
             end
             else if (ThComp is TQRCustomBand) then begin
               FieldByname('Font.Charset').AsInteger:=ORD((ThComp as TQRCustomBand).Font.Charset);
               FieldByname('Font.Color').AsInteger:=ORD((ThComp as TQRCustomBand).Font.Color);
               FieldByname('Font.Height').AsInteger:=(ThComp as TQRCustomBand).Font.Height;
               FieldByname('Font.Name').AsString:=(ThComp as TQRCustomBand).Font.Name;
               FieldByname('Font.Pitch').AsInteger:=ORD((ThComp as TQRCustomBand).Font.Pitch);
               FieldByname('Font.Size').AsInteger:=(ThComp as TQRCustomBand).Font.Size;
               FieldByname('Font.Style.IsBold').AsBoolean:=fsBold in (ThComp as TQRCustomBand).Font.Style;
               FieldByname('Font.Style.IsItalic').AsBoolean:=fsItalic in (ThComp as TQRCustomBand).Font.Style;
               FieldByname('Font.Style.IsUnderline').AsBoolean:=fsUnderLine in (ThComp as TQRCustomBand).Font.Style;
               FieldByname('Font.Style.IsStrikeOut').AsBoolean:=fsStrikeOut in (ThComp as TQRCustomBand).Font.Style;

               FieldByname('Alignment').AsInteger:=ORD((ThComp as TQRCustomBand).Aligntobottom);

               FieldByname('Color').AsInteger:=(ThComp as TQRCustomBand).Color;

               Values['FORCENEWCOLUMN']:=setBool((ThComp as TQRCustomBand).ForceNewColumn);
               Values['FORCENEWPAGE']:=setBool((ThComp as TQRCustomBand).ForceNewPage);
               Values['BANDTYPE']:=SetInt(ord((ThComp as TQRCustomBand).BandType));
             end;
           end;

           TaRepValue.Value:=Text;
           Post;
         end
       end; // for



    finally
      free
    end;
  finally
    if TaReport.State in [dsEdit,dsInsert] then TaReport.Post;
    TaReport.flushBuffers;
  end;
end;

function DeleteAllIndexes:boolean;
var i,IC:integer;
begin
  Result:=true;
  try
     IniCheck;
     if TableExists(TaReport) then begin
        tareport.Active:=false;
        tarEport.Exclusive:=true;
        tareport.Active:=true;
        tareport.indexDefs.update;
        ic:=tareport.IndexDefs.Count;
        for i:=IC-1 downto 0 do begin
           tarEport.IndexDefs.Update;
           taReport.DeleteIndex(TaReport.IndexDefs[i].Name);
        end;

        tareport.Active:=false;
        tarEport.Exclusive:=false;
     end;
  except
    Result:=false;
    raise;
  end
end;

{
function IniCheckStructure:boolean;
var i:integer;
begin
  Result:=true;
  try
    if not Assigned(taReport) then Result:=IniCheck;
    taReport.Active:=false;
    Tareport.Exclusive:=true;

    taReport.IndexDefs.Update;
    if (taReport.IndexDefs.count<1) or
       not ((ixPrimary in TaReport.IndexDefs[0].Options) and (ixUnique in TaReport.IndexDefs[0].Options ))
    then begin
      taReport.AddIndex( 'IDPRIMARY','NAMEFORM;NAMECOMPONENT',[ixPrimary,ixUnique]);
    end;

    taReport.Active:=false;
    tarEport.Exclusive:=false;
    taReport.Active:=true;

  except
    Result:=false;
    raise
  end
end;
}

function IniCheck:boolean;
var ThDir:string;

begin
  Result:=true;
  try
    if not Assigned(IniFile) then IniFile:=TRegIniFile.Create('Software\BV\'+StringReplace(Application.ExeName,'\','/',[rfReplaceAll]));

    if RepoEditPath='' then ThDir:=ExtractFilePath(Application.ExeName)
    else ThDir:=RepoEditPath;

    if not assigned(TaReport) then begin
        TaReport:=TTable.Create(nil);

  //      RegisterPreviewClass(TbvPreviewInterface);

        with TaReport do begin

          TableName:=ThDir+defaultFilename;

          if not fileExists(TableName) then begin
             with FieldDefs do begin
                Clear;
                Add('NameForm',ftString, 30, true);
                Add('NameComponent',ftString, 70, false);
                Add('Enabled',ftBoolean, 0, false);
                Add('Color',ftInteger,0,false);
                Add('Left',ftInteger,0,false);
                Add('Width',ftInteger,0,false);
                Add('Top',ftInteger,0,false);
                Add('Height',ftInteger,0,false);
                Add('Alignment',ftInteger,0,false);
                Add('AutoSize',ftBoolean,0,false);
                Add('Stretch',ftBoolean,0,false);
                Add('Frame.Color',ftInteger,0,false);
                Add('Frame.DrawBottom',ftBoolean,0,false);
                Add('Frame.DrawLeft',ftBoolean,0,false);
                Add('Frame.DrawRight',ftBoolean,0,false);
                Add('Frame.DrawTop',ftBoolean,0,false);
                Add('Frame.Width',ftInteger,0,false);
                Add('Frame.Style',ftInteger,0,false);
                Add('Font.Charset',ftInteger,0,false);
                Add('Font.Color',ftInteger,0,false);
                Add('Font.Height',ftInteger,0,false);
                Add('Font.Name',ftString,30,false);
                Add('Font.Pitch',ftInteger,0,false);
                Add('Font.Size',ftInteger,0,false);
                Add('Font.Style.IsBold',ftBoolean,0,false);
                Add('Font.Style.IsItalic',ftBoolean,0,false);
                Add('Font.Style.IsUnderline',ftBoolean,0,false);
                Add('Font.Style.IsStrikeOut',ftBoolean,0,false);
                Add('Transparent',ftBoolean,0,false);
                Add('WordWrap',ftBoolean,0,false);
                Add('NotFrontBack',ftInteger,0,false); // 0-no changes./1-Front/2-Back
                add('Value',ftMemo,20,false);
             end;

             with IndexDefs do begin
                Clear;
                 Add('KeyField', 'NameForm;NameComponent', [ixPrimary,ixUnique]);
             end;
             CreateTable;
          end;
          Open;
  //        TaRepNameForm:=taReport.fieldByName('NAMEFORM') as tStringField;
  //        TaRepNameComp:=taReport.Fieldbyname('NameComponent') as TStringField;
  //        TaRepValue:=TaReport.FieldByname('Value') as TMemoField;

        end;

    end
//    else if not TaReport.Active then TaReport.Open;
    else begin
      if not TaReport.Active then TaReport.Open;
      taReport.IndexDefs.Update;
      if (taReport.IndexDefs.count<1) or
         not ((ixPrimary in TaReport.IndexDefs[0].Options) and (ixUnique in TaReport.IndexDefs[0].Options ))
      then begin
        taReport.Active:=false;
        Tareport.Exclusive:=true;
        taReport.AddIndex( 'IDPRIMARY','NAMEFORM;NAMECOMPONENT',[ixPrimary,ixUnique]);
        taReport.Active:=false;
        tarEport.Exclusive:=false;
        taReport.Active:=true;
      end;
    end;
  except
    Result:=false;
    raise
  end;
end;

procedure TRepoEdit.Edit;
//var //i:integer;
//    ThComp:TComponent;
//    ThEditlabel:TEditlabel;
//    CompC:integer;
begin
//  ThEditLabel:=nil;

  if not Assigned(ThPanel) then begin
    ThPanel:=TPanelForm.Create(Self);
    ThPanel.PanelTop.Parent:=ThForm;
    thPanel.panelTop.Align:=alTop;
    ThPanel.BtnParam.OnClick:=BtnParamClick;
    ThPanel.BtnSave.OnClick:=BtnSaveClick;
    ThPanel.BtnCancel.OnClick:=BtnCancelClick;
    ThPanel.BtnSeeAll.OnClick:=BtnSeeAllClick;
    ThPanel.BtnChangeName.OnClick:=BtnChangeNameClick;
    ThPanel.SetEnabledBV(Enabled);
    thPanel.OnClose:=thFormclose;
  end;

//  ThPopup:=nil;

  ThPopupmenu:=TPopupMenu.Create(Self.Owner);
  ThPopupmenu.Name:=REPORTPOPUPNAME;
//  (THPopupmenu as TPopupMenu).style:=msBtnRaised;
  ThPopupmenu.AutoPopup:=true;
  ThPopupmenu.OnPopup:=OnShowPopup;
  ThPopupmenu.Items.Add(TMenuItem.Create(ThPopupmenu));
  with ThPopupmenu.Items[enableditemnum] do begin
    Caption:='狸蜩忮

⌨️ 快捷键说明

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