111,126
社区成员
发帖
与我相关
我的任务
分享using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[System.Runtime.InteropServices.DllImport("User32.Dll")]
public static extern void GetClassName(int h, StringBuilder s, int nMaxCount);
private void Form1_Load(object sender, EventArgs e)
{
StringBuilder s=new StringBuilder(255);
GetClassName(this.Handle.ToInt32(), s, 255);
this.Text = s.ToString();
}
}
}
Control c = Control.FromHandle(this.button1.Handle);
string typeName = c.GetType().Name;