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

📄 frxdctrl.pas

📁 报表源码 FastReport 3 is new generation of the report generators components. It consists of report engin
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    property Color;
    property EditMask:String read GetEditMask write SetEditMask;
    property MaxLength;
    property ReadOnly;
    property Text;
    property OnChange;
    property OnClick;
    property OnDblClick;
    property OnEnter;
    property OnExit;
    property OnKeyDown;
    property OnKeyPress;
    property OnKeyUp;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
  end;

  TfrxCheckListBoxControl = class(TfrxDialogControl)
  private
    FCheckListBox:TCheckListBox;
    function GetAllowGrayed:Boolean;
    function GetItems:TStrings;
    function GetSorted:Boolean;
    function GetChecked(Index:Integer):Boolean;
    function GetState(Index:Integer):TCheckBoxState;
    procedure SetAllowGrayed(const Value:Boolean);
    procedure SetItems(const Value:TStrings);
    procedure SetSorted(const Value:Boolean);
    procedure SetChecked(Index:Integer; const Value:Boolean);
    procedure SetState(Index:Integer; const Value:TCheckBoxState);
  public
    constructor Create(AOwner:TComponent); override;
    class function GetDescription:String; override;
    property CheckListBox:TCheckListBox read FCheckListBox;
    property Checked[Index:Integer]:Boolean read GetChecked write SetChecked;
    property State[Index:Integer]:TCheckBoxState read GetState write SetState;
  published
    property AllowGrayed:Boolean read GetAllowGrayed write SetAllowGrayed default False;
    property Color;
    property Items:TStrings read GetItems write SetItems;
    property Sorted:Boolean read GetSorted write SetSorted default False;
    property OnClick;
    property OnDblClick;
    property OnEnter;
    property OnExit;
    property OnKeyDown;
    property OnKeyPress;
    property OnKeyUp;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
  end;

implementation

uses frxDCtrlRTTI, frxUtils, frxDsgnIntf, frxRes;

type
  THackCustomEdit = class(TCustomEdit);

{ TfrxLabelControl }

constructor TfrxLabelControl.Create(AOwner:TComponent);
begin
  inherited;
  FLabel:= TLabel.Create(nil);
  InitControl(FLabel);
end;

class function TfrxLabelControl.GetDescription:String;
begin
  Result:= frxResources.Get('obLabel');
end;

procedure TfrxLabelControl.Draw(Canvas:TCanvas; ScaleX, ScaleY, OffsetX,
  OffsetY:Extended);
begin
  if FLabel.AutoSize then
  begin
    Width:= FLabel.Width;
    Height:= FLabel.Height;
  end
  else
  begin
    FLabel.Width:= Round(Width);
    FLabel.Height:= Round(Height);
  end;
  inherited;
end;

function TfrxLabelControl.GetAlignment:TAlignment;
begin
  Result:= FLabel.Alignment;
end;

function TfrxLabelControl.GetAutoSize:Boolean;
begin
  Result:= FLabel.AutoSize;
end;

function TfrxLabelControl.GetWordWrap:Boolean;
begin
  Result:= FLabel.WordWrap;
end;

procedure TfrxLabelControl.SetAlignment(const Value:TAlignment);
begin
  FLabel.Alignment:= Value;
end;

procedure TfrxLabelControl.SetAutoSize(const Value:Boolean);
begin
  FLabel.AutoSize:= Value;
end;

procedure TfrxLabelControl.SetWordWrap(const Value:Boolean);
begin
  FLabel.WordWrap:= Value;
end;

procedure TfrxLabelControl.BeforeStartReport;
begin
  if not FLabel.AutoSize then
  begin
    FLabel.Width:= Round(Width);
    FLabel.Height:= Round(Height);
  end;
end;

{ TfrxCustomEditControl }

constructor TfrxCustomEditControl.Create(AOwner:TComponent);
begin
  inherited;
  THackCustomEdit(FCustomEdit).OnChange:= DoOnChange;
  InitControl(FCustomEdit);
end;

function TfrxCustomEditControl.GetMaxLength:Integer;
begin
  Result:= THackCustomEdit(FCustomEdit).MaxLength;
end;

function TfrxCustomEditControl.GetPasswordChar:Char;
begin
  Result:= THackCustomEdit(FCustomEdit).PasswordChar;
end;

function TfrxCustomEditControl.GetReadOnly:Boolean;
begin
  Result:= THackCustomEdit(FCustomEdit).ReadOnly;
end;

function TfrxCustomEditControl.GetText:String;
begin
  Result:= THackCustomEdit(FCustomEdit).Text;
end;

procedure TfrxCustomEditControl.SetMaxLength(const Value:Integer);
begin
  THackCustomEdit(FCustomEdit).MaxLength:= Value;
end;

procedure TfrxCustomEditControl.SetPasswordChar(const Value:Char);
begin
  THackCustomEdit(FCustomEdit).PasswordChar:= Value;
end;

procedure TfrxCustomEditControl.SetReadOnly(const Value:Boolean);
begin
  THackCustomEdit(FCustomEdit).ReadOnly:= Value;
end;

procedure TfrxCustomEditControl.SetText(const Value:String);
begin
  THackCustomEdit(FCustomEdit).Text:= Value;
end;

procedure TfrxCustomEditControl.DoOnChange(Sender:TObject);
begin
  if Report<>nil then
    Report.DoNotifyEvent(Self, FOnChange);
end;

{ TfrxEditControl }

constructor TfrxEditControl.Create(AOwner:TComponent);
begin
  FEdit:= TEdit.Create(nil);
  FCustomEdit:= FEdit;
  inherited;

  Width:= 121;
  Height:= 21;
end;

class function TfrxEditControl.GetDescription:String;
begin
  Result:= frxResources.Get('obEdit');
end;

{ TfrxMemoControl }

constructor TfrxMemoControl.Create(AOwner:TComponent);
begin
  FMemo:= TMemo.Create(nil);
  FCustomEdit:= FMemo;
  inherited;

  Width:= 185;
  Height:= 89;
end;

class function TfrxMemoControl.GetDescription:String;
begin
  Result:= frxResources.Get('obMemoC');
end;

function TfrxMemoControl.GetLines:TStrings;
begin
  Result:= FMemo.Lines;
end;

function TfrxMemoControl.GetScrollStyle:TScrollStyle;
begin
  Result:= FMemo.ScrollBars;
end;

function TfrxMemoControl.GetWordWrap:Boolean;
begin
  Result:= FMemo.WordWrap;
end;

procedure TfrxMemoControl.SetLines(const Value:TStrings);
begin
  FMemo.Lines:= Value;
end;

procedure TfrxMemoControl.SetScrollStyle(const Value:TScrollStyle);
begin
  FMemo.ScrollBars:= Value;
end;

procedure TfrxMemoControl.SetWordWrap(const Value:Boolean);
begin
  FMemo.WordWrap:= Value;
end;

{ TfrxButtonControl }

constructor TfrxButtonControl.Create(AOwner:TComponent);
begin
  inherited;
  FButton:= TButton.Create(nil);
  InitControl(FButton);

  Width:= 75;
  Height:= 25;
end;

class function TfrxButtonControl.GetDescription:String;
begin
  Result:= frxResources.Get('obButton');
end;

function TfrxButtonControl.GetCancel:Boolean;
begin
  Result:= FButton.Cancel;
end;

function TfrxButtonControl.GetDefault:Boolean;
begin
  Result:= FButton.Default;
end;

function TfrxButtonControl.GetModalResult:TModalResult;
begin
  Result:= FButton.ModalResult;
end;

procedure TfrxButtonControl.SetCancel(const Value:Boolean);
begin
  FButton.Cancel:= Value;
end;

procedure TfrxButtonControl.SetDefault(const Value:Boolean);
begin
  FButton.Default:= Value;
end;

procedure TfrxButtonControl.SetModalResult(const Value:TModalResult);
begin
  FButton.ModalResult:= Value;
end;

{ TfrxCheckBoxControl }

constructor TfrxCheckBoxControl.Create(AOwner:TComponent);
begin
  inherited;
  FCheckBox:= TCheckBox.Create(nil);
  InitControl(FCheckBox);

  Width:= 97;
  Height:= 17;
  Alignment:= taRightJustify;
end;

class function TfrxCheckBoxControl.GetDescription:String;
begin
  Result:= frxResources.Get('obChBoxC');
end;

function TfrxCheckBoxControl.GetAlignment:TAlignment;
begin
  Result:= FCheckBox.Alignment;
end;

function TfrxCheckBoxControl.GetAllowGrayed:Boolean;
begin
  Result:= FCheckBox.AllowGrayed;
end;

function TfrxCheckBoxControl.GetChecked:Boolean;
begin
  Result:= FCheckBox.Checked;
end;

function TfrxCheckBoxControl.GetState:TCheckBoxState;
begin
  Result:= FCheckBox.State;
end;

procedure TfrxCheckBoxControl.SetAlignment(const Value:TAlignment);
begin
  FCheckBox.Alignment:= Value;
end;

procedure TfrxCheckBoxControl.SetAllowGrayed(const Value:Boolean);
begin
  FCheckBox.AllowGrayed:= Value;
end;

procedure TfrxCheckBoxControl.SetChecked(const Value:Boolean);
begin
  FCheckBox.Checked:= Value;
end;

procedure TfrxCheckBoxControl.SetState(const Value:TCheckBoxState);
begin
  FCheckBox.State:= Value;
end;

{$IFDEF Delphi7}
function TfrxCheckBoxControl.GetWordWrap:Boolean;
begin
  Result:= FCheckBox.WordWrap;
end;

procedure TfrxCheckBoxControl.SetWordWrap(const Value:Boolean);
begin
  FCheckBox.WordWrap:= Value;
end;
{$ENDIF}

{ TfrxRadioButtonControl }

constructor TfrxRadioButtonControl.Create(AOwner:TComponent);
begin
  inherited;
  FRadioButton:= TRadioButton.Create(nil);
  InitControl(FRadioButton);

  Width:= 113;
  Height:= 17;
  Alignment:= taRightJustify;
end;

class function TfrxRadioButtonControl.GetDescription:String;
begin
  Result:= frxResources.Get('obRButton');
end;

function TfrxRadioButtonControl.GetAlignment:TAlignment;
begin
  Result:= FRadioButton.Alignment;
end;

function TfrxRadioButtonControl.GetChecked:Boolean;
begin
  Result:= FRadioButton.Checked;
end;

procedure TfrxRadioButtonControl.SetAlignment(const Value:TAlignment);
begin
  FRadioButton.Alignment:= Value;
end;

procedure TfrxRadioButtonControl.SetChecked(const Value:Boolean);
begin
  FRadioButton.Checked:= Value;
end;

{$IFDEF Delphi7}
function TfrxRadioButtonControl.GetWordWrap:Boolean;
begin
  Result:= FRadioButton.WordWrap;
end;

procedure TfrxRadioButtonControl.SetWordWrap(const Value:Boolean);
begin
  FRadioButton.WordWrap:= Value;
end;
{$ENDIF}

{ TfrxListBoxControl }

constructor TfrxListBoxControl.Create(AOwner:TComponent);
begin
  inherited;
  FListBox:= TListBox.Create(nil);
  InitControl(FListBox);

  Width:= 121;
  Height:= 97;
end;

class function TfrxListBoxControl.GetDescription:String;
begin
  Result:= frxResources.Get('obLBox');
end;

function TfrxListBoxControl.GetItems:TStrings;
begin
  Result:= FListBox.Items;
end;

function TfrxListBoxControl.GetItemIndex:Integer;
begin
  Result:= FListBox.ItemIndex;
end;

procedure TfrxListBoxControl.SetItems(const Value:TStrings);
begin
  FListBox.Items:= Value;
end;

procedure TfrxListBoxControl.SetItemIndex(const Value:Integer);
begin
  FListBox.ItemIndex:= Value;
end;

{ TfrxComboBoxControl }

constructor TfrxComboBoxControl.Create(AOwner:TComponent);
begin
  inherited;
  FComboBox:= TComboBox.Create(nil);
  FComboBox.OnChange:= DoOnChange;
  InitControl(FComboBox);

  Width:= 145;
  Height:= 21;
end;

class function TfrxComboBoxControl.GetDescription:String;
begin
  Result:= frxResources.Get('obCBox');
end;

function TfrxComboBoxControl.GetItems:TStrings;
begin
  Result:= FComboBox.Items;
end;

function TfrxComboBoxControl.GetItemIndex:Integer;
begin
  Result:= FComboBox.ItemIndex;
end;

function TfrxComboBoxControl.GetStyle:TComboBoxStyle;
begin
  Result:= FComboBox.Style;
end;

function TfrxComboBoxControl.GetText:String;
begin
  Result:= FComboBox.Text;
end;

procedure TfrxComboBoxControl.SetItems(const Value:TStrings);
begin
  FComboBox.Items:= Value;
end;

procedure TfrxComboBoxControl.SetItemIndex(const Value:Integer);
begin
  FComboBox.ItemIndex:= Value;
end;

procedure TfrxComboBoxControl.SetStyle(const Value:TComboBoxStyle);
begin
  FComboBox.Style:= Value;
end;

procedure TfrxComboBoxControl.SetText(const Value:String);
begin
  FComboBox.Text:= Value;
end;

procedure TfrxComboBoxControl.DoOnChange(Sender:TObject);
begin
  if Report<>nil then
    Report.DoNotifyEvent(Self, FOnChange);
end;

{ TfrxDateEditControl }

constructor TfrxDateEditControl.Create(AOwner:TComponent);
begin

⌨️ 快捷键说明

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