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);
}
}
}

相关文章:

  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2021-08-22
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
猜你喜欢
  • 2022-01-17
  • 2021-10-08
  • 2021-09-20
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案