• 给窗体做遮罩(另类做法)


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace LUserControl
    {
        public class TransparentBase : Form
        {
            /// <summary>
            /// 遮罩窗体
            /// </summary>
            public FrmTransparent FrmTran;
        }
    }
    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;
    
    namespace LUserControl
    {
        public partial class FrmTransparent : Form
        {
            /// <summary>
            /// 显示窗体
            /// </summary>
            public TransparentBase frm;
            /// <summary>
            /// 主窗体
            /// </summary>
            public Form MainFrm;
            public FrmTransparent()
            {
                InitializeComponent();
                TransparencyKey = Color.White;
            }
    
            private void LoadData()
            {
                frm.FrmTran = this;
                frm.StartPosition = FormStartPosition.CenterScreen;
                frm.ShowDialog();
            }
    
            private void FrmTransparent_Load(object sender, EventArgs e)
            {
                LoadData();
            }
        }
    }

    用法:

     FrmNoClose frmNoClose = new FrmNoClose();
                    //equipmentLstForm.smallCabinetCode = cd.Name;
                    //equipmentLstForm.totalNum = cd.SavedNum;
                    //equipmentLstForm.storedNum = cd.SavingNum;
                    frmNoClose.Cabinet = cd;
                    //frmNoClose.ShowDialog();
                    FrmTransparent frmTransparent = new FrmTransparent();
                    frmTransparent.frm = frmNoClose;
                    frmTransparent.MainFrm = this;
                    frmTransparent.ShowDialog();
    FrmNoClose必须继承TransparentBase类

    
    
  • 相关阅读:
    搭建负载均衡的环境(利用虚拟机上的四台centos)
    java的IO,AIO简单对比
    【每日分享】关于漏测
    安装xampp后,遇到的各种问题
    端口占用问题——netstat命令
    随笔
    AJAX 状态值(readyState)与状态码(status)详解
    CSS 实践:实现下拉菜单的方法
    css3动画总结
    判断手机运营商
  • 原文地址:https://www.cnblogs.com/lsgsanxiao/p/9020472.html
Copyright © 2020-2023  润新知