Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Own form border style

Tags:

c#

.net

windows

I always thought that form borders that use programs like iTunes or Visual Studio 2012 are done without border style and buttons as close button are drawn as images.

Visual Studio 2012Musicjet

However once my Visual Studio wasn't responding and the border changed to the basic Windows border.

Windows

How can I get own form border? Is it possible in C#?

like image 776
Sorashi Avatar asked Dec 10 '12 17:12

Sorashi


People also ask

What is form border style?

FormBorderStyle. A FormBorderStyle that represents the style of border to display for the form. The default is FormBorderStyle. Sizable .


1 Answers

You are seeing the "ghost window", a window that the Windows window manager creates to replace the dead window. You see "Not Responding" in the title bar. That window isn't going to have to same custom styling of course, there's no way Windows knows how to do that properly.

You can use the Spy++ utility to look at the window properties of another app. VS2012 does in fact use a regular window style with a title bar. How they customized it is a well kept secret, I suspect they intercept WM_NCPAINT, a fairly difficult message to implement yourself. Using a borderless window is definitely easier.

like image 104
Hans Passant Avatar answered Sep 21 '22 12:09

Hans Passant