Spaces in the ContextMenuStrip in C# WinForm.

Tolga TOPALOĞLU 26 Reputation points
2022-12-26T14:44:31.103+00:00

I added contextMenuStrip to my form manually (with codes) and I want to remove it's left and right spaces. When I add any parent item to it, It shows right and left spaces default. How to remove or decrease left and right padding spaces from it?

EDIT: I tried "contextMenuStrip.Padding = new Padding(0, 0, 0, 0);" and margin!

274077-image.png

Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.5K Reputation points
    2022-12-26T20:21:18.067+00:00

    If you have a ContextMenuStrip, then try something like this:

    contextMenuStrip1.ShowImageMargin = false;  
    contextMenuStrip1.AutoSize = false;  
    contextMenuStrip1.Width = 150;  
    

    However, you must specify the proper width. Maybe it is better to avoid this, and to use the left space for some images.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Tolga TOPALOĞLU 26 Reputation points
    2022-12-27T16:53:39.527+00:00

    Changing the ShowImageMargin to false is solved my issue. And I'm searching how to make the contextMenuStrip corners rounded. I found something as drawing arc but It not makes right corners rounded. Is there any way to do it?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.