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
Solved

Form Border Color

Posted on 2014-12-19
11
2,295 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 500 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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