109 lines
2.2 KiB
ObjectPascal
109 lines
2.2 KiB
ObjectPascal
unit U_PatternColorHelp;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, ExtCtrls, DB, ADODB, StrUtils;
|
|
|
|
type
|
|
TfrmPatternColorHelp = class(TForm)
|
|
Panel1: TPanel;
|
|
Button1: TButton;
|
|
Label1: TLabel;
|
|
Button2: TButton;
|
|
QSHX: TEdit;
|
|
JSHX: TEdit;
|
|
Label2: TLabel;
|
|
YSSL: TEdit;
|
|
Label3: TLabel;
|
|
Label4: TLabel;
|
|
ps: TEdit;
|
|
sl: TEdit;
|
|
Label5: TLabel;
|
|
GS: TEdit;
|
|
GL: TEdit;
|
|
Label7: TLabel;
|
|
Label6: TLabel;
|
|
procedure Button2Click(Sender: TObject);
|
|
procedure Button1Click(Sender: TObject);
|
|
procedure QSHXKeyPress(Sender: TObject; var Key: Char);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
FFFIDS: string;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frmPatternColorHelp: TfrmPatternColorHelp;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TfrmPatternColorHelp.Button2Click(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TfrmPatternColorHelp.QSHXKeyPress(Sender: TObject; var Key: Char);
|
|
var
|
|
edt: TEdit;
|
|
str, strL, strR: string;
|
|
p: integer;
|
|
begin
|
|
// 获取当前文本内容, 注意要去掉选中部分(因为会被改写).
|
|
edt := TEdit(Sender);
|
|
str := edt.text;
|
|
if Length(edt.SelText) <> 0 then
|
|
begin
|
|
strL := LeftStr(edt.text, edt.SelStart);
|
|
strR := RightStr(edt.text, Length(edt.text) - edt.SelStart - edt.SelLength);
|
|
str := strL + strR;
|
|
end;
|
|
// 限制输入数字/小数点/退格键
|
|
if not (Key in [#8, #13, #127, '.', '-', '0'..'9']) then
|
|
Key := #0;
|
|
//限制只能输入一个小数点
|
|
if Key = '.' then
|
|
begin
|
|
p := Pos('.', edt.Text);
|
|
if p > 0 then
|
|
Key := #0;
|
|
end;
|
|
//限制只能在第一位输入且只能输入一个'-'号
|
|
if Key = '-' then
|
|
begin
|
|
if edt.SelStart > 0 then
|
|
Key := #0;
|
|
p := Pos('-', edt.Text);
|
|
if p > 0 then
|
|
Key := #0;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TfrmPatternColorHelp.Button1Click(Sender: TObject);
|
|
begin
|
|
// if Trim(QSHX.Text) = '' then
|
|
// begin
|
|
// Application.MessageBox('起始花型不能为空!', '提示', 0);
|
|
// Exit;
|
|
// end;
|
|
// if Trim(JSHX.Text) = '' then
|
|
// begin
|
|
// Application.MessageBox('结束花型不能为空!', '提示', 0);
|
|
// Exit;
|
|
// end;
|
|
// if Trim(YSSL.Text) = '' then
|
|
// begin
|
|
// Application.MessageBox('颜色数量不能为空!', '提示', 0);
|
|
// Exit;
|
|
// end;
|
|
ModalResult := 1;
|
|
end;
|
|
|
|
end.
|
|
|