locked
make Only Form text bold and and resized RRS feed

  • Question

  • Hello all,

    Is there a code in vb to make the form text (top title on the form) bolder and resized?

    It must be independent from the complete form, so it mus not effect the rest of the text in the same form only

    the title!

    If something is not clear , please let me know 

    Kind regards

    Ferry

    Monday, July 13, 2020 2:43 PM

Answers

  • Hi Ferry1975Db,

    Thanks for your feedback.

    >>but it is not easy, is it possible for you to clear little bit more(maybe with a example?).

    As a simple option available, please check following project.

    gTitleBar - Custom TitleBar for Borderless Forms (VB.NET)

    Copy 'gTitleBar' class to your project, then if necessary, modify the 'CloseThemeData' function as follows:

        <DllImport("UxTheme.dll")>
        Private Shared Function CloseThemeData(ByVal hTheme As IntPtr) As Integer
        End Function

    You can set the font of 'Title' as you want at the end of ‘OnPaint’ method:

            Dim drawFontBold As New Font("Arial", 12, FontStyle.Bold)
            e.Graphics.DrawString(_TitleText, drawFontBold, New SolidBrush(Color.DimGray), ImagePad + 11, 9)
            e.Graphics.DrawString(_TitleText, drawFontBold, New SolidBrush(ForeColor), ImagePad + 10, 8)

    Then build your project , and you can see 'gTitleBar' control in your toolbox:

    Finally, set your form's FormBorderStyle to 'None' and change the position of 'gTitleBar':

    Me.FormBorderStyle = FormBorderStyle.None

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Ferry1975Db Thursday, July 23, 2020 10:39 AM
    Tuesday, July 21, 2020 6:21 AM

All replies

  • Caption text can be customized with DWM Custom Window Frame Using DWM

    Test =>

    Monday, July 13, 2020 3:56 PM
  • Hi Ferry1975Db,

    Thank you for posting here.

    Based on my research, Windows Form is a managed wrapper for native windows UI elements, so the fonts and other styles of Form are ultimately controlled by the operating system theme.

    Here's a library that extends Windows Forms with ability to customize the windows's non-client area, and you can have a look:

    CustomerBorderForm

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 14, 2020 2:56 AM
  • Hi Ferry1975Db,

    How is the question going? If your question has been answered then please click the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 17, 2020 7:12 AM
  • HI Xingyu and Castorix,

    Thanks for you fast feedback.

    I have tried to hunt for an example with  Custom Window Frame Using  DWM  and CustomerBorderForm with a vb code, just for trying to understand you remedy

    but it is not easy, is it possible for you to clear little bit more(maybe with a example?).

    PS I have tested whatI could find but resulk was not good)

    thank you


    Monday, July 20, 2020 9:37 PM
  • Hi Ferry1975Db,

    Thanks for your feedback.

    >>but it is not easy, is it possible for you to clear little bit more(maybe with a example?).

    As a simple option available, please check following project.

    gTitleBar - Custom TitleBar for Borderless Forms (VB.NET)

    Copy 'gTitleBar' class to your project, then if necessary, modify the 'CloseThemeData' function as follows:

        <DllImport("UxTheme.dll")>
        Private Shared Function CloseThemeData(ByVal hTheme As IntPtr) As Integer
        End Function

    You can set the font of 'Title' as you want at the end of ‘OnPaint’ method:

            Dim drawFontBold As New Font("Arial", 12, FontStyle.Bold)
            e.Graphics.DrawString(_TitleText, drawFontBold, New SolidBrush(Color.DimGray), ImagePad + 11, 9)
            e.Graphics.DrawString(_TitleText, drawFontBold, New SolidBrush(ForeColor), ImagePad + 10, 8)

    Then build your project , and you can see 'gTitleBar' control in your toolbox:

    Finally, set your form's FormBorderStyle to 'None' and change the position of 'gTitleBar':

    Me.FormBorderStyle = FormBorderStyle.None

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Ferry1975Db Thursday, July 23, 2020 10:39 AM
    Tuesday, July 21, 2020 6:21 AM
  • Hello Xingyu,

    thanks! , Iam going to test this and let you know asap 

    Kind regards

    Ferry

    Tuesday, July 21, 2020 8:13 PM
  • Hi Ferry1975Db,

    Did this help? If you have any further questions, please feel free to let us know.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 23, 2020 6:40 AM
  • Hi Xingyu,

    Yes I managed to implementend in my project and it works!

    Many thanks for your feedback.

    Best regards

    Ferry den Boesterd

    Thursday, July 23, 2020 10:38 AM