showmessage(inttostr(StrToInt( '$' + '0D')));
应该没问题
应该没问题
解决方案 »
- 动态自定义纸张大小的问题,请高手支持
- !在线等待!,如何使某窗体从主Form中独立出来,即能使该窗体在windows的任务栏里出现,就像是另开了一个程序一样
- 如何查询access里带有空格的字段
- 查找字符串中某字的函数?
- 如果class1需要class2,class2需要class1怎么办?求delphi5上的可做方案!
- 如何动态调整显示器的分辨率
- 奇怪问题?怎么把Dbase数据库整合到delphi的安装程序中?
- 一奇怪的问题,请大家帮我诊断一下。谢谢!!
- 关于窗口隐藏
- 关于in64的数据组合分解
- 怎样在程序关闭自己打开的其他EXE文件?
- 求助,在 WIN2000 中,我无法启动 MS DTC,并且 Win2000 的组件服务启动也出错,
//pas
unit DigitUnit;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Spin;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Button2: TButton;
SpinEdit1: TSpinEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}function Power(Base, Exponent: Integer): Integer;
var
I: Integer;
begin
Result := 1;
for I := 1 to Exponent do
Result := Result * Base;
end; { Power }const
cScaleChar = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';function DigitToInt(mScale: Byte; mDigit: string): Integer;
var
I, L: Integer;
begin
Result := 0;
L := Length(mDigit);
for I := L downto 1 do
Result := Result + Pred(Pos(mDigit[I], cScaleChar)) * Power(mScale, L - I);
end; { DigitToInt }function IntToDigit(mScale: Byte; mInt: Integer): string;
var
I, J: Integer;
begin
Result := '';
I := mInt;
while (I >= mScale) do begin
J := I mod mScale;
Result := Copy(cScaleChar, Succ(J), 1) + Result;
I := I div mScale;
end;
Result := Copy(cScaleChar, Succ(I), 1) + Result;
end; { IntToDigit }procedure TForm1.Button1Click(Sender: TObject);
begin
Edit2.Text := IntToStr(DigitToInt(SpinEdit1.Value, Edit1.Text));
end;procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Text := IntToDigit(SpinEdit1.Value, StrToIntDef(Edit2.Text, 0));
end;end.//dfm
object Form1: TForm1
Left = 192
Top = 107
Width = 409
Height = 97
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 184
Top = 32
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Edit1: TEdit
Left = 136
Top = 8
Width = 121
Height = 21
TabOrder = 1
Text = 'Edit1'
end
object Edit2: TEdit
Left = 272
Top = 8
Width = 121
Height = 21
TabOrder = 2
Text = 'Edit2'
end
object Button2: TButton
Left = 272
Top = 32
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 3
OnClick = Button2Click
end
object SpinEdit1: TSpinEdit
Left = 8
Top = 8
Width = 121
Height = 22
MaxValue = 255
MinValue = 2
TabOrder = 4
Value = 0
end
end