We help IT Professionals succeed at work.

Displaying the caption of a Label component vertically

mrk_raj
mrk_raj asked
on
How will we display some text vertically in a Label control?
Comment
Watch Question

Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
download free rotate label from
http://www.torry.net/labelspacks.htm
Set the WordWrap property to True
and then try this example:

procedure TForm1.Button1Click(Sender: TObject);
begin
label1.caption:='';
label1.caption:='A B C D E F G H I J K';
end;

You must type a space between letters, thats all.

Bye.
You could either look at these:

http://www.torry.net/rotatedlabels.htm

or do somethg like this:

procedure TForm1.Button1Click(Sender: TObject);
var
  I : Integer;
  S1, S2 : string;
begin
  S2 := '';
  S1 := 'Hello World';
  for I := 1 to Length(S1)do
    S2 := S2 + S1[I] + #10 + #13;
  Label1.Caption := S2;
end;

or you could make your own peice of code to do this from the examples at http://www.torry.net/rotatedlabels.htm

Cheers,

Alan

Commented:
procedure TMainForm.PaintBox1Paint(Sender: TObject);
var
  lf: LOGFONT; // Windows native font structure
begin
  Canvas.Brush.Style := bsClear; // set the brush style to transparent
  FillChar(lf, SizeOf(lf), Byte(0));
  lf.lfHeight := 20;
  lf.lfEscapement := 10 * 90; // degrees to rotate
  lf.lfOrientation := 10 * 90;
  lf.lfCharSet := DEFAULT_CHARSET;
  StrCopy(lf.lfFaceName, 'Tahoma');

  PaintBox1.Canvas.Font.Handle := CreateFontIndirect(lf);
  PaintBox1.Canvas.TextOut(10, 100, 'Rotated text'); // output the rotated font
end;