Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

I want to write a sideways text

 Post Reply Post Reply
Author
Yokoe Hideo View Drop Down
New Member
New Member
Avatar

Joined: 29 Oct 2015
Posts: 19
Post Options Post Options   Quote Yokoe Hideo Quote  Post ReplyReply Direct Link To This Post Topic: I want to write a sideways text
    Posted: 29 Oct 2015 at 7:40am
Hello,

I tried to find answer on your demo, but I failed. 
Could you tip me, how to rotate annotation ?
or how to write a sideways character

best regards
# Windows7(64) / Delphi10 




Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3392
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 2015 at 8:47am
Hi, 

You can achieve this with the following code (please note that the drawing is based on pointindex 4 in this sample and the text is drawn from the top of the chart to the bottom:

procedure TForm112.AdvGDIPChartView1AfterDrawSeries(Sender: TObject;
  ARect: TRect; ACanvas: TCanvas; APaneIndex: Integer);
var
  r: TRect;
  s: TChartSerie;
  xm, ym: Integer;
  tf: TFont;
  lf: TLogFont;
  str: string;
  tw, th: integer;
  pt: Integer;
begin
  tf := TFont.Create;
  tf.Size := 18;
  tf.Color := clRed;
  GetObject(tf.Handle, SizeOf(lf), @lf);
  lf.lfEscapement := 900;
  lf.lfOrientation := 900;

  tf.Handle := CreateFontIndirect(lf);
  ACanvas.Font.Assign(tf);
  tf.Free;

  s := AdvGDIPChartView1.Panes[0].Series[0];
  r := AdvGDIPChartView1.Panes[0].Series.SeriesRectangle;

  str := 'Hello World !';
  tw := ACanvas.TextWidth(str);
  th := ACanvas.TextHeight(str);

  pt := 4;

  xm := s.GetDrawPoint(pt).X - th div 2;
  ym := r.Top + tw;

  ACanvas.Brush.Style := bsClear;
  ACanvas.TextOut(xm, ym, str);
end;

Kind Regards, 
Pieter
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down