R
R
Resolut2021-09-28 20:56:46
C++ / C#
Resolut, 2021-09-28 20:56:46

C#| winform | Menu button | How to create a button like this?

At the design stage, I came up with such a button, the question arose of how to implement this?
i.e. by clicking on the left side, the main functionality of the button is performed, and by clicking on the right side
, the button menu or other action opens.
6153572e74061282394063.png
I would be grateful for an answer or a link to something similar!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2021-09-30
@lxst

build on https: //stackoverflow.com/questions/1597320/split
-...
plus add a custom renderer

N
none7, 2021-09-29
@none7

You create a custom Control . You draw it all in it through Graphics , taking into account different sizes and different dpi (at the same time you curse yourself for your creativity). You override the OnClick method and in it you get the coordinates of the click on the surface of the control this.PointToClient(Cursor.Position). By calculating in which part of the control the cursor is set, you implement different behavior for the left and right parts.
If you also need the ability to work through the keyboard, without a mouse, then you will have to create two controls and put them side by side.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question