Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form Border Color

Posted on 2014-12-19
11
Medium Priority
?
3,614 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 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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:…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 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