Jump to content


Photo

vertical rotated text in column headers


  • Please log in to reply
9 replies to this topic

#1 Jon G

Jon G
  • Members
  • 13 posts

Posted 27 July 2010 - 01:07 AM

Is it possible to have vertical rotated text in a header or cell like Excel?

Attached File  7_26_2010_6_02_13_PM.png   5.71KB   1 downloads

Thanks!



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 27 July 2010 - 01:24 AM

Hello,

Set Orientation property of Column.Header to hoVertical

I hope that this is what you search for.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Jon G

Jon G
  • Members
  • 13 posts

Posted 28 August 2010 - 12:51 AM

Thank you very much! It worked perfectly.

-Jon G.

QUOTE (Boki (Berg) @ Jul 26 2010, 08:24 PM) <{POST_SNAPBACK}>
Hello,

Set Orientation property of Column.Header to hoVertical

I hope that this is what you search for.

Best regards



#4 Jon G

Jon G
  • Members
  • 13 posts

Posted 09 October 2010 - 06:07 PM

QUOTE (Boki (Berg) @ Jul 26 2010, 08:24 PM) <{POST_SNAPBACK}>
Set Orientation property of Column.Header to hoVertical


Multiline does not work correctly with Column.Header set to hoVertical.

Could you have a look at that?

- JonG

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 09 October 2010 - 06:17 PM

Hello,

This is unfortunately a issue of DrawText function in Windows API. I don't know why it won't work as expected sad.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#6 Jon G

Jon G
  • Members
  • 13 posts

Posted 12 October 2010 - 03:14 AM

QUOTE (Boki (Berg) @ Oct 9 2010, 01:17 PM) <{POST_SNAPBACK}>
Hello,

This is unfortunately a issue of DrawText function in Windows API. I don't know why it won't work as expected sad.gif

Best regards


If I fix it, can I get my changes included in your source? I don't want to have to update my source every time you update yours.

Best regards,
- JonG

#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 12 October 2010 - 01:36 PM

Hello JonG,

Sure, I will integrate it.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#8 Jon G

Jon G
  • Members
  • 13 posts

Posted 16 October 2010 - 01:40 AM

QUOTE (Boki (Berg) @ Oct 12 2010, 08:36 AM) <{POST_SNAPBACK}>
Hello JonG,

Sure, I will integrate it.

Best regards


This is only tested for TNxGrid.

In NxSharedCommon.pas:

CODE
procedure DrawVerticalText(Canvas: TCanvas; Rect: TRect; Text: string);
var
  LogRec: TLOGFONT;
  OldFont, NewFont: HFONT;
  Flags: Integer;
  i : Integer;
  SL : TStringlist;
  S : String;
  TH : Integer;
begin
  Flags := DT_NOPREFIX or DT_BOTTOM or DT_EXTERNALLEADING or DT_SINGLELINE;
  with Canvas do
  begin
    Brush.Style := bsClear;
    GetObject(Font.Handle, SizeOf(LogRec), @LogRec);
    LogRec.lfEscapement := 900;
    LogRec.lfOutPrecision := OUT_TT_ONLY_PRECIS;
    NewFont := CreateFontIndirect(LogRec);
    OldFont := SelectObject(Canvas.Handle, NewFont);
    if Pos(#13,Text) = 0 then
      DrawText(Canvas.Handle, PAnsiChar(Text), Length(Text), Rect, Flags)
    else
    begin
      // Windows.DrawText has a bug that can't handle multiple lines in non-horizontal orientation.
      // See http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx
      SL := TStringlist.Create;
      SL.Text := Text;
      TH := TextHeight(Text);
      For i := 0 to SL.Count - 1 do
      begin
        S := SL.Strings[i];
        DrawText(Canvas.Handle, PAnsiChar(S), Length(S), Rect, Flags);
        Inc(Rect.Left,TH);
      end;
      SL.Free;
    end;
    NewFont := SelectObject(Canvas.Handle,OldFont);
    DeleteObject(NewFont);
  end;
end;


#9 Jon G

Jon G
  • Members
  • 13 posts

Posted 02 December 2010 - 07:18 AM

QUOTE (Boki (Berg) @ Oct 12 2010, 07:36 AM) <{POST_SNAPBACK}>
Hello JonG,

Sure, I will integrate it.

Best regards


Hi Boki,

You have released another version of NextSuite.

Please please integrate my suggested changes (or your own version) to NXSharedCommon.pas so that I don't have to choose whether to keep up with the latest versions.

Thanks,
JonG



#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 04 December 2010 - 01:01 AM

Hello Jon,

Please sorry, I have add it.

I will upload it during tomorrow.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users