コード例 #1
0
        private FormStart()
        {
            InitializeComponent();

            var styleSettings = new StartFormStyleConfiguration();

            styleSettings.Load(Path.Combine(ResourceManager.Instance.AppRootFolderPath, "sync_color.xml"));
            BackColor                        = panelCancel.BackColor = styleSettings.SyncBorderColor ?? BackColor;
            panelMain.BackColor              = panelCancelInner.BackColor = styleSettings.SyncBackColor ?? panelMain.BackColor;
            laTitle.ForeColor                = laDetails.ForeColor = styleSettings.SyncTextColor ?? laTitle.ForeColor;
            circularProgress.ProgressColor   = styleSettings.SyncCircleColor ?? circularProgress.ProgressColor;
            circularProgress.ProgressBarType = (DevComponents.DotNetBar.eCircularProgressType)((styleSettings.SyncCircleStyle ?? 2) - 1);
            circularProgress.AnimationSpeed  = styleSettings.SyncCircleSpeed ?? 150;

            var cancelLogoPath = Path.Combine(ResourceManager.Instance.AppRootFolderPath, "ProgressCancel.png");

            if (File.Exists(cancelLogoPath))
            {
                var tempPath = Path.GetTempFileName();
                File.Copy(cancelLogoPath, tempPath, true);
                pbCancel.Image = Image.FromFile(tempPath);
            }

            var iconPath = Path.Combine(ResourceManager.Instance.AppRootFolderPath, "icon.ico");

            if (File.Exists(iconPath))
            {
                var tempPath = Path.GetTempFileName();
                File.Copy(iconPath, tempPath, true);
                notifyIcon.Icon = new Icon(tempPath);
            }

            if ((CreateGraphics()).DpiX > 96)
            {
                laTitle.Font   = new Font(laTitle.Font.FontFamily, laTitle.Font.Size - 2, laTitle.Font.Style);
                laDetails.Font = new Font(laDetails.Font.FontFamily, laDetails.Font.Size - 2, laDetails.Font.Style);
            }

            Left = Screen.PrimaryScreen.WorkingArea.Width - Width - 20;
            Top  = Screen.PrimaryScreen.WorkingArea.Height - Height - 20;

            pbCancel.MouseDown += (o, e) =>
            {
                var pic = (PictureBox)(o);
                pic.Top += 1;
            };

            pbCancel.MouseUp += (o, e) =>
            {
                var pic = (PictureBox)(o);
                pic.Top -= 1;
            };

            notifyIcon.Text               = PopupMessageHelper.Instance.Title;
            notifyIcon.BalloonTipText     = PopupMessageHelper.Instance.Title;
            toolStripMenuItemKillApp.Text = String.Format(toolStripMenuItemKillApp.Text, PopupMessageHelper.Instance.Title);
        }
コード例 #2
0
        private FormDownloadProgress()
        {
            InitializeComponent();

            var styleSettings = new StartFormStyleConfiguration();

            styleSettings.Load(Path.Combine(ResourceManager.Instance.AppRootFolderPath, "sync_color.xml"));

            BackColor                        = styleSettings.SyncBorderColor ?? BackColor;
            panelMain.BackColor              = styleSettings.SyncBackColor ?? panelMain.BackColor;
            laTitle.ForeColor                = laDetails.ForeColor = styleSettings.SyncTextColor ?? laTitle.ForeColor;
            circularProgress.ProgressColor   = styleSettings.SyncCircleColor ?? circularProgress.ProgressColor;
            circularProgress.ProgressBarType = (DevComponents.DotNetBar.eCircularProgressType)((styleSettings.SyncCircleStyle ?? 2) - 1);
            circularProgress.AnimationSpeed  = styleSettings.SyncCircleSpeed ?? 150;
        }