Daniel Lip
Daniel Lip

Reputation: 11319

How can I create a button with a dropdown arrow near it?

I did :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {
        private int x, y;
        private int gap = 0;
        private int startingY = 83;
        private GroupBox lastGB = null;

        public Form1()
        {
            InitializeComponent();

            button1.Text = "Details " + char.ConvertFromUtf32(8595);
        }

The result is something bad not looking good :

my button

This is what I want to make : The NEW is acting like a button it is a button. The arrow near it is like a combobox :

The button with arrow I want

If I click on the NEW it will open folder dialog if I click on the arrow it will open kind of combobox without the borders.

Upvotes: 1

Views: 2201

Answers (1)

RussKie
RussKie

Reputation: 1850

This is called SplitButton. This question has been asked few times over the years.

You can draw an inspiration from the Windows Forms codebase. Or look at other answers to the same question: Split button in .NET Winforms. Or search online for SplitButton.

Upvotes: 4

Related Questions