博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
下拉框控件 转http://www.brad-smith.info/blog/archives/477
阅读量:6387 次
发布时间:2019-06-23

本文共 2674 字,大约阅读时间需要 8 分钟。

From time to time, it’s a good idea to go back and re-examine old code. With time comes greater knowledge and new tricks; and in the case of two of my earlier custom Windows Forms controls, this was certainly true. You may remember my support, as well as my – I have revisited these controls, with particular mind to implementing what I learnt from my experience with the .

GroupedComboBox

To refresh your memory, this control extends ComboBox and adds a new property; GroupMember. Using PropertyDescriptor and owner-drawing, it groups together items whose grouping values are equal.

What’s new:

  • On Windows Vista and 7, the control did not appear in the ‘button style’ consistent with normal ComboBox controls in DropDownList mode; this is a limitation of owner-drawing, but one that can be overcome through the use of VisualStyleRenderer. This is a slightly dodgy hack in that it pre-supposes the appearance of the ComboBox in this mode, but the functionality is only applied when the OS is identified as Vista or 7.
  • The control is inconsistent with other ComboBox controls because it is not animated. With the BufferedPainter<T> class I developed, implementing buffered animation was simple.

ComboTreeBox

The ComboTreeBox is a control developed entirely from scratch (i.e. its base class is Control) that uses a hierarchical/tree structure as its data representation (instead of a flat list). As such, it has behaviours in common with both ComboBox and TreeView. The drop-down/pop-up portion of the control is implemented using ToolStripDropDown, bitmap caching and custom rendering.

What’s new:

  • As with GroupedComboBox, the control did not appear in the Windows Vista/7 style. As the control has no editable portion and is entirely owner-drawn, it was easy to simulate the appearance under the appropriate OS. Under XP, it falls back to the default visual style. When themes are disabled, it draws in the classic style.
  • The control was not animated. Once again, BufferedPainter<T> was used to implement animation.
  • Due to a strongly-typed reference to its designer class, the control previously did not work with the “Client Profile” version of the .NET Framework. Rather cheekily, I have substituted my custom designer for the built-in designer that the DomainUpDown control uses – this works well for constraining the height of the control and avoids the need to reference the System.Design assembly (included only with the full version of the framework).
  • Minor tweaks were made to the way focused items are drawn; this is only apparent if focus cues are enabled in Windows.

Download

(Visual Studio 2010 Solution, .NET Framework 4 Client Profile)

转载地址:http://xnbha.baihongyu.com/

你可能感兴趣的文章
转载-没有IE就没有伤害!浏览器兼容性问题解决方案汇总
查看>>
常用 tcpdump 抓包方式
查看>>
Geek's Collection(幂运算)
查看>>
easy bootstrap模板
查看>>
Hdu 4734-F(x) 数位dp
查看>>
DRUID连接池的实用 配置详解
查看>>
html&css精华总结
查看>>
ImportError: No module named tornado.ioloop 记录过程
查看>>
[转] SSH 密钥认证机制
查看>>
hihocoder [Offer收割]编程练习赛14 小Hi和小Ho的礼物
查看>>
JQuery EasyUI 动态改变表单项的验证守则
查看>>
Jmeter如何操作数据库
查看>>
iOS开发设置View某个角为圆角
查看>>
【python】python path,macports,easy-install,numpy,scipy,ipython,matplotlib,集成工具...
查看>>
学习进度总结
查看>>
ACCESS模糊查询出现"内存溢出"原因是日文片假名
查看>>
Error setting expression 'XXX' with value 设置表达式“XXX”时出错 解决方法
查看>>
javascript获取url参数和script标签中获取url参数
查看>>
CF359D:Pair of Numbers(数论)
查看>>
进制转换展示
查看>>