Autor Beitrag
Darth Sitthiander
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 95



BeitragVerfasst: Do 23.03.06 19:26 
Hallo Leute

Ich hab wieder mal ein Problem, und zwar folgendes:
Wenn ich die position einer Trackbar in einer Edit anzeigen will, zeigt es mir keine Dezimalzahlen an. Ich habe Min auf 0 und Max auf 100. Ich teile das Ergebnis durch 10 damit ich es von 0.1 bis 10 ablesen kann. Doch es zeigt mir nur die ganzen Zahlen an. Hier mein Quelltext:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm7.TrackBar1Change(Sender: TObject);
begin
edit1.Text := floattostr(trackbar1.position div 10);
end;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm7.Button1Click(Sender: TObject);
begin
edit1.SetFocus;
BmpGBlur(bb.image1.picture.bitmap,strtofloat(form7.edit1.text));
bb.Image1.Refresh;
form7.close;
end;

Achja das ganze ist übrigens für einen Verwischeffekt an einer Image.
Wäre für eine Antwort dankbar.
starsurfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Do 23.03.06 20:18 
Probiers mal lieber so:
ausblenden Delphi-Quelltext
1:
floattostrf(trackbar1.position/10,fffixed,3,2);					


floatostrf(WERT,EINSTELLUNG,GENAUIGKEIT,ANGEZEIGE NACHKOMMASTELLEN)

"div" liefert nur ganze Zahlen... :wink:

_________________
GEIZ IST GEIL! - Ihr Sozialamt
Zyklame
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41
Erhaltene Danke: 1

Win 7 Professional
Delphi XE, Visual Studio 2010
BeitragVerfasst: Fr 24.03.06 07:40 
In deinem Fall reicht warscheinlich für die Umwandlung in einen String schon die einfache Variante:

ausblenden Delphi-Quelltext
1:
FloatToStr(trackbar1.position);					
Darth Sitthiander Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 95



BeitragVerfasst: Sa 25.03.06 11:24 
Vielen vielen Dank jetzt gehts.
@Zyklame so kommen aber nur die ganzen Zahlen dran, und das ergebnis wird nicht durch 10 dividiert.