控件设计时右键菜单扩展(高手进) 我虽然没做过,但我有点思路,vs里大多数控件都有个属性可以设置该控件的右击菜单,估计多数是从control这继承来的,那你自己的控件肯定也要继承control把?那也有这个属性的,把这个属性设成你想要的context menu的name就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 (月下的夜想曲) 你的办法是要再设计期加上一个 右键菜单 能不能修改ide 提供的那个并不是完全自己做??? 此功能通过写设计器来实现。只要在设计器的加入DesignerVer就行了。参考ComponentDesigner的帮助文档。 ms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpconwinformsdesignersample.htm的示例 不知道这个算不算?http://www.windowsforms.net/default.aspx?tabindex=4&tabid=47&ItemID=16&mid=142 写设计器了,有个什么Designer类(具体的忘了名了),它有方法能得到所有的Verbs集合,自己定义一个Verb实例,add到集合中就行了 在类似ControlDesigner的设计时类中添加:public override System.ComponentModel.Design.DesignerVerbCollection Verbs{ get { DesignerVerbCollection v = new DesignerVerbCollection(); // Verb to add buttons v.Add(new DesignerVerb("&Add Button", new EventHandler(OnAddButton))); return v; }}private void OnAddButton(object sender, System.EventArgs e){ ColourButton button; IDesignerHost h = (IDesignerHost) GetService(typeof(IDesignerHost)); DesignerTransaction dt; IComponentChangeService c = (IComponentChangeService) GetService(typeof(IComponentChangeService)); // Add a new button to the collection dt = h.CreateTransaction("Add Button"); button = (ColourButton) h.CreateComponent(typeof(ColourButton)); c.OnComponentChanging(MyControl, null); MyControl.Buttons.Add(button); c.OnComponentChanged(MyControl, null, null, null); dt.Commit();} VS打包安装 Graphics.ScaleTransform(Single, Single) C# masked text box 求助!实现类似芊芊静听的 频谱分析 视觉效果 和自动搜索歌词功能? 关于DataGrid的2个问题 有关线程函数的一个问题 大家一起来讨论 怎样才能学好 正则表达式,把你的经验和大家一起分享吧! 文本的复制和粘贴 怎样控制刷新,在刷新之前停几秒怎么做? 关于 transformation 的问题 请高手指教C#调用DLL的问题 高分請教!DataGrid問題
只要在设计器的加入DesignerVer就行了。参考ComponentDesigner的帮助文档。
public override System.ComponentModel.Design.DesignerVerbCollection Verbs
{
get
{
DesignerVerbCollection v = new DesignerVerbCollection(); // Verb to add buttons
v.Add(new DesignerVerb("&Add Button",
new EventHandler(OnAddButton))); return v;
}
}private void OnAddButton(object sender, System.EventArgs e)
{
ColourButton button;
IDesignerHost h = (IDesignerHost) GetService(typeof(IDesignerHost));
DesignerTransaction dt;
IComponentChangeService c = (IComponentChangeService)
GetService(typeof(IComponentChangeService)); // Add a new button to the collection
dt = h.CreateTransaction("Add Button");
button = (ColourButton) h.CreateComponent(typeof(ColourButton));
c.OnComponentChanging(MyControl, null);
MyControl.Buttons.Add(button);
c.OnComponentChanged(MyControl, null, null, null);
dt.Commit();
}