?
Solved

Form Border Color

Posted on 2014-12-19
11
Medium Priority
?
3,890 Views
Last Modified: 2015-01-07
Hi All,

I am developing a desktop application using C# windows application. I want to change the form border color with title change.

How can i achieve this?

Thanks in advance
0
Comment
Question by:Jatin Nahar
  • 4
  • 4
  • 3
11 Comments
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 1500 total points
ID: 40510483
As shown in the attache image, Text property controls form caption.
On the form border experiment with different FormBorderStyle to see if any of them suits your need.
If you want have a red border, for example, you can use none for FormBorderStyle and then it will show no border but you can add a panel to it with silver background covering the form with red background showing only tiny bit like a border.FormTitleFormTitle2Now, you can add a label on to the panel to display title you want. There maybe a better ways to do this. But this is what I could think of.

Also, we can draw line via code which will be much cleaner and professional. We could do that as well.
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40510984
This code draws a green line on the form border (with FormBorderStyle = none):
       private void Form1_Paint(object sender, PaintEventArgs e)
        {
            int width  =this.Width-1;
            int height = this.Height-1;
            Pen greenPen = new Pen(Color.FromArgb(255, 0, 255, 0), 5);
            e.Graphics.DrawRectangle(greenPen, 0, 0, width, height);
        }

Open in new window


Do not copy and paste this code in its entirety. First double click on paint event value box shown on the attached image. This will create the event and then copy and paste lines 3-6 into this event.
PaintEvent.bmp
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40511590
Hi Jatin;

Since the form's border look is controlled by the operating system, and the currently selected theme this is not a simple task. There is a Windows Form extension that was created that will make this much simpler. Please have a look at this web site, Drawing Custom Borders in Windows Forms, at the bottom of that page there are three documentation links.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:Jatin Nahar
ID: 40518231
@Fernando: with your suggested solution, will i get the form text (main title)?
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40518714
I have not used it myself but according to info on the website yes.
0
 

Author Comment

by:Jatin Nahar
ID: 40519328
@Fernando: no with your solution the form main title will not appear. it will gone by using FormBorderStyle as none. And try the solution first at your end before giving it to someone else. Just googling won't solve the problem. Any one can do the googling.
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40519333
Hi Jatin,

Fernando is a very caring expert, he often has gotten out of his way in helping me with my questions. I guess we always can appreciate his efforts. And, he is extremely knowledgeable.

Anybody can solve their problems and find their answers on their own but it takes longer; however, this goes much faster after connecting with the experts.  Here in EE community, experts help out in any way they could which is good.

Regards,

Mike
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40519677
Hi Jatin;

Sorry that did not meet your needs. From within Visual Studio you can click on Tools -> Extensions and Updates. In the new window that is displayed click on the Online button on the left side and then in the search bar to right top  type in VisualStyler. Clicking on the download button on that product will bring up this page, VisualStyler for Windows Forms .NET, where you may download a trial version. The main site for the developer is SkinSoft where you can find the pricing plans.

Good luck.
0
 

Author Comment

by:Jatin Nahar
ID: 40523295
Hi Fernado,

Thank you for your help. Is there any free third party tool for this work? Also is it possible without third party tool?
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 40523622
I personally do not have any knowledge or experience of a free library that can do what you need, sorry.
0
 

Author Closing Comment

by:Jatin Nahar
ID: 40537228
excellent
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question