Search code examples
c#winformsvisual-studio-2005c#-2.0

change ForeColor of Form


How do i change the ForColor of the form, have set the ForeColor to RED but the form still displays in Whte Text. How do i change this.
Am refering to Title Bar Text Color


Solution

  • The title bar is a "non client" area of the form. Non-client area of the form is managed by windows API, and not by .NET. It cannot be changed by setting any property on a form. To change the color of the Title bar text, you would need to do custom painting. Search Google for terms like: non-client area painting winforms. You would need to make calls to the Win32 API directly for this to work. You can get some ideas from here: Link and http://customerborderform.codeplex.com/wikipage?title=Painting%20NonClient%20Area&referringTitle=Home

    It was easier to do back in the day (that is, when there was no .NET), since we directly used the Win32 API. I did it, for fun. And, I have since learned that such things are ok for learning; IMO I strongly recommend that you don't "misuse" this by putting it in a "real" application. Windows has a certain look and feel, and that look and feel should be under the user's control, not the developer's.