Пример #1
0
        public ClientForm()
        {
            //禁用多线程UI检查
            CheckForIllegalCrossThreadCalls = false;
            InitializeComponent();

            //设置 图标 和 绘制方式(减少闪烁)
            this.Icon = UnityResource.Speleon;
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            UpdateStyles();

            //为窗体增加阴影
            UnityModule.DrawWindowShadow(this);
            UnityModule.DebugPrint("ClientForm 窗体创建成功");
        }
Пример #2
0
        /// <summary>
        /// 弹出提示窗口
        /// </summary>
        /// <param name="MessageText">消息文本</param>
        /// <param name="Title">消息标题</param>
        /// <param name="iconType">图表类型</param>
        public MyMessageBox(string MessageText, string Title, IconType iconType = IconType.Info)
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;

            TitleLabel.Text   = Title;
            this.Text         = Title;
            MessageLabel.Text = MessageText;
            IconLabel.Image   = UnityResource.ResourceManager.GetObject(iconType.ToString()) as Image;
            if (iconType == IconType.Question)
            {
                CancelButton.Left = (this.Width - CancelButton.Width * 2 - 20) / 2;
                OKButton.Left     = CancelButton.Right + 20;
            }
            else
            {
                CancelButton.Hide();
                OKButton.Left = (this.Width - OKButton.Width) / 2;
            }

            //为窗体增加阴影
            UnityModule.DrawWindowShadow(this);
        }