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

📄 unit2.pas

📁 Prof DHTML Edit 2.0.3.7 for delphi
💻 PAS
字号:
unit Unit2;

interface

uses
  Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Controls, Classes;

type
  TFormTable = class(TForm)
    ButtonOK: TButton;
    ButtonCancel: TButton;
    GroupBoxTable: TGroupBox;
    GroupBoxCells: TGroupBox;
    LabelRows: TLabel;
    LabelCols: TLabel;
    LabelTableWidth: TLabel;
    EditRows: TEdit;
    EditCols: TEdit;
    EditTableWidth: TEdit;
    ColorDialog: TColorDialog;
    CheckBoxTableWidthPercent: TCheckBox;
    LabelCaption: TLabel;
    EditCaption: TEdit;
    RadioGroupAlignment: TRadioGroup;
    LabelCellSpacing: TLabel;
    EditCellSpacing: TEdit;
    LabelCellPadding: TLabel;
    EditCellPadding: TEdit;
    GroupBoxBorder: TGroupBox;
    LabelBorderWidth: TLabel;
    EditBorderWidth: TEdit;
    GroupBoxBackground: TGroupBox;
    LabelBgPicture: TLabel;
    EditBackground: TEdit;
    OpenDialogBackground: TOpenDialog;
    SpeedButtonBackground: TSpeedButton;
    RadioGroupCellAlignment: TRadioGroup;
    RadioGroupCellVAlignment: TRadioGroup;
    ButtonBorderColor: TButton;
    PanelBorderColor: TPanel;
    ButtonBgColor: TButton;
    PanelBgColor: TPanel;
    GroupBoxCellEffects: TGroupBox;
    ButtonCellBorderColor: TButton;
    PanelCellBorderColor: TPanel;
    ButtonCellBgColor: TButton;
    PanelCellBgColor: TPanel;
    LabelCellBackground: TLabel;
    EditCellBackground: TEdit;
    SpeedButtonCellBackground: TSpeedButton;
    LabelCellWidth: TLabel;
    EditCellWidth: TEdit;
    CheckBoxCellWidthPercent: TCheckBox;
    LabelCellHeight: TLabel;
    CheckBoxNoWrap: TCheckBox;
    EditCellHeight: TEdit;
    CheckBoxCellHeightPercent: TCheckBox;

    procedure FormCreate(Sender: TObject);
    procedure ButtonBorderColorClick(Sender: TObject);
    procedure ButtonBgColorClick(Sender: TObject);
    procedure SpeedButtonBackgroundClick(Sender: TObject);
    procedure ButtonCellBorderColorClick(Sender: TObject);
    procedure ButtonCellBgColorClick(Sender: TObject);
    procedure SpeedButtonCellBackgroundClick(Sender: TObject);
    procedure EditColsKeyPress(Sender: TObject; var Key: Char);
    procedure EditRowsKeyPress(Sender: TObject; var Key: Char);
    procedure EditTableWidthKeyPress(Sender: TObject; var Key: Char);
    procedure EditCellSpacingKeyPress(Sender: TObject; var Key: Char);
    procedure EditCellPaddingKeyPress(Sender: TObject; var Key: Char);
    procedure EditBorderWidthKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormTable: TFormTable;

implementation

uses
  ProfDHTMLEdit, Windows, SysUtils;

{$R *.DFM}


procedure TFormTable.FormCreate(Sender: TObject);
var
  Len: Integer;
  InitialDir, S: AnsiString;
  A: THTMLAlign;
  VA: THTMLVAlign;
begin
  InitialDir := '';
  Len := GetEnvironmentVariable('CommonProgramFiles', nil, 0);
  if Len > 0 then
  begin
    SetLength(InitialDir, Len - 1);
    GetEnvironmentVariable('CommonProgramFiles', PChar(InitialDir), Len)
  end;
  InitialDir := InitialDir + '\Microsoft Shared\Stationery';
  if DirectoryExists(InitialDir) then
    OpenDialogBackground.InitialDir := InitialDir
  else
    OpenDialogBackground.InitialDir := ExtractFilePath(Application.ExeName);
  for A := Low(THTMLAlign) to High(THTMLAlign) do
  begin
    S := HTMLAlignToStr(A);
    if S = '' then
      S := 'default';
    S[1] := UpCase(S[1]);
    RadioGroupAlignment.Items.Add(S);
    RadioGroupCellAlignment.Items.Add(S)
  end;
  RadioGroupAlignment.ItemIndex := 0;
  RadioGroupCellAlignment.ItemIndex := 0;
  for VA := Low(THTMLVAlign) to High(THTMLVAlign) do
  begin
    S := HTMLVAlignToStr(VA);
    if S = '' then
      S := 'default';
    S[1] := UpCase(S[1]);
    RadioGroupCellVAlignment.Items.Add(S)
  end;
  RadioGroupCellVAlignment.ItemIndex := 0
end;


procedure TFormTable.ButtonBorderColorClick(Sender: TObject);
begin
  ColorDialog.Color := PanelBorderColor.Color;
  if ColorDialog.Execute then
    PanelBorderColor.Color := ColorDialog.Color
end;

procedure TFormTable.ButtonBgColorClick(Sender: TObject);
begin
  ColorDialog.Color := PanelBgColor.Color;
  if ColorDialog.Execute then
    PanelBgColor.Color := ColorDialog.Color
end;

procedure TFormTable.SpeedButtonBackgroundClick(Sender: TObject);
begin
  if OpenDialogBackground.Execute then
    EditBackground.Text := OpenDialogBackground.FileName
end;

procedure TFormTable.ButtonCellBorderColorClick(Sender: TObject);
begin
  ColorDialog.Color := PanelCellBorderColor.Color;
  if ColorDialog.Execute then
    PanelCellBorderColor.Color := ColorDialog.Color
end;

procedure TFormTable.ButtonCellBgColorClick(Sender: TObject);
begin
  ColorDialog.Color := PanelCellBgColor.Color;
  if ColorDialog.Execute then
    PanelCellBgColor.Color := ColorDialog.Color
end;

procedure TFormTable.SpeedButtonCellBackgroundClick(Sender: TObject);
begin
  if OpenDialogBackground.Execute then
    EditCellBackground.Text := OpenDialogBackground.FileName
end;

procedure TFormTable.EditColsKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then
    Key := #0
end;

procedure TFormTable.EditRowsKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then
    Key := #0
end;

procedure TFormTable.EditTableWidthKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then
    Key := #0
end;

procedure TFormTable.EditCellSpacingKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then
    Key := #0
end;

procedure TFormTable.EditCellPaddingKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then
    Key := #0
end;

procedure TFormTable.EditBorderWidthKeyPress(Sender: TObject; var Key: Char);
begin
  if not (Key in ['0'..'9', #8]) then
    Key := #0
end;

end.

⌨️ 快捷键说明

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