Rrodd 0 Posted September 27, 2022 Hello, I have a problem with the component Gauge, looks like it draws the text twice, one white and another with the inverted color (this is the only I want to be drawn), looking bad. I am using a "Windows VCL Application - Delphi" under Delphi 10.4. I'd like to know what to do for this to work like expected, or another free gauge alternative and similar component. I have sent a snapshot of the problem. Thanks. gauge01.bmp Share this post Link to post
PeterBelow 238 Posted September 27, 2022 9 hours ago, Rrodd said: Hello, I have a problem with the component Gauge, looks like it draws the text twice, one white and another with the inverted color (this is the only I want to be drawn), looking bad. I am using a "Windows VCL Application - Delphi" under Delphi 10.4. I'd like to know what to do for this to work like expected, or another free gauge alternative and similar component. I have sent a snapshot of the problem. Thanks. gauge01.bmp TGauge is a really ancient sample component (from D1 days I think). Have you looked at TProgressbar as alternative? Share this post Link to post
Rrodd 0 Posted September 27, 2022 Hi, TProgressbar has a graphical animation and does not add a percent, and I don't know how to have this features with it, and remove the animation. Share this post Link to post
Brian Evans 105 Posted September 27, 2022 (edited) The Bonus KSVC components included with Delphi but not installed by default include some components that might help. Installable through GetIt. Going through a few it seems the Meter component from the KSVC components can come closest. The KSVC progress bar makes the text match the bar or background color depending on the progress which makes the yellow bar / white background combination a problem. Also here I don't see the messed up text for the ancient TGauge. Edited September 27, 2022 by Brian Evans Share this post Link to post
Pat Foley 51 Posted September 27, 2022 11 hours ago, Rrodd said: one white and another with the inverted color (this is the only I want to be drawn), looking bad. Overdraw the control. Here's two workarounds. The second uses the centering text of Panel.caption. procedure ComputeBarCenter(control: TControl; var x, y : Integer); begin with Control do begin x := Left + width div 2; y := Top + Height div 2; end; //self.Left := 10; end; procedure TForm9.Button1Click(Sender: TObject); var textX, textY: Integer; begin gauge1.ShowText := False; computeBarcenter(gauge1, textX, textY); self.Canvas.TextOut(textX-5,textY-3,'50%'); end; procedure PutlabelControlAroundGraphic(panel, graphic: TControl); begin with graphic do panel.SetBounds(Left-3, Top-3, Width+3, Height+3); end; procedure TForm9.Button2Click(Sender: TObject); begin Gauge2.ShowText := False; panel1.Caption := 'Working hard Boss'; PutLabelControlAroundGraphic(panel1, Gauge2); end; Share this post Link to post
PaPaNi 23 Posted September 27, 2022 maybe this can be helpful? https://stackoverflow.com/questions/26539403/position-of-label-caption-inside-progressbar Share this post Link to post