![]() |
Beschriftung mit maßeinheit in TGauge
hab einen Gauge der die Empfangsstärke eines Handys in db anzeigt das macht er so
Delphi-Quellcode:
und
Listview1.Items.Add.Caption := 'Empfangsqualität';
r := Listview1.Items[11].DisplayRect(drBounds); r.Left := r.Left + Listview1.columns[0].Width; r.Right := r.Left + Listview1.columns[1].Width; pb2 := TGauge.Create(Self); pb2.Parent := Listview1; pb2.BoundsRect := r; pb2.MinValue :=-113; pb2.MaxValue :=-49; pb2.Progress := StrtoInt(ReadNet); case pb2.Progress of -113..-85 : pb2.ForeColor:= clRed; -84..-63 : pb2.ForeColor:= clFuchsia; -62..-49 : pb2.ForeColor:= clGreen; end; Listview1.Items[11].Data := pb2; Application.ProcessMessages; Progressbar1.Position:=84;
Delphi-Quellcode:
er soll dann aber nicht z.B. 50% anzeigen sondern -85 db geht das wenn ja wie oder brauch ich eine fremdkomponente
function ReadNet:String;
var c:Integer; begin Form1.Memo1.Lines.clear; s:= 'AT+CSQ'; Form1.SendCMD; Form1.Memo1.Lines.Add(sReadData);//ist nicht optimal ich weiß ändere ich mit mehr Wissen mal ab result:=Form1.memo1.Lines[1]; delete (result,1,6); delete(result,length(result)-2,5); case StrtoInt(result) of 0 : c := -113; 1 : c := -111; 2 : c := -109; 3 : c := -107; 4 : c := -105; 5 : c := -103; 6 : c := -101; 7 : c := -99; 8 : c := -97; 9 : c := -95; 10 : c := -93; 11 : c := -91; 12 : c := -89; 13 : c := -87; 14 : c := -85; 15 : c := -83; 16 : c := -81; 17 : c := -79; 18 : c := -77; 19 : c := -75; 20 : c := -73; 21 : c := -71; 22 : c := -69; 23 : c := -67; 24 : c := -65; 25 : c := -63; 26 : c := -61; 27 : c := -59; 28 : c := -57; 29 : c := -55; 30 : c := -53; 31 : c := -51; 99 : c := -49; //unknown end; Result:=InttoStr(c); end; |
Re: Beschriftung mit maßeinheit in TGauge
Liste der Anhänge anzeigen (Anzahl: 1)
Ok Hab selbst was Gefunden (nach Progressbar Umgestellt)
Delphi-Quellcode:
Listview1.Items.Add.Caption := 'Empfangsqualität';
r := Listview1.Items[11].DisplayRect(drBounds); r.Left := r.Left + Listview1.columns[0].Width; r.Right := r.Left + Listview1.columns[1].Width; pb2 := TProgressBar.Create(Self); pb2.Parent := Listview1; pb2.BoundsRect := r; pb2.Min :=-113; pb2.Max :=-49; pb2.Smooth :=true; pb2.Position := StrtoInt(ReadNet); Listview1.Items[11].Data := pb2; lbl2:= TLabel.Create(Self); with lbl2 do begin lbl2.Caption:=ReadNet+' db'; Parent := Listview1.Items[11].Data; Transparent := True; Alignment := taCenter; Layout := tlCenter; Align := alClient; Font.Style := [fsBold]; case pb2.Position of -113..-85 : Font.Color:= clRed; -84..-63 : Font.Color:= clFuchsia; -62..-49 : Font.Color:= clGreen; end; end; Application.ProcessMessages; Progressbar1.Position:=84; |
DP-Maintenance
Dieses Thema wurde von "Matze" von "Programmieren allgemein" nach "VCL / WinForms / Controls" verschoben.
Es geht um Delphi. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:36 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz