zoukankan      html  css  js  c++  java
  • 如何显示一个非激活窗体

    在WinForm程序中如何显示一个非激活的窗体呢?
    在.NET中似乎很难做到这一点,我们需要借助ShowWindow这个API来实现:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;

    namespace WindowsApplication1
    {

        public partial class Form1 : Form
        {
            [DllImport("user32.dll")]
            static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                Form2 form2 = new Form2();
                ShowWindow(form2.Handle, 4);//显示一个SW_SHOWNOACTIVATE的窗体
                
            }
        }
    }
  • 相关阅读:
    java基础知识复习
    红黑二叉查找树(原理、实现)
    Django admin
    redis+sentinel 安装与配置
    浅谈saltstack
    python3 通过smtplib模块发送邮件
    django 自定义分页模块
    chouti项目
    Django 进阶篇二
    Django 进阶篇
  • 原文地址:https://www.cnblogs.com/xuefeng1982/p/1834849.html
Copyright © 2011-2022 走看看