gpt4 book ai didi

c# - 如何删除 ToolStripMenuItem 中的右侧空白区域

转载 作者:太空狗 更新时间:2023-10-29 21:57:47 24 4
gpt4 key购买 nike

ss

在屏幕截图中,我用绿色矩形标记了空白区域,我希望 ToolStripMenuItem 中的左右空间大小相等,但右侧有更大的空白区域,我无法删除。

代码:

    private void UpdateWorkflowsMenu()
{
((ToolStripDropDownMenu)tsddbWorkflows.DropDown).ShowImageMargin = false;

tsddbWorkflows.DropDownItems.Clear();

Program.HotkeyManager.Hotkeys.ForEach<HotkeySettings>(x =>
{
if (x.TaskSettings.Job != HotkeyType.None && (!Program.Settings.WorkflowsOnlyShowEdited || !x.TaskSettings.IsUsingDefaultSettings))
{
ToolStripMenuItem tsmi = new ToolStripMenuItem(x.TaskSettings.Description);
if (x.HotkeyInfo.IsValidHotkey) tsmi.ShortcutKeyDisplayString = " " + x.HotkeyInfo.ToString();
tsmi.Click += (sender, e) => HandleTask(x.TaskSettings);
tsddbWorkflows.DropDownItems.Add(tsmi);
}
});

tsddbWorkflows.Visible = tsddbWorkflows.DropDownItems.Count > 0;
}

最佳答案

VB版(实际上箭头有18个像素:大小10个,边距8个,边距留2个像素)

Parent.DropDown.GetType.GetField("ArrowPadding", 
Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Static).SetValue(Nothing, New Padding(0, 0, -16, 0))

关于c# - 如何删除 ToolStripMenuItem 中的右侧空白区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23724662/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com