views:

284

answers:

4

I've been hunting about for some resources on this, and I can't find any, so I'll bring in here.

I want to make a window similar in style to the quick launch box which you see when you open the quick launch bar:

Example Window

Sadly, I can't find any resources on this; can you help me out?

A: 

That sounds like you need Windows 7 API Code Pack, in which some API's are backward compatible with Vista. Since the specific version of Windows is not stated, I cannot say specifically..you could look here and here on CodeProject how this is accomplished.

Hope this helps, Best regards, Tom.

tommieb75
@Tommieb75 As you say, some functionality exposed by the W7 API Code Pack is Vista compatible. I can say with certainty that the TaskBarManager functionality is not usable in Vista : based on Visual Studio 2010 beta 2, where I was able to successfully compile a CodeProject example [1] that referenced the W7 API, but was not able to run the project because : "TaskbarManager.IsPlatformSupported" always returns false. [1] http://www.codeproject.com/KB/statusbar/Clipz.aspx
BillW
A: 

You can take an normal Form and modify it to look like your screenshot:

  1. Set the FormBorderStyle property to None
  2. Round the corners of your form: more info here
  3. (Extend the glass if you like: more info here, only Vista or higher)
  4. Set the background to White and add some controls to finish it off
Zyphrax
Well, with this method, I can't round the corners and extend the glass; doing so overrides the glass and just leaves it rounded.
SomeoneD
A: 

Assumptions :

  1. this is a fixed size form, never re-sizable

  2. you want this to work on XP as well as Vista (i.e., without using Vista specific techniques like 'Glass). I mention this because, after all, the System Tray does go back to the late paleolithic :)

Here's how :

  1. create a Form the same size as your .png file

  2. set the ControlBox, MaximizeBox, MinimizeBox properties to 'false

  3. set FormBorderStyle to 'None

  4. set the transparency key of the Form to some color, and set the background color of the Form to the same color : note use a color that does not occur in the .png file.

  5. put a PictureBox on the Form, set its Dock property to 'Fill : set its Margin property #0 for all Margins : set its BackColor to 'Transparent : then, naturally, set the Image property of the PictureBox to your .png file.

NOTE :

If you have prepared your .png image so it is bounded by a transparent area so that it appears rounded : you can use that directly and skip over the whole step of actually making the Form a Rounded Rectangle by use of an API call to set the Region of the Form : this does mean your Form will have a standard rectangular bounding box. If you can live with this : this is a simpler solution. For how to set the Region : read on ...

  1. see "How to make form rounded rectangle or round or triangle" here on SO for how to set the Region of the Form to a RoundedRect : this SO entry has several other links in it to code examples : the link mentioned by Zyphrax here uses the same basic technique.

  2. experiment with the settings to the 'CreateRoundRect to get the rounded corner effect you want.

BillW
+1  A: 

It's quite simple. Create a new form, and set ControlBox, MaximizeBox, and MinimizeBox properties to false. Set the Title property to an empty string. This will effectively eliminate the the nonclient title bar area, giving you this:

Simple winforms window without nonclient area

The the interior section (like with "Customize") can be duplicated with a properly sized Panel and Link.

Factor Mystic