MessageBoxBySelf/XWQMessageBox.cs

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace XWQControls
{
    public partial class XWQMessageBox : Form
    {
        private XWQMessageBoxResult result;

        public XWQMessageBox(Control control)
        {
            InitializeComponent();

            Text = "提示";
            FormBorderStyle = FormBorderStyle.FixedDialog;
            AutoScaleMode = AutoScaleMode.None;
            Size = new Size(341, 205);
            pictureBox_Icon.Size = new Size(50, 50);

            StartPosition = FormStartPosition.Manual;
            Left = control.Left + (+control.Width - Width) / 2;
            Top = control.Top + (control.Height - Height) / 2;
        }

        public XWQMessageBoxResult Show(string text, XWQMessageBoxIcon icon = XWQMessageBoxIcon.Information, XWQMessageBoxButtons button = XWQMessageBoxButtons.OK)
        {
            TopMost = true;
            int distance = 10;
            label_Text.Text = text;

            Bitmap bitmap = null;
            switch (icon)
            {
                case XWQMessageBoxIcon.Information:
                    bitmap = Properties.Resources.information;
                    break;
                case XWQMessageBoxIcon.Error:
                    bitmap = Properties.Resources.error;
                    break;
                case XWQMessageBoxIcon.Warning:
                    bitmap = Properties.Resources.warn;
                    break;
                case XWQMessageBoxIcon.Question:
                    bitmap = Properties.Resources.question;
                    break;
            }

            pictureBox_Icon.Image = bitmap;

            pictureBox_Icon.Left = (Width - pictureBox_Icon.Width - distance - label_Text.Width) / 2;
            label_Text.Left = pictureBox_Icon.Left + pictureBox_Icon.Width + distance;

后面还有 257 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。