示例#1
0
        public MainPanelControl()
        {
            Location = new Point(0, 0);
            Size     = new System.Drawing.Size(MainForm.MainFormWidth, MainForm.MainFormHeight);
            //Dock = DockStyle.Fill;
            titleBar        = new TitleBarControl();
            titleBar.Height = 252;

            mainFuncBtn             = new Label();
            mainFuncBtn.BackColor   = Color.Transparent;
            mainFuncBtn.Image       = Properties.Resources.home_fh_icon_animation_h;
            mainFuncBtn.Size        = mainFuncBtn.Image.Size;
            mainFuncBtn.Location    = new Point(24, 60);
            mainFuncBtn.MouseEnter += mainFuncBtnOnMouseEnter;
            mainFuncBtn.MouseLeave += mainFuncBtnOnMouseLeave;
            titleBar.Controls.Add(mainFuncBtn);
            ToolTip mainFuncTip = new ToolTip();

            mainFuncTip.SetToolTip(mainFuncBtn, "设置防护功能和查看防护记录");
            titleBar.ProtectionCenterItem.Click += ProtectionCenterItemOnClick;

            wechatBindingBtn            = new TextButton();
            wechatBindingBtn.BackColor  = Color.Transparent;
            wechatBindingBtn.Text       = "绑定微信";
            wechatBindingBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);;
            wechatBindingBtn.ForeColor  = Color.FromArgb(0x4f, 0x4f, 0x00);
            wechatBindingBtn.HoverColor = Color.FromArgb(0xff, 0xa4, 0x05);
            wechatBindingBtn.Location   = new Point(788, 214);
            titleBar.Controls.Add(wechatBindingBtn);
            wechatBindingBtn.Click += wechatBindingBtnOnClick;

            wechatHeadImage               = new PictureBox();
            wechatHeadImage.SizeMode      = PictureBoxSizeMode.Zoom;
            wechatHeadImage.Size          = new System.Drawing.Size(32, 32);
            wechatHeadImage.ImageLocation = Program.AppLocalDir + "UserHeadImage";
            //wechatHeadImage.Location = new Point(wechatxLocation,
            //    mainFuncBtn.Location.Y+mainFuncBtn.Height/2-wechatHeadImage.Height/2);
            wechatHeadImage.Location = new Point(788, 214);
            titleBar.Controls.Add(wechatHeadImage);
            ToolTip wechatHeadImageTip = new ToolTip();

            wechatHeadImageTip.SetToolTip(wechatHeadImage, "绑定者微信头像");

            wechatNickname           = new Label();
            wechatNickname.BackColor = Color.Transparent;
            wechatNickname.AutoSize  = true;
            //wechatNickname.TextAlign = ContentAlignment.MiddleCenter;
            wechatNickname.Text         = Properties.Settings.Default.userNickname;
            wechatNickname.Font         = new System.Drawing.Font("微软雅黑", 10, GraphicsUnit.Pixel);
            wechatNickname.ForeColor    = Color.White;
            wechatNickname.MaximumSize  = new System.Drawing.Size(80, 0);
            wechatNickname.AutoEllipsis = true;
            titleBar.Controls.Add(wechatNickname);
            ToolTip wechatNicknameTip = new ToolTip();

            wechatNicknameTip.SetToolTip(wechatNickname, "绑定者微信昵称");

            guradNormalPanel           = new Panel();
            guradNormalPanel.BackColor = Color.Transparent;
            guradNormalPanel.AutoSize  = true;
            guradNormalPanel.Location  = new Point(mainFuncBtn.Location.X + mainFuncBtn.Width, 120);
            titleBar.Controls.Add(guradNormalPanel);

            guardDescLabel           = new Label();
            guardDescLabel.AutoSize  = true;
            guardDescLabel.Text      = Properties.Resources.ProductionName + "正在守护您的电脑";
            guardDescLabel.Font      = new System.Drawing.Font("微软雅黑", 22, GraphicsUnit.Pixel);
            guardDescLabel.ForeColor = Color.White;
            guradNormalPanel.Controls.Add(guardDescLabel);

            analysisItemsDescLabel           = new Label();
            analysisItemsDescLabel.AutoSize  = true;
            analysisItemsDescLabel.Text      = "已监控项目:";
            analysisItemsDescLabel.Font      = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            analysisItemsDescLabel.ForeColor = Color.White;
            guradNormalPanel.Controls.Add(analysisItemsDescLabel);

            analysisItemsNumLabel           = new Label();
            analysisItemsNumLabel.AutoSize  = true;
            analysisItemsNumLabel.Text      = "0";
            analysisItemsNumLabel.Font      = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            analysisItemsNumLabel.ForeColor = Color.White;
            guradNormalPanel.Controls.Add(analysisItemsNumLabel);

            analysisResultViewBtn            = new TextButton();
            analysisResultViewBtn.Text       = "立即查看";
            analysisResultViewBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);;
            analysisResultViewBtn.ForeColor  = Color.FromArgb(0x4f, 0x4f, 0x00);
            analysisResultViewBtn.HoverColor = Color.FromArgb(0xff, 0xa4, 0x05);
            guradNormalPanel.Controls.Add(analysisResultViewBtn);
            analysisResultViewBtn.Click += mainFuncBtnOnClick;

            analysisResultDescLabel              = new Label();
            analysisResultDescLabel.AutoSize     = true;
            analysisResultDescLabel.Text         = "新检测到不良项目!";
            analysisResultDescLabel.Font         = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            analysisResultDescLabel.ForeColor    = Color.FromArgb(0x4f, 0x4f, 0x00);
            analysisResultDescLabel.SizeChanged += analysisResultDescLabelOnSizeChanged;
            guradNormalPanel.Controls.Add(analysisResultDescLabel);

            //analysisItemsDescLabel.Visible = false;
            //analysisItemsNumLabel.Visible = false;
            analysisResultDescLabel.Visible = false;
            analysisResultViewBtn.Visible   = false;

            scanningPanel           = new Panel();
            scanningPanel.BackColor = Color.Transparent;
            scanningPanel.AutoSize  = true;
            scanningPanel.Location  = new Point(mainFuncBtn.Location.X + mainFuncBtn.Width, 128);
            titleBar.Controls.Add(scanningPanel);

            scanningLabel           = new Label();
            scanningLabel.AutoSize  = true;
            scanningLabel.Text      = "正在进行本地扫描...";
            scanningLabel.Font      = new System.Drawing.Font("微软雅黑", 22, GraphicsUnit.Pixel);
            scanningLabel.ForeColor = Color.White;
            scanningLabel.Location  = new Point(0, 0);
            scanningPanel.Controls.Add(scanningLabel);

            viewScanningBtn            = new TextButton();
            viewScanningBtn.Text       = "查看详情";
            viewScanningBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);;
            viewScanningBtn.ForeColor  = Color.FromArgb(0x4f, 0x4f, 0x00);
            viewScanningBtn.HoverColor = Color.FromArgb(0xff, 0xa4, 0x05);
            scanningPanel.Controls.Add(viewScanningBtn);
            viewScanningBtn.Click += viewScanningBtnOnClick;

            scanBtnsPanel           = new Panel();
            scanBtnsPanel.BackColor = Color.FromArgb(0xf8, 0xf8, 0xf8);
            scanBtnsPanel.Size      = new System.Drawing.Size(MainForm.MainFormWidth, 318);
            scanBtnsPanel.Location  = new Point(0, titleBar.Height);
            Controls.Add(scanBtnsPanel);

            allScanBtn            = new ImageButton();
            allScanBtn.Image      = Properties.Resources.home_scanner_qp_n;
            allScanBtn.Size       = allScanBtn.Image.Size;
            allScanBtn.NormalBack = Properties.Resources.home_scanner_qp_n;
            allScanBtn.HoverBack  = Properties.Resources.home_scanner_qp_h;
            allScanBtn.PressBack  = Properties.Resources.home_scanner_qp_n;
            allScanBtn.Location   = new Point(130, scanBtnTopPadding);
            ToolTip allScanTip = new ToolTip();

            allScanTip.AutoPopDelay = 32000;
            allScanTip.SetToolTip(allScanBtn, "扫描所有磁盘上的图片和视频");

            fastScanBtn            = new ImageButton();
            fastScanBtn.Image      = Properties.Resources.home_scanner_ks_n;
            fastScanBtn.Size       = fastScanBtn.Image.Size;
            fastScanBtn.NormalBack = Properties.Resources.home_scanner_ks_n;
            fastScanBtn.HoverBack  = Properties.Resources.home_scanner_ks_h;
            fastScanBtn.PressBack  = Properties.Resources.home_scanner_ks_n;
            fastScanBtn.Location   = new Point(allScanBtn.Location.X + allScanBtn.Width * 2, scanBtnTopPadding);
            ToolTip fastScanTip = new ToolTip();

            fastScanTip.AutoPopDelay = 32000;
            fastScanTip.SetToolTip(fastScanBtn, "扫描上网记录中的图片");

            customScanBtn            = new ImageButton();
            customScanBtn.Image      = Properties.Resources.home_scanner_zdy_n;
            customScanBtn.Size       = customScanBtn.Image.Size;
            customScanBtn.NormalBack = Properties.Resources.home_scanner_zdy_n;
            customScanBtn.HoverBack  = Properties.Resources.home_scanner_zdy_h;
            customScanBtn.PressBack  = Properties.Resources.home_scanner_zdy_n;
            customScanBtn.Location   = new Point(fastScanBtn.Location.X + fastScanBtn.Width * 2, scanBtnTopPadding);
            ToolTip customScanTip = new ToolTip();

            customScanTip.AutoPopDelay = 32000;
            customScanTip.SetToolTip(customScanBtn, "扫描指定文件夹内的图片和视频");

            allScanLabel          = new Label();
            allScanLabel.AutoSize = true;
            allScanLabel.Text     = "全盘扫描";
            allScanLabel.Font     = new System.Drawing.Font("微软雅黑", 16, GraphicsUnit.Pixel);

            fastScanLabel          = new Label();
            fastScanLabel.AutoSize = true;
            fastScanLabel.Text     = "上网记录扫描";
            fastScanLabel.Font     = new System.Drawing.Font("微软雅黑", 16, GraphicsUnit.Pixel);

            customScanLabel          = new Label();
            customScanLabel.AutoSize = true;
            customScanLabel.Text     = "自定义扫描";
            customScanLabel.Font     = new System.Drawing.Font("微软雅黑", 16, GraphicsUnit.Pixel);

            scanBtnsPanel.Controls.Add(allScanBtn);
            scanBtnsPanel.Controls.Add(fastScanBtn);
            scanBtnsPanel.Controls.Add(customScanBtn);
            scanBtnsPanel.Controls.Add(allScanLabel);
            scanBtnsPanel.Controls.Add(fastScanLabel);
            scanBtnsPanel.Controls.Add(customScanLabel);

            edgeAboveStatusPanel           = new Label();
            edgeAboveStatusPanel.BackColor = Color.FromArgb(0xee, 0xee, 0xee);
            edgeAboveStatusPanel.Size      = new System.Drawing.Size(MainForm.MainFormWidth, 3);
            edgeAboveStatusPanel.Location  = new Point(0, scanBtnsPanel.Location.Y + scanBtnsPanel.Height);

            edgeBelowStatusPanel           = new Label();
            edgeBelowStatusPanel.BackColor = Color.FromArgb(0xee, 0xee, 0xee);
            edgeBelowStatusPanel.Size      = new System.Drawing.Size(MainForm.MainFormWidth, 3);
            edgeBelowStatusPanel.Location  = new Point(0, MainForm.MainFormHeight - edgeBelowStatusPanel.Height);

            statusPanel           = new Panel();
            statusPanel.Location  = new Point(0, edgeAboveStatusPanel.Location.Y + edgeAboveStatusPanel.Height);
            statusPanel.Size      = new System.Drawing.Size(MainForm.MainFormWidth, edgeBelowStatusPanel.Location.Y - edgeAboveStatusPanel.Location.Y - edgeAboveStatusPanel.Height);
            statusPanel.BackColor = Color.White;

            checkUpdateBtn = new TextButton();
            //checkUpdateBtn.BackColor = Color.Red;
            checkUpdateBtn.Text       = "检查更新";
            checkUpdateBtn.Font       = new System.Drawing.Font("微软雅黑", 11, GraphicsUnit.Pixel);
            checkUpdateBtn.ForeColor  = Color.FromArgb(0x4f, 0xb5, 0x2c);
            checkUpdateBtn.HoverColor = Color.FromArgb(0xff, 0xa4, 0x05);
            checkUpdateBtn.Click     += checkUpdateBtnOnClick;
            statusPanel.Controls.Add(checkUpdateBtn);

            versionLabel          = new Label();
            versionLabel.AutoSize = true;
            FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
            Version         curVersion  = new Version(versionInfo.ProductVersion);

            versionLabel.Text      = "程序版本 " + curVersion.ToString();
            versionLabel.Font      = new System.Drawing.Font("微软雅黑", 11, GraphicsUnit.Pixel);
            versionLabel.ForeColor = Color.FromArgb(0x5e, 0x5e, 0x5e);
            statusPanel.Controls.Add(versionLabel);

            qqGroupLabel = new TextButton();
            //qqGroupLabel.AutoSize = true;
            qqGroupLabel.Text       = "反馈QQ群:" + qqGroupNum;
            qqGroupLabel.Font       = new System.Drawing.Font("微软雅黑", 11, GraphicsUnit.Pixel);
            qqGroupLabel.ForeColor  = Color.FromArgb(0x5e, 0x5e, 0x5e);
            qqGroupLabel.HoverColor = Color.FromArgb(0xff, 0xa4, 0x05);
            //qqGroupLabel.Location = new Point(, statusPanel.Height / 2 - wechatStatusIcon.Height / 2);
            ToolTip qqGroupTip = new ToolTip();

            qqGroupTip.AutoPopDelay = 32000;
            qqGroupTip.InitialDelay = 10;
            qqGroupTip.SetToolTip(qqGroupLabel, "复制QQ群号");
            qqGroupLabel.Click += qqGroupLabelOnClick;
            statusPanel.Controls.Add(qqGroupLabel);

            wechatStatusIcon = new Label();
            //wechatStatusIcon.Image = Properties.Resources.wechatauth;
            wechatStatusIcon.Image    = Properties.Resources.wechatnotauth;
            wechatStatusIcon.Size     = wechatStatusIcon.Image.Size;
            wechatStatusIcon.Location = new Point(statusPanel.Width - 12 - wechatStatusIcon.Width, statusPanel.Height / 2 - wechatStatusIcon.Height / 2);
            statusPanel.Controls.Add(wechatStatusIcon);

            wechatStatusLabel           = new Label();
            wechatStatusLabel.AutoSize  = true;
            wechatStatusLabel.Text      = "微信未授权";
            wechatStatusLabel.Font      = new System.Drawing.Font("微软雅黑", 11, GraphicsUnit.Pixel);
            wechatStatusLabel.ForeColor = Color.FromArgb(0x5e, 0x5e, 0x5e);
            statusPanel.Controls.Add(wechatStatusLabel);
            wechatStatusLabel.SizeChanged += wechatStatusLabelOnSizeChanged;

            Controls.Add(titleBar);
            Controls.Add(statusPanel);

            Load += MainPanelControlOnLoad;
            fastScanBtn.Click   += fastScanBtnOnClick;
            allScanBtn.Click    += allScanBtnOnClick;
            customScanBtn.Click += customScanBtnOnClick;
            mainFuncBtn.Click   += mainFuncBtnOnClick;
            MainForm.Instance.TargetProcessedProgress.ProgressChanged += TargetProcessedProgressOnProgressChanged;
            //Paint += MainPanelOnPaint;
            //RefreshWechatInfo();

            mainPanelRightClickMenu    = new ContextMenuStrip();
            openProtectionPanel        = new ToolStripMenuItem("设置防护功能和查看防护记录");
            openAllScan                = new ToolStripMenuItem("扫描所有磁盘上的图片和视频");
            openFastScan               = new ToolStripMenuItem("扫描上网记录中的图片");
            openCustomScan             = new ToolStripMenuItem("扫描指定文件夹内的图片和视频");
            openProtectionPanel.Click += mainFuncBtnOnClick;
            openAllScan.Click         += allScanBtnOnClick;
            openFastScan.Click        += fastScanBtnOnClick;
            openCustomScan.Click      += customScanBtnOnClick;
            mainPanelRightClickMenu.Items.AddRange(new ToolStripItem[] { openProtectionPanel, openAllScan, openFastScan, openCustomScan });
            this.ContextMenuStrip = mainPanelRightClickMenu;
        }
        private WechatForm()
        {
            InitializeComponent();
            Icon                  = Properties.Resources.icon_main_icon;
            Text                  = Properties.Resources.ProductionName;
            MouseDown            += MouseDownMove;
            titleLabel.MouseDown += MouseDownMove;

            //AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
            //Width = 230;
            //Height = 320;
            _testLabel          = new Label();
            _testLabel.Location = new Point(230, 0);
            _testLabel.Text     = "测试";
            Controls.Add(_testLabel);

            tipLabel.Font      = new System.Drawing.Font("微软雅黑", 16, GraphicsUnit.Pixel);
            tipLabel.ForeColor = Color.FromArgb(0x4f, 0xb5, 0x2c);

            _whyLabel           = new TextButton();
            _whyLabel.Text      = "为什么要绑定?";
            _whyLabel.AutoSize  = true;
            _whyLabel.Font      = new System.Drawing.Font("微软雅黑", 12, GraphicsUnit.Pixel);
            _whyLabel.ForeColor = Color.FromArgb(0x4f, 0xb5, 0x2c);
            Controls.Add(_whyLabel);
            _whyLabel.Location = new Point(Width / 2 - _whyLabel.Width / 2,
                                           tipLabel.Location.Y + tipLabel.Height);
            _whyLabel.Click += _whyLabelOnClick;
            //ToolTip whyTip = new ToolTip();
            //whyTip.SetToolTip(_whyLabel,
            //    "绑定以后,非绑定者将无法设置软件");

            _refreshButton           = new TextButton();
            _refreshButton.Text      = "刷新二维码";
            _refreshButton.Font      = new System.Drawing.Font("微软雅黑", 12, GraphicsUnit.Pixel);
            _refreshButton.ForeColor = Color.FromArgb(0x4f, 0xb5, 0x2c);
            Controls.Add(_refreshButton);
            _refreshButton.Location = new Point(Width / 2 - _refreshButton.Width / 2,
                                                _whyLabel.Location.Y + _whyLabel.Height);
            _refreshButton.Click += _refreshButtonOnClick;

            _closeBackImage                 = new Panel();
            _closeBackImage.BackColor       = Color.Transparent;
            _closeBackImage.BackgroundImage = Properties.Resources.login_btn_Close_n;
            _closeBackImage.Size            = _closeBackImage.BackgroundImage.Size;
            _closeBackImage.Location        = new Point(Width - _closeBackImage.Width, 0);
            Controls.Add(_closeBackImage);

            _closeBtn = new Label();
            //_closeBtn.BackColor = Color.Red;
            _closeBtn.Width    = _closeBtn.Height = 24;
            _closeBtn.Location = new Point(_closeBackImage.Width - 4 - _closeBtn.Width, 4);
            _closeBackImage.Controls.Add(_closeBtn);
            _closeBtn.MouseEnter += _closeBtnOnMouseEnter;
            _closeBtn.MouseLeave += _closeBtnOnMouseLeave;
            _closeBtn.MouseDown  += _closeBtnOnMouseDown;
            _closeBtn.MouseUp    += _closeBtnOnMouseUp;
            _closeBtn.Click      += _closeBtnOnClick;
            tipLabel.SizeChanged += tipLabelOnSizeChanged;

            Font = new System.Drawing.Font("微软雅黑", 12, GraphicsUnit.Pixel);
        }