Delphi內有沒有顯示百分比的感應控件?某字段的數據是0.2, 在編輯框內(類似TDBEdit)顯示20%.
如果是DevExpress數據感應控件能實現則更好!
如果是DevExpress數據感應控件能實現則更好!
解决方案 »
- ?? FastReport4.7 如何设置Rich文字的大小 ??
- 对ini读写问题,取得其余关键字值
- CodeSite 3.01 可以下载了
- delphi中怎样实现,我点击dbgrid的一行改变这行的颜色?
- 有没有厦门公司招人,我想到厦门工作,现在人在上海。
- 为什么在panel中不能响应image的onclick事件?
- 在delphi里怎么添加Real Producer ActiveX Control Library控件啊?
- 高手或者熟手请进:excel问题!和以前的贴子不同的! 急用!!!
- 还是关于WORD操作的问题!
- 哪位知道哪里有小波压缩的控件获算法?请告知.谢谢!
- 如何先关闭子窗体
- 寻Delphi程序反编译方面的技术教程
begin
if Pos('%', edit1.Text) = 0 then
Edit1.Text := Format('%.2f', [StrToFloatDef(edit1.text, 0)]);
end;
begin
end;
試下再說, 應該有問題的
各位大俠:
謝謝您們的回復!
寫代碼當然行的,我的問題是: Delphi內有沒有顯示百分比的感應控件?
var Text: string; DisplayText: Boolean);
begin
Text := CurrToStr(Sender.AsCurrency * 100) + ' %';
end;procedure TfrmInsSalesInvoice.OnFieldSetText(Sender: TField;
const Text: string);
var
S, F: string;
C: Currency;
begin
if Pos('%', Text) = 0 then
F := Trim(Text) + ' %'
else
F := Text; S := Trim(LeftStr(F, Pos('%', F) - 1));
if (S = '') or (not TryStrToCurr(S, C)) then
begin
ShowMessage('Invalid value ' + QuotedStr(F));
Abort;
end
else
begin
TryStrToCurr(S, C);
Sender.AsCurrency := RoundTo(C / 100, -2);
end;end;procedure TfrmInsSalesInvoice.BindPercentField(aField: TField);
begin
aField.OnGetText := Self.OnFieldGetText;
aField.OnSetText := Self.OnFieldSetText;
end;