combobox没有显示选项

yy_9117 CSDN会员 yy_9117 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在vsto里生成了一个任务窗格,窗格里有个combobox控件,不管在哪初始化combobox的items都没有下拉框也没有选项


初始化的时候代码如下

Microsoft.Office.Tools.CustomTaskPane ctp1;
UserControl1 uc1;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
uc1 = new UserControl1();
ctp1 = Globals.ThisAddIn.CustomTaskPanes.Add(uc1, "初始化密钥");
ctp1.Visible = true;

//MessageBox.Show("加载成功!");

}
这是一个ThisAddIn.cs里的

下面是UserControl1.cs里的
public partial class UserControl1 : UserControl
{

public UserControl1()
{

InitializeComponent();
}
private void UserControl1_load(object sender, EventArgs e)
{
this.comboBox1.Items.Add("默认密钥");
this.comboBox1.Items.Add("自定义密钥");

this.comboBox1.SelectedIndex = 0;
}


...全文
评论 5
收藏 已收藏
分享
返回顶部
yy_9117 CSDN会员
C# 111,130 成员 642,540 内容