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

📄 rm_dialogctls.pas

📁 这是一个功能强大
💻 PAS
📖 第 1 页 / 共 5 页
字号:
begin
  FreeAndNil(FEdit);
  inherited Destroy;
end;

procedure TRMMaskEditControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  Text := RMReadString(aStream);
  ReadOnly := RMReadBoolean(aStream);
end;

procedure TRMMaskEditControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteString(aStream, Text);
  RMWriteBoolean(aStream, ReadOnly);
end;

function TRMMaskEditControl.GetEditMask: string;
begin
  Result := FEdit.EditMask;
end;

procedure TRMMaskEditControl.SetEditMask(Value: string);
begin
  FEdit.EditMask := Value;
end;

function TRMMaskEditControl.GetText: string;
begin
  Result := FEdit.Text;
end;

procedure TRMMaskEditControl.SetText(Value: string);
begin
  FEdit.Text := Value;
end;

function TRMMaskEditControl.GetReadOnly: Boolean;
begin
  Result := FEdit.ReadOnly;
end;

procedure TRMMaskEditControl.SetReadOnly(Value: Boolean);
begin
  FEdit.ReadOnly := Value;
end;

{-----------------------------------------------------------------------------}
{-----------------------------------------------------------------------------}
{ TRMMemoControl }

class procedure TRMMemoControl.DefaultSize(var aKx, aKy: Integer);
begin
  aKx := 185;
  aKy := 89;
end;

constructor TRMMemoControl.Create;
begin
  inherited Create;
  BaseName := 'Memo';

  FMemo := TMemo.Create(nil);
  FMemo.Parent := RMDialogForm;
  FMemo.Text := 'Memo';
  AssignControl(FMemo);
end;

destructor TRMMemoControl.Destroy;
begin
  FreeAndNil(FMemo);
  inherited Destroy;
end;

procedure TRMMemoControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  FMemo.Text := RMReadString(aStream);
  FMemo.ReadOnly := RMReadBoolean(aStream);
end;

procedure TRMMemoControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteString(aStream, FMemo.Text);
  RMWriteBoolean(aStream, FMemo.ReadOnly);
end;

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

procedure TRMMemoControl.SetLines(Value: TStrings);
begin
  FMemo.Lines.Assign(Value);
end;

function TRMMemoControl.GetReadOnly: Boolean;
begin
  Result := FMemo.ReadOnly;
end;

procedure TRMMemoControl.SetReadOnly(Value: Boolean);
begin
  FMemo.ReadOnly := Value;
end;

{-----------------------------------------------------------------------------}
{-----------------------------------------------------------------------------}
{ TRMButtonControl }

class procedure TRMButtonControl.DefaultSize(var aKx, aKy: Integer);
begin
  aKx := 75;
  aKy := 25;
end;

constructor TRMButtonControl.Create;
begin
  inherited Create;
  BaseName := 'Button';

  FButton := TButton.Create(nil);
  FButton.Parent := RMDialogForm;
  FButton.Caption := 'Button';
  AssignControl(FButton);
end;

destructor TRMButtonControl.Destroy;
begin
  FreeAndNil(FButton);
  inherited Destroy;
end;

procedure TRMButtonControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  Caption := RMReadString(aStream);
  ModalResult := RMReadWord(aStream);
  Cancel := RMReadBoolean(aStream);
  Default := RMReadBoolean(aStream);
end;

procedure TRMButtonControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteString(aStream, Caption);
  RMWriteWord(aStream, ModalResult);
  RMWriteBoolean(aStream, Cancel);
  RMWriteBoolean(aStream, Default);
end;

function TRMButtonControl.GetCaption: string;
begin
  Result := FButton.Caption;
end;

procedure TRMButtonControl.SetCaption(Value: string);
begin
  FButton.Caption := Value;
end;

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

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

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

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

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

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

{-----------------------------------------------------------------------------}
{-----------------------------------------------------------------------------}
{ TRMCheckBoxControl }

class procedure TRMCheckBoxControl.DefaultSize(var aKx, aKy: Integer);
begin
  aKx := 97;
  aKy := 17;
end;

constructor TRMCheckBoxControl.Create;
begin
  inherited Create;
  BaseName := 'CheckBox';

  FCheckBox := TCheckBox.Create(nil);
  FCheckBox.Parent := RMDialogForm;
  FCheckBox.Caption := 'CheckBox';
  AssignControl(FCheckBox);
end;

destructor TRMCheckBoxControl.Destroy;
begin
  FreeAndNil(FCheckBox);
  inherited Destroy;
end;

procedure TRMCheckBoxControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  Alignment := TAlignment(RMReadByte(aStream));
  Checked := RMReadBoolean(aStream);
  Caption := RMReadString(aStream);
end;

procedure TRMCheckBoxControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteByte(aStream, Byte(Alignment));
  RMWriteBoolean(aStream, Checked);
  RMWriteString(aStream, Caption);
end;

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

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

function TRMCheckBoxControl.GetCaption: string;
begin
  Result := FCheckBox.Caption;
end;

procedure TRMCheckBoxControl.SetCaption(Value: string);
begin
  FCheckBox.Caption := Value;
end;

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

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

{-----------------------------------------------------------------------------}
{-----------------------------------------------------------------------------}
{ TRMRadioButtonControl }

class procedure TRMRadioButtonControl.DefaultSize(var aKx, aKy: Integer);
begin
  aKx := 113;
  aKy := 17;
end;

constructor TRMRadioButtonControl.Create;
begin
  inherited Create;
  BaseName := 'RadioButton';

  FRadioButton := TRadioButton.Create(nil);
  FRadioButton.Parent := RMDialogForm;
  FRadioButton.Caption := 'RadioButton';
  AssignControl(FRadioButton);
end;

destructor TRMRadioButtonControl.Destroy;
begin
  FreeAndNil(FRadioButton);
  inherited Destroy;
end;

procedure TRMRadioButtonControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  Alignment := TAlignment(RMReadByte(aStream));
  Checked := RMReadBoolean(aStream);
  Caption := RMReadString(aStream);
end;

procedure TRMRadioButtonControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteByte(aStream, Byte(Alignment));
  RMWriteBoolean(aStream, Checked);
  RMWriteString(aStream, Caption);
end;

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

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

function TRMRadioButtonControl.GetCaption: string;
begin
  Result := FRadioButton.Caption;
end;

procedure TRMRadioButtonControl.SetCaption(Value: string);
begin
  FRadioButton.Caption := Value;
end;

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

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

{-----------------------------------------------------------------------------}
{-----------------------------------------------------------------------------}
{ TRMListBoxControl }

class procedure TRMListBoxControl.DefaultSize(var aKx, aKy: Integer);
begin
  aKx := 121;
  aKy := 97;
end;

constructor TRMListBoxControl.Create;
begin
  inherited Create;
  BaseName := 'ListBox';

  FListBox := TListBox.Create(nil);
  FListBox.Parent := RMDialogForm;
  AssignControl(FListBox);
end;

destructor TRMListBoxControl.Destroy;
begin
  FreeAndNil(FListBox);
  inherited Destroy;
end;

procedure TRMListBoxControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  RMReadMemo(aStream, Items);
  ItemIndex := RMReadInt32(aStream);
end;

procedure TRMListBoxControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteMemo(aStream, Items);
  RMWriteInt32(aStream, ItemIndex);
end;

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

procedure TRMListBoxControl.SetItems(Value: TStrings);
begin
  FListBox.Items.Assign(Value);
end;

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

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

{-----------------------------------------------------------------------------}
{-----------------------------------------------------------------------------}
{ TRMComboBoxControl }

class procedure TRMComboBoxControl.DefaultSize(var aKx, aKy: Integer);
begin
  aKx := 145;
  aKy := 21;
end;

constructor TRMComboBoxControl.Create;
begin
  inherited Create;
  BaseName := 'ComboBox';

  FComboBox := TComboBox.Create(nil);
  FComboBox.Parent := RMDialogForm;
  FComboBox.OnDrawItem := ComboBoxDrawItem;
  FComboBox.OnKeyDown := OnKeyDown;
  AssignControl(FComboBox);
end;

destructor TRMComboBoxControl.Destroy;
begin
  FreeAndNil(FComboBox);
  inherited Destroy;
end;

procedure TRMComboBoxControl.OnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  if Style = rmcsLookup then
  begin
    if (Key = VK_DELETE) or (Key = VK_BACK) then
      FComboBox.ItemIndex := -1;
  end;
end;

procedure TRMComboBoxControl.LoadFromStream(aStream: TStream);
begin
  inherited LoadFromStream(aStream);
  RMReadWord(aStream);
  RMReadMemo(aStream, Items);
  Style := TRMComboBoxStyle(RMReadByte(aStream));
  ItemIndex := RMReadInt32(aStream);
end;

procedure TRMComboBoxControl.SaveToStream(aStream: TStream);
begin
  inherited SaveToStream(aStream);
  RMWriteWord(aStream, 0);
  RMWriteMemo(aStream, Items);
  RMWriteByte(aStream, Byte(Style));
  RMWriteInt32(aStream, ItemIndex);
end;

procedure TRMComboBoxControl.ComboBoxDrawItem(Control: TWinControl;
  Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
  ComboBox: TComboBox;
  s: string;
begin

⌨️ 快捷键说明

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