Click here to Skip to main content
15,889,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In MS office 2010 and 2007 they have buttons and things in the top window part where the close minimize buttons are.

How do i put buttons and things in the window area?

I believe they do this in Google chrome with the tabs.

Can anyone please help me out.
Posted
Updated 13-Mar-11 19:16pm
v2
Comments
Albin Abel 14-Mar-11 1:20am    
you need to owner draw those controls on the form at the paint event. May be other ways there. Not sure
[no name] 14-Mar-11 1:37am    
because i really want to know how to do it

I just looked at Word 2007, and there's nothing on the right side of the titlebar, but the top-left corner has the app orb and some icons in the titlebar. Is that what you're talking about? If so, that's part of the ribbon bar, and you can downbload the code for that from Microsoft after you agree to the free license terms.
 
Share this answer
 
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
http://www.dotnet247.com/247reference/msgs/41/207281.aspx[^]
 
Share this answer
 
First Set the FormBorderStyle to none, Add a panel to the Form and set the panels dock style to Dockstyle.Top. Now add 3 Panels to the first Panel and set the desired image to the panels background image. When the forms border is Gone So is the ability to move the form. To fix this add a mousedown, mouseup, and mousemove Events to your code and also a bool value of private bool CanMove and private Point currentPosition.
Now that we have this in place use these codes.

C#
using System.Drawing;

private bool CanMove;
private Point currentPosition;

private void panel1_MouseDown(object sender, EventArgs e)
{
   CanMove = true;
   currentPosition.X = e.X;
   currentPosition.Y = e.Y;
}

private void panel1_MouseUp(object sender, EventArgs e)
{
    CanMove = false;
}

private void panel1_MouseMove(object sender, EventArgs e)
{
 if (CanMove)
{
    Point newPosition = Control.MousePosition;
     newPosition.X = newPosition.X - currentPosition.X;
     newPosition.Y = newPosition.Y - currentPosition.Y;
     this.Location = newPosition;
  }
}
 
Share this answer
 
v4
The easiest way to do it in C# is to remove your caption (Empty the form's Text property) and buttons (Max/Min Buttons and ControlBox = False) so you just get a sizeable blank window. You can then drop on your own controls creating your own window look from scratch.

There's plenty of tutorials around to teach you how to drag a form from a control, which you can use to mimic the real titlebar.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900