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

📄 frxadowizard.pas

📁 这个是功能强大的报表软件
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    s := TStringStream.Create(Style);
    FStyleSheet.LoadFromStream(s);
    s.Free;
  end;
end;

destructor TfrxStdWizardForm.Destroy;
begin
  FStyleReport.Free;
  FLayoutReport.Free;
  FStyleSheet.Free;
  inherited;
end;

procedure TfrxStdWizardForm.FormCreate(Sender: TObject);
var
  bmp: TBitmap;
begin
  Caption := frxGet(5600);
  DataTab.Caption := frxGet(5601);
  FieldsTab.Caption := frxGet(5602);
  GroupsTab.Caption := frxGet(5603);
  LayoutTab.Caption := frxGet(5604);
  StyleTab.Caption := frxGet(5605);
  Step1L.Caption := frxGet(5606);
  Step2L.Caption := frxGet(5607);
  Step3L.Caption := frxGet(5608);
  Step4L.Caption := frxGet(5609);
  Step5L.Caption := frxGet(5610);
  AddFieldB.Caption := frxGet(5611);
  AddAllFieldsB.Caption := frxGet(5612);
  RemoveFieldB.Caption := frxGet(5613);
  RemoveAllFieldsB.Caption := frxGet(5614);
  AddGroupB.Caption := frxGet(5615);
  RemoveGroupB.Caption := frxGet(5616);
  SelectedFieldsL.Caption := frxGet(5617);
  AvailableFieldsL.Caption := frxGet(5618);
  AvailableFieldsL1.Caption := frxGet(5618);
  GroupsL.Caption := frxGet(5619);
  OrientationL.Caption := frxGet(5620);
  LayoutL.Caption := frxGet(5621);
  PortraitRB.Caption := frxGet(5622);
  LandscapeRB.Caption := frxGet(5623);
  TabularRB.Caption := frxGet(5624);
  ColumnarRB.Caption := frxGet(5625);
  FitWidthCB.Caption := frxGet(5626);
  BackB.Caption := frxGet(5627);
  NextB.Caption := frxGet(5628);
  FinishB.Caption := frxGet(5629);

  ConnectionL.Caption := frxGet(5632);
  TableL.Caption := frxGet(5633);
  orL.Caption := frxGet(5634);
  CreateQueryB.Caption := frxGet(5635);
  ConfigureConnB.Hint := frxGet(5636);

  bmp := TBitmap.Create;
  bmp.Width := 16;
  bmp.Height := 16;
  bmp.Canvas.Brush.Color := clOlive;
  bmp.Canvas.FillRect(Rect(0, 0, 16, 16));
  frxResources.MainButtonImages.Draw(bmp.Canvas, 0, 0, 69);
  ConfigureConnB.Glyph := bmp;
  bmp.Free;

  if UseRightToLeftAlignment then
    FlipChildren(True);
end;

procedure TfrxStdWizardForm.FormShow(Sender: TObject);
var
  Page: TfrxReportPage;
begin
  FDesigner.Lock;
  FReport.Clear;
  if FDotMatrix then
    Page := TfrxDMPPage.Create(FReport) else
    Page := TfrxReportPage.Create(FReport);
  Page.Name := 'Page1';
  Page.SetDefaults;
  FDesigner.ReloadReport;

  FillConnections;
  ConnectionCB.ItemIndex := 0;
  ConnectionCBClick(nil);

  FStyleSheet.GetList(StyleLB.Items);
  StyleLB.ItemIndex := 0;
  StyleLBClick(nil);

  TabularRBClick(nil);
  if FDotMatrix then
    StyleTab.Free;
end;

procedure TfrxStdWizardForm.FillConnections;
var
  ini: TRegistry;
begin
  ConnectionCB.Items.Clear;
  ini := TRegistry.Create;
  try
    ini.RootKey := HKEY_LOCAL_MACHINE;
    if ini.OpenKeyReadOnly(DEF_REG_CONNECTIONS, False) then
    begin
      ini.GetValueNames(ConnectionCB.Items);
      ini.CloseKey;
    end
    ini.RootKey := HKEY_CURRENT_USER;
    if ini.OpenKeyReadOnly(DEF_REG_CONNECTIONS, False) then
    begin
      ini.GetValueNames(ConnectionCB.Items);
      ini.CloseKey;
    end
    ini.RootKey := HKEY_CURRENT_USER;
  finally
    ini.Free;
  end;
end;

procedure TfrxStdWizardForm.FillFields;
begin
  FieldsLB.Clear;
  SelectedFieldsLB.Clear;
  UpdateAvailableFields;

  if FDataset <> nil then
    FDataset.GetFieldList(FieldsLB.Items);

  if FieldsLB.Items.Count <> 0 then
  begin
    FieldsLB.ItemIndex := 0;
    FieldsLB.Selected[0] := True;
  end;
end;

procedure TfrxStdWizardForm.FillTables;
begin
  frxADOGetTableNames(ADOComponents.DefaultDatabase, TablesLB.Items, False);
end;

procedure TfrxStdWizardForm.UpdateAvailableFields;
begin
  AvailableFieldsLB.Items := SelectedFieldsLB.Items;
  GroupsLB.Clear;
end;

procedure TfrxStdWizardForm.DrawSample(PaintBox: TPaintBox; Report: TfrxReport);
var
  i: Integer;
  c: TfrxComponent;
begin
  with PaintBox do
  begin
    Canvas.Pen.Color := clBlack;
    Canvas.Brush.Color := clWindow;
    Canvas.Rectangle(0, 0, Width, Height);

    for i := 0 to Report.AllObjects.Count - 1 do
    begin
      c := Report.AllObjects[i];
      if c is TfrxCustomMemoView then
        with TfrxCustomMemoView(c) do
          Draw(Canvas, 1, 1, 10, 10);
    end;
  end;
end;

procedure TfrxStdWizardForm.ConnectionCBClick(Sender: TObject);
begin
  FReport.ReportOptions.ConnectionName := ConnectionCB.Items[ConnectionCB.ItemIndex];
  FillTables;
end;

procedure TfrxStdWizardForm.ConfigureConnBClick(Sender: TObject);
begin
  with TfrxConnEditorForm.Create(nil) do
  begin
    Report := FReport;
    ShowModal;
    Free;
  end;

  FillConnections;
  ConnectionCB.ItemIndex := 0;
  ConnectionCBClick(nil);
end;

procedure TfrxStdWizardForm.TablesLBClick(Sender: TObject);
begin
  if FDataset <> nil then
    FDataset.Free;

  FDataset := TfrxADOTable.DesignCreate(FReport.Pages[0], 0);
  FDataset.CreateUniqueName;
  TfrxADOTable(FDataset).TableName := TablesLB.Items[TablesLB.ItemIndex];
  TfrxADOTable(FDataset).UserName := TfrxADOTable(FDataset).TableName;

  FillFields;
end;

procedure TfrxStdWizardForm.CreateQueryBClick(Sender: TObject);
var
  ed: TfrxComponentEditor;
begin
  if FDataset <> nil then
    FDataset.Free;

  FDataset := TfrxADOQuery.DesignCreate(FReport.Pages[0], 0);
  FDataset.CreateUniqueName;

  ed := frxComponentEditors.GetComponentEditor(FDataset, FDesigner, nil);
  try
    ed.Edit;
  finally
    ed.Free;
  end;

  FillFields;
end;

procedure TfrxStdWizardForm.AddFieldBClick(Sender: TObject);
var
  i, j: Integer;
begin
  if FieldsLB.ItemIndex = -1 then Exit;

  i := 0;
  j := -1;
  while i < FieldsLB.Items.Count do
    if FieldsLB.Selected[i] then
    begin
      if j = -1 then
        j := i;
      SelectedFieldsLB.Items.Add(FieldsLB.Items[i]);
      FieldsLB.Items.Delete(i);
    end
    else
      Inc(i);

  if j = FieldsLB.Items.Count then
    Dec(j);
  if j <> -1 then
  begin
    FieldsLB.ItemIndex := j;
    FieldsLB.Selected[j] := True;
  end;

  UpdateAvailableFields;
end;

procedure TfrxStdWizardForm.AddAllFieldsBClick(Sender: TObject);
begin
  if FieldsLB.Items.Count = 0 then Exit;
  FillFields;
  SelectedFieldsLB.Items := FieldsLB.Items;
  FieldsLB.Items.Clear;
  UpdateAvailableFields;
end;

procedure TfrxStdWizardForm.RemoveFieldBClick(Sender: TObject);
var
  i, j: Integer;
begin
  if SelectedFieldsLB.ItemIndex = -1 then Exit;

  i := 0;
  j := -1;
  while i < SelectedFieldsLB.Items.Count do
    if SelectedFieldsLB.Selected[i] then
    begin
      if j = -1 then
        j := i;
      FieldsLB.Items.Add(SelectedFieldsLB.Items[i]);
      SelectedFieldsLB.Items.Delete(i);
    end
    else
      Inc(i);

  if j = SelectedFieldsLB.Items.Count then
    Dec(j);
  if j <> -1 then
  begin
    SelectedFieldsLB.ItemIndex := j;
    SelectedFieldsLB.Selected[j] := True;
  end;

  UpdateAvailableFields;
end;

procedure TfrxStdWizardForm.RemoveAllFieldsBClick(Sender: TObject);
begin
  FillFields;
end;

procedure TfrxStdWizardForm.AddGroupBClick(Sender: TObject);
var
  i: Integer;
begin
  i := AvailableFieldsLB.ItemIndex;
  if i = -1 then Exit;
  GroupsLB.Items.Add(AvailableFieldsLB.Items[i]);
  AvailableFieldsLB.Items.Delete(i);
  AvailableFieldsLB.ItemIndex := i;
end;

procedure TfrxStdWizardForm.RemoveGroupBClick(Sender: TObject);
var
  i: Integer;
begin
  i := GroupsLB.ItemIndex;
  if i = -1 then Exit;
  AvailableFieldsLB.Items.Add(GroupsLB.Items[i]);
  GroupsLB.Items.Delete(i);
  GroupsLB.ItemIndex := i;
end;

procedure TfrxStdWizardForm.FieldUpBClick(Sender: TObject);
var
  i: Integer;
begin
  i := SelectedFieldsLB.ItemIndex;
  if i < 1 then Exit;
  SelectedFieldsLB.Items.Exchange(i, i - 1);
  UpdateAvailableFields;
end;

procedure TfrxStdWizardForm.FieldDownBClick(Sender: TObject);
var
  i: Integer;
begin
  i := SelectedFieldsLB.ItemIndex;
  if (i = -1) or (SelectedFieldsLB.Items.Count = 0) or
    (i = SelectedFieldsLB.Items.Count - 1) then Exit;
  SelectedFieldsLB.Items.Exchange(i, i + 1);
  SelectedFieldsLB.ItemIndex := i + 1;
  UpdateAvailableFields;
end;

procedure TfrxStdWizardForm.GroupUpBClick(Sender: TObject);
var
  i: Integer;
begin
  i := GroupsLB.ItemIndex;
  if i < 1 then Exit;
  GroupsLB.Items.Exchange(i, i - 1);
end;

procedure TfrxStdWizardForm.GroupDownBClick(Sender: TObject);
var
  i: Integer;
begin
  i := GroupsLB.ItemIndex;
  if (i = -1) or (i = GroupsLB.Items.Count - 1) then Exit;
  GroupsLB.Items.Exchange(i, i + 1);
  GroupsLB.ItemIndex := i + 1;
end;

procedure TfrxStdWizardForm.NextBClick(Sender: TObject);
begin
  Pages.SelectNextPage(True);
  PagesChange(nil);
end;

procedure TfrxStdWizardForm.BackBClick(Sender: TObject);
begin
  Pages.SelectNextPage(False);
  PagesChange(nil);
end;

procedure TfrxStdWizardForm.PagesChange(Sender: TObject);
begin

⌨️ 快捷键说明

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