c#编程,我用了devexpress控件,怎么动态地添加 皮肤ToolStripMenuItem 的单击事件
foreach(SkinContainerskininSkinManager.Default.Skins)皮肤ToolStripMenuItem.DropDownItem...
foreach (SkinContainer skin in SkinManager.Default.Skins)
皮肤ToolStripMenuItem.DropDownItems.Add(skin.SkinName);
我将皮肤都用代码加入到了 皮肤ToolStripMenuItem.DropDownItems,怎么添加它的响应事件,求高手解决 展开
皮肤ToolStripMenuItem.DropDownItems.Add(skin.SkinName);
我将皮肤都用代码加入到了 皮肤ToolStripMenuItem.DropDownItems,怎么添加它的响应事件,求高手解决 展开
1个回答
展开全部
public partial class FormDevMenu:DevExpress.XtraEditors.XtraForm
{
public FormDevMenu()
{
InitializeComponent();
}
private void FormDevMenu_Load(object sender,EventArgs e)
{
foreach(DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
{
var item = 皮肤ToolStripMenuItem.DropDownItems.Add(skin.SkinName);
item.Click += new EventHandler(item_Click);
}
}
void item_Click(object sender,EventArgs e)
{
new DevExpress.LookAndFeel.DefaultLookAndFeel().LookAndFeel.SetSkinStyle((sender as ToolStripMenuItem).Text);
}
}
{
public FormDevMenu()
{
InitializeComponent();
}
private void FormDevMenu_Load(object sender,EventArgs e)
{
foreach(DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
{
var item = 皮肤ToolStripMenuItem.DropDownItems.Add(skin.SkinName);
item.Click += new EventHandler(item_Click);
}
}
void item_Click(object sender,EventArgs e)
{
new DevExpress.LookAndFeel.DefaultLookAndFeel().LookAndFeel.SetSkinStyle((sender as ToolStripMenuItem).Text);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询