gpt4 book ai didi

c# - 通过选择项目更改 ToolStripDropDownButton 文本

转载 作者:行者123 更新时间:2023-11-30 12:33:03 26 4
gpt4 key购买 nike

我一直被这个问题困扰了一段时间,我希望能得到一些指导或答案。如何根据 ToolStripDropDownButton 中的选定项更改其文本?

我有一个要显示的网格,但我想动态更改网格的大小。通过选择 ToolStripDropDownButton 并选择预先确定的网格大小列表,ToolStripDropDownButton 的文本应该更改以向用户显示新的网格大小。

任何答案表示赞赏。

最佳答案

我找到了问题的答案,谢谢大家的回答。

        private void changeGridSizeDropDownButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem != null)
{
changeGridSizeDropDownButton.Text = e.ClickedItem.Text;
// This line converts my list gridsize options like 64, 32, and 16
// and Parses that text into the new selected gridsize.
gridSize = Int32.Parse(e.ClickedItem.Text);
}
}

关于c# - 通过选择项目更改 ToolStripDropDownButton 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10036858/

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