takeiteasy 发表于 2011-3-29 09:24:21

问个简单的delphi问题[已解决]

小弟初学delphi对于很多基础不太懂
现在遇到一个问题
if xxoo=1 then label1.caption:='1000';
if xxoo=2 then label1.caption:='2000';
但是我想把他用进progress bar(Gauge)里面
Form1.Gauge1.MaxValue:=labe1;
就报错....

总不能让我
If xx00=1 Then Form1.GaugeExp.MaxValue:=1000;
If xx00=2 Then Form1.GaugeExp.MaxValue:=2000;
if xx00=3 then ............
吧.....

怎么个解决法啊......delphi的细节比VB多太多了

树上爬的猪 发表于 2011-3-29 09:24:34

Form1.Gauge1.MaxValue:=labe1;

改成
Form1.Gauge1.MaxValue:=Val(label1.caption)

yq_ryan 发表于 2011-3-29 09:25:03

strtoint(labe1.caption)      内容里可以是数字的字符串,也可以是带'$'符号的16进展字符串
inttostr数值转字符
inttohex(int,n)数字转16进展字符,n位取字符的长度
页: [1]
查看完整版本: 问个简单的delphi问题[已解决]