end
else
if StrToInt(TEdit(Sender).Text + Key) < FMin then
begin
Key := #0;
Exit;
end;
end;
procedure TUpDownEdit.SetMax(const Value: Integer);
begin
FMax := Value;
UpDown.Max := FMax;
if StrToIntDef(Edit.Text, 0) > FMax then
begin
UpDown.Position := FMax;
Edit.Text := IntToStr(FMax);
FPosition := UpDown.Position;
end;
end;
procedure TUpDownEdit.SetMin(const Value: Integer);
begin
FMin := Value;
UpDown.Min := FMin;
if StrToIntDef(Edit.Text, 0) < FMin then
begin
UpDown.Position := FMin;
Edit.Text := IntToStr(FMin);
FPosition := UpDown.Position;
if Assigned(FOnChange) then
FOnChange(Self);
end;
end;
procedure TUpDownEdit.SetPosition(const Value: Integer);
begin
if (Value >= FMin) or (Value <= FMax) then
begin
FPosition := Value;
UpDown.Position := FPosition;
Edit.Text := IntToStr(FPosition);
if Assigned(FOnChange) then
FOnChange(Self);
end;
end;
procedure TUpDownEdit.UpDownClick(Sender: TObject; Button: TUDBtnType);
begin
if Max = 0 then
begin
Max := 100;
UpDown.Max := Max;
end;
UpDown.Min := Min;
Edit.Text := IntToStr(UpDown.Position);
Edit.SetFocus;
Edit.SelectAll;
if Assigned(FOnChange) then
FOnChange(Self);
FPosition := UpDown.Position;
上一页 [1] [2] [3] [4] 下一页 [VB.NET程序]利用IE自带的Shlwapi.dll实现文本框的自动完成
|