首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

WinForm中如何用API判断一个控件是Button还是CheckBox还是RadioButton?

2012-02-11 
WinForm中怎么用API判断一个控件是Button还是CheckBox还是RadioButton??我试过用GetClassName函数.但是不

WinForm中怎么用API判断一个控件是Button还是CheckBox还是RadioButton??
我试过用GetClassName函数.但是不行.取到的都是:xxxxxx.BUTTON.app3
看了下MSDN:如下
System.Object
      System.MarshalByRefObject
            System.ComponentModel.Component
                  System.Windows.Forms.Control
                        System.Windows.Forms.ButtonBase
                              System.Windows.Forms.Button
                              System.Windows.Forms.CheckBox
                              System.Windows.Forms.RadioButton
为什么取出来的都是BUTTON啊...有什么方法用API函数判断吗??????
谢谢各位!!

[解决办法]
use win32 function "AccessibleObjectFromPoint " get the acc object.
then use "acc_Role " property to get the role type.

热点排行