zoukankan      html  css  js  c++  java
  • 取控件句柄

    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.Diagnostics;

    namespace WindowsFormsApplication16
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            p rivate void button1_Click(object sender, EventArgs e)
            {
                //IntPtr hwnd= Process.GetProcessById().MainWindowHandle;
                String str1 = null;
                str1 += "button1句柄:";
                str1+=button1.Handle.ToString();
                //str1 += "\r\n";
                str1 += Environment.NewLine;

                str1 += "checkbox1句柄:";
                str1 += checkBox1.Handle.ToString();
                //str1 += "\r\n";
                str1 += Environment.NewLine;

                str1 += "label1句柄:";
                str1 += label1.Handle.ToString();
                //str1 += "\r\n";
                str1 += Environment.NewLine;

                str1 += "radioButton1句柄:";
                str1 += radioButton1.Handle.ToString();
                //str1 += "\r\n";
                str1 += Environment.NewLine;

                textBox1.Text = str1;
            }


        }
    }
     

    源代码下载

  • 相关阅读:
    实现AB值对换的两种方法
    Spring文件上传Demo
    CentOS 查看系统 CPU 个数、核心数、线程数
    InvocationTargetException异常
    在 Excel 中设置图片
    JavaScript写入文件到本地
    Semaphore初探
    MySQL连接服务端的几种方式
    超链接导致window.location.href失效的解决办法
    在 CentOS7 上安装 swftools
  • 原文地址:https://www.cnblogs.com/hackpig/p/1668479.html
Copyright © 2011-2022 走看看