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的窗体
                
            }
        }
    }
  • 相关阅读:
    Spring实现声明式事务
    Spring整合MyBatis
    Spring AOP
    代理模式
    Bean的作用域
    Spring的配置
    HQL题目记录以及解题思路--持续更新
    数仓学习之路一:数仓理论
    DBeaver连接Hive遇到的坑
    MySQL常见面试题
  • 原文地址:https://www.cnblogs.com/xuefeng1982/p/1834849.html
Copyright © 2011-2022 走看看