locked
alignment of caption text to right RRS feed

  • Question

  • Hi,

    I am facing one issue regarding TitleBar text alignment  in c# using  Compact framework.

    If somebody could give any ideas, it will be helpful.

     

    How to left align some text and right align some text in titlebar in Windows compact framework?

     

    Is there any C# class available for this.

    For this I need to calculate the title bar font metrics and title bar width. So that based on some calculation I can left-align as well as right-align some text.

     

    Following things I have tried but they are not applicable for compact framework-

     

    -          I have found following Win32 api

     

                    SystemParametersInfo (

                                    UINT uiAction,

                                    UINT uiParam,

                                    PVOID pvParam,

                                    UINT fWinIni);

     

    For  caption text the first parameter can be passed as SPI_GETNONCLIENTMETRICS (It Retrieves the metrics associated with the non-client area of non-minimized windows)but this macro is limited for Windows desktop not for compact framework.

     

    -          I have also checked WM_NCPAINT message this is not applicable for Wince environment.

     

    -          I have checked SystemFonts.CaptionFontSize Property but again it is limited to Windows desktop.

     

    So how can aligning of text can be achieved.

     

    thanks,

    Chetna

    Tuesday, June 17, 2014 3:11 PM

Answers

  • Hi,

    You can hide default title bar and can place your own control as title bar.

    Hide title bar


    -Malleswar

    • Proposed as answer by Jamles Hez Wednesday, June 18, 2014 3:25 AM
    • Marked as answer by Jamles Hez Tuesday, June 24, 2014 7:38 AM
    Tuesday, June 17, 2014 6:12 PM