自定义TabControl和Designtime功能(移动字形,鼠标事件...) [英] Custom TabControl and Designtime features (glyph to move, mouse events ...)

查看:136
本文介绍了自定义TabControl和Designtime功能(移动字形,鼠标事件...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我尝试从头开始制作一个自定义TabControl(而不是继承自真实的TabControl),并尝试添加与真实的Tab相同的设计时功能.
-通过拖放将控件添加到选项卡容器中
-使子级TabPage在"VisualStudio文档结构"窗口中可见.

我知道我必须创建一个自定义Designer类,并且有一个.它继承自ParentControlDesigner

我的TabPages是从UserControl继承的(它不是ContainerControl ??).我已将此属性添加到CustomTabPage控件中

Hi !

I try to make a custom TabControl from scratch (not inherited from the real one), And I try to add the same design-time features as the real one.
-Add controls to tabs containers by drag and drop
-Make the childs TabPages visible in the VisualStudio Document Structure window.

I know I must create a custom Designer class and I have one. It is inherited from ParentControlDesigner

My TabPages are inherited from UserControl (it''s not a ContainerControl ??). I have added this attribute to my CustomTabPage control

<Designer(GetType(ParentControlDesigner))>



什么都行不通.我试图使CustomTabPage控件从Panel继承,但是不起作用.
如果我尝试覆盖"OnControlAdded"方法,并通过我的TabPage更改添加控件的父级,则当我将控件拖到TabPage上时,该控件会返回到窗体上.如果我不重写此方法,则添加控件,但直接在TabControl中...而不是在选定的tabPage中.

有人可以帮助我理解吗?还是有一个示例说明如何创建相同类型的控件?在此先感谢您,并感谢我的英语不好.



Nothing works. I tried to make my CustomTabPage control inheriting from Panel but doesn''t work.
If I try to override the "OnControlAdded" method a change the parent of added control by my TabPage, when I drag a control over a TabPage, the control come back on the Form. If I don''t override this method, the control is added, but directly in the TabControl ... not in the selected tabPage.

Can somebody help me to understand ? or is there an example of how to create the same kind of controls ? Thanks in advance and sorry for my bad english

推荐答案

请仔细检查此链接以帮助您如何创建自定义控件类,
http://www.codeproject.com/KB/tabs/GradientTabControlPackage.aspx [ ^ ]
问候...
kindly check this link to help you how to create custome control class,
http://www.codeproject.com/KB/tabs/GradientTabControlPackage.aspx[^]
regards...


这篇关于自定义TabControl和Designtime功能(移动字形,鼠标事件...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆