Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
.NET Framework GroupsView
.NET Distributed_Apps
.NET
.NET ADO.NET
.NET ASP.NET
.NET ASP.NET Security
.NET ASP.NET Webcontrols
.NET ASP.NET Web Services
.NET Clr
.NET Compact Framework
.NET Drawing
.NET Interop
.NET Performance
.NET Web Services
.NET Windows Forms
.NET Windows Forms Controls
.NET General
.NET Csharp
.NET Visual Basic
.NET Vc
.NET Security
.NET Xml
Vsnet Debugging
Xml
Xsl
Scripting Jscript
Scripting Visual Basicscript
Scripting Wsh
Smartphone Developer
Visual Basic Com
Visual Basic Controls
Visual Basic Crystal
Visual Basic Database Ado
Visual Basic Syntax
Visual Basic Winapi
Vc Atl
Vc Debugger
Vc Language
Vc Mfc
Vc Stl
Visio Developer Visual Basica
Windowsce Embedded Vc
Windows Powershell
Visual Basic Vista Compatibility
Deployment Server
.NET Micro Porting

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Apps
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft NET Windows Forms Controls Posts  Ask A New Question 

Button with arrowdown (acting as a combobox)

Soeren D. posted on Friday, June 22, 2007 8:28 AM

I have seen WinForm applications with a control, that I am pretty sure is
standard in .NET 2.0

It is a button with a leftadjusted text followed by an arrow pointing down.
When the button is pressed, a menu is shown benieth and the text of the
selected menuitem becomes the new buttontext.

From a functional point of view it is a combobox, but this design is
wellsuited for my application.

Do you know where to find it?

Thanks in advance.

Best regards
Soeren
reply

 

There is a ToolStripDropDownButton class that does this.

Kevin Spencer posted on Friday, June 22, 2007 11:26 AM

There is a ToolStripDropDownButton class that does this.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
reply

Hi Kevin,I tried to look it up but is appears to be for toolstrips only and I

Soeren D. posted on Friday, June 22, 2007 12:08 PM

Hi Kevin,

I tried to look it up but is appears to be for toolstrips only and I would
like to use it in the form itself.

But thanks for the tip.

Best regards
Soeren
reply

In that case, create a button that has an arrow on it, and put it next to

Kevin Spencer posted on Monday, June 25, 2007 6:25 AM

In that case, create a button that has an arrow on it, and put it next to
another button.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
reply

Button with arrowdown (acting as a combobox)

Jeff Johnson posted on Tuesday, June 26, 2007 5:15 PM

A while back I needed a "More/Less" button which expanded or collapsed a
form, and I wanted a nice up/down arrow for it as opposed to the more common
like this:

private void MoreInfoButton_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Font f = new Font("Marlett", MoreInfoButton.Font.Size * 1.1f);
string Arrow;
float TextWidth;

if (_expanded)
Arrow = "5";
else
Arrow = "6";

TextWidth = g.MeasureString(MoreInfoButton.Text,
MoreInfoButton.Font).Width;
g.DrawString(Arrow, f, SystemBrushes.ControlText, TextWidth - 6,
(e.ClipRectangle.Height - g.MeasureString(Arrow, f).Height) / 2);
}

There's some "fudge factor" numbers going on there which were necessary (if
I remember right) because Graphics.MeasureString() wasn't returning a 100%
correct result. However, this was written in .NET 1.1 and maybe this has
changed in 2.0.

As for the dropdown, you could simply create a ContextMenu[Strip] and
display it directly below your button when clicked.
reply


Previous Microsoft NET Windows Forms Controls conversation.