Delphi - How to calculate the border-width of a SpeedButton - delphi

How can I calculate the exact width of the border of a TSpeedButton?
Depending on the values of the Flat and Down properties it seems to have a different width and a text starts at a different pixel. (with Margin <> -1 and no glyph set)
Delphi 10.2.3

Related

Mirror the scale from the bottom axis to also appear in the top axis

I have a simple 0-100 range of values representing percent using HorizontalBar and the TChart (Embarcadero edition) appears on a ScrollBox in this FMX app because I don't like the panning behavior I've seen in this Delphi 10.3.3 app for Windows. But the use of the ScrollBox means that sometimes the Bottom Axis is not visible, so I would like to have its Scale repeated as the TopAxis Scale.
Just having the Visible box checked for the Scale of the TopAxis does not produce the desired result.
Currently, I have a crude work-around that uses a separate chart that only exposes its BottomAxis Scale, positioned as a TopAxis Scale in the TChart that shows the data.
Is there a way to specify having the same scale on the bottom and top of one TChart?
On the series set the general option "Horizontal Axis" to Top and Bottom and for "Vertical Axis" to Left and Right.

Calculate real TQRMemo Height on QuickReport

I have several memos with different font on QuickReport. Now I'd like to know the most bottom point for all (for set some shape below). How? If I calculate TextHeight for each and multiple by lines count (aMemo.ParentReport.TextHeight(aMemo.Font, 'W') * aMemo.Lines.Count), results are not correctly - QuickReport print lines like with strange height and position of my shape for some fonts are too high or too low.
Ok, I got it. TextHeight cannot be call from QuickReport, but from Printer.Canvas. Then divide it by Y-Resolution for printer, next divide by 254 and multiple by 96. Result will be round and this is real value of Height of text in TQRMemo. All values are not accessible before print from QuickReport. It's very "smart" to return not real values based on same properties like during printing by component (by TQuickRep.TextHeight method).

TeeChart change distance between axis title and axis DELPHI XE3

I have chart where at the bottom axis dates are shown. The date string I have splitted into two lines. In the first is the date and in the second is the time. My problem is now, that the labels and the axis title are overlapping -> see image:
I googled for a while but found no solution or option I can use to set the distance between the axis title and the axis. The property
TChart.MarginBottom only changes the margin between the plotting area and component border. I have tried different properties to set the title vertical position:
// chtData is of type TChart
chtData.BottomAxis.Title.VertTextAlign := TVertTextAlign.vtaBottom; // Did not change anything
chtData.BottomAxis.Title.Margins.Top := 20; // Did not change anything
Is there any property I do not see?
Thank in advance for your help!
It seems there is no automatic calculation of labels' height
Seattle TChart:
in Obj. Inspector: BottomAxis - Labels - LabelSize set value 32
in chart editor: Axis - BottomAxis - Labels - Style - Size
in code: Chart.BottomAxis.LabelsSize := 2 * UsualValue

How can I get a the default width of a specified font in Delphi?

I'm writing a DXF exporter/importer. The DXF MTEXT entity format supports width factor for a text block (how times it is wider than the default font width). The Windows LogFont record contains the lfWidth field (how many pixel will be the average font width if you select the logfont to create a hFont). How can I get the default width of the used font to calculate the scaling factor back and forth? Is there any WinAPI call?
OK. I have found It. The getTextMetrics fills up a TEXTMETRIC record. It has a tmAveCharWidth. The searched value.

TeeChart VCL chart scale issue

I have an issue using Delphi 2007 & TChart 7.0.10.0 or 7.0.11.0 or the latest evaluation 9.0.5.0 on the TChart scaling.
The problem arises as soon I enlarge the window after a certain width and KEEP the Form height!
This is the drawing using a smaller form size.
now if I enlarge to 1200 weight I get this ugly scaling:
If I export in the designer without the aspect ratio set and with 1200 weight you will se this:
How to get ride of this?
Hp
I see you've set top and bottom margins to Chart1 in your project (8 and 20 percent respectively). I guess this has the intention of giving more space (in height) for Chart2 when you resize the form making it bigger.
Chart1's Top and Height properties should be set according to fill this blank space in the Form's OnResize event.
Try this:
procedure TGSSkillgroupStatisticForm.FormResize(Sender: TObject);
begin
Chart1.Draw;
Chart2.Top:=Chart1.ChartRect.Bottom + 25;
Chart2.Height:=Chart1.Height-Chart1.ChartRect.Bottom-40;
end;
Steema Support Central
Keep in mind that I only scale in the x-axis. Your 3-D bar / construct will after a certain width, overlap the scaling numbers! Your given answer do not fix this issue at all. To see the real problem in a better way, I added on the form creation:
Chart2.BottomAxis.Maximum := 20;
Series2.AddBar(12, 'Hallo', clred);
Here the result:

Resources