码迷,mamicode.com
首页 > 其他好文 > 详细

隐藏光标与获得光标2----获得光标所在的控件

时间:2016-03-19 15:57:52      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace 获得当前拥有焦点的控件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

[DllImport("user32.dll", EntryPoint = "GetFocus")]
public extern static IntPtr GetF222ocus();

private void button1_Click(object sender, EventArgs e)
{
IntPtr currnetGetFocusedControl = GetF222ocus();
Control control = Control.FromHandle(currnetGetFocusedControl);
}
}
}

隐藏光标与获得光标2----获得光标所在的控件

标签:

原文地址:http://www.cnblogs.com/1175429393wljblog/p/5295127.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!