Code: Select all
With ChartEB do
begin
Canvas.Font.Assign(FontDialog1.Font); // Take this out, text appears, otherwise not
// Vacuum Level (Evac)
with Canvas.Pen do
begin
Color := clBlack;
Style := psSolid;
Width := 2;
end;
Canvas.MoveTo(ChartRect.Left, LeftAxis.CalcPosValue(0));
Canvas.LineTo(ChartRect.Right, LeftAxis.CalcPosValue(0));
Canvas.Pen.Width := 1;
//ShowMessage('Evac: ' + IntToStr(StrToPxWidth('Evac', Canvas.Font.Size)));
Canvas.TextOut(
ChartRect.Right - StrToPxWidth('Evac', Canvas.Font.Size),
LeftAxis.CalcPosValue(0) - (2 * Canvas.Font.Size),
'Evac'
);
// Ef (Tip WF + CPD)
Canvas.Pen.Color := clGreen; Canvas.Font.Color := clGreen;
//Canvas.Pen.Handle := ExtCreatePen();
Canvas.Pen.Style := psDash;
Canvas.MoveTo(ChartRect.Left, LeftAxis.CalcPosValue(eF));
Canvas.LineTo(ChartRect.Right, LeftAxis.CalcPosValue(eF));
//ShowMessage('Ef: ' + IntToStr(StrToPxWidth('Ef', Canvas.Font.Size)));
Canvas.TextOut(
ChartRect.Right - StrToPxWidth(ShiftLabel('Ef', 1), Canvas.Font.Size),
LeftAxis.CalcPosValue(eF) - (2 * Canvas.Font.Size),
'Ef'
);
Canvas.Pen.Style := psSolid;
The second label appears regardless of whether the canvas font is set but the first does not appear unless I comment out the assignment - I don't understand this. Could you please tell me what the problem is and how I can get round it?