?
Solved

Form Border Color

Posted on 2014-12-19
11
Medium Priority
?
3,192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 63

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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

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

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 63

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 63

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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

777 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