コード例 #1
0
ファイル: DirectUI.cs プロジェクト: zyj0021/WinformSkin
        private void layeredButton3_Click(object sender, EventArgs e)
        {
            DuiCheckBox   checkbox = new DuiCheckBox();
            DuiPictureBox pic      = new DuiPictureBox()
            {
                SizeMode = PictureBoxSizeMode.AutoSize, Image = smile
            };

            layeredBaseControl1.InnerDuiControl.FindControl("TextBox多行")[0].Controls.Add(checkbox);
            layeredBaseControl1.InnerDuiControl.FindControl("TextBox多行")[0].Controls.Add(pic);
            ((DuiTextBox)layeredBaseControl1.InnerDuiControl.FindControl("TextBox多行")[0]).LayoutContent();
        }
コード例 #2
0
ファイル: SetForm.cs プロジェクト: sunkejava/MaiinTimer
        private void setDefaultStyle()
        {
            this.BackColor = Color.FromArgb(185, pes.pes.BackColor);
            if (pes.BackGroundSkin != null)
            {
                BackGroundSkin = pes.BackGroundSkin;
                this.BackColor = Color.Transparent;
            }
            btn_point.BaseColor = Color.Red;
            btn_cg.ForeColor    = Color.FromArgb(255, pes.pes.BackColor);
            layeredPanel_cg.BringToFront();
            //常规界面相关处理
            foreach (DuiBaseControl item in layeredPanel_cg.DUIControls)
            {
                switch (item.Name)
                {
                case "ck_qd":
                    Ck_AutoStart = item as DuiCheckBox;
                    Ck_AutoStart.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_AutoStart.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_AutoStart.CheckedChanged += Ck_AutoStart_CheckedChanged;
                    Ck_AutoStart.Checked         = pes.pes.AutoStart;
                    break;

                case "rd_min":
                case "rd_close":
                    RadioButton_CloseMode = item as DuiRadioButton;
                    RadioButton_CloseMode.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_CloseMode.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_CloseMode.CheckedChanged += RadioButton_CloseMode_CheckedChanged;
                    if ((pes.pes.CloseMode == "isClose") && RadioButton_CloseMode.Name == "rd_close")
                    {
                        (item as DuiRadioButton).Checked = true;
                    }
                    else if ((pes.pes.CloseMode == "isMin") && RadioButton_CloseMode.Name == "rd_min")
                    {
                        (item as DuiRadioButton).Checked = true;
                    }
                    else
                    {
                        (item as DuiRadioButton).Checked = false;
                    }
                    break;

                case "":

                    break;

                default:
                    break;
                }
            }
            //壁纸切换界面相关处理
            foreach (DuiBaseControl item in layeredPanel_qhbz.DUIControls)
            {
                switch (item.Name)
                {
                case "ck_qd":
                    Ck_IsSwitchWallpaper = item as DuiCheckBox;
                    Ck_IsSwitchWallpaper.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_IsSwitchWallpaper.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    Ck_IsSwitchWallpaper.Checked         = pes.pes.IsSwitchWallpaper;
                    Ck_IsSwitchWallpaper.CheckedChanged += Ck_IsSwitchWallpaper_CheckedChanged;
                    break;

                case "db_timedw":
                    ComboBox_InterValTimeUnit                       = item as DuiComboBox;
                    ComboBox_InterValTimeUnit.BackColor             = Color.FromArgb(155, pes.pes.BackColor);
                    ComboBox_InterValTimeUnit.SelectedIndexChanged += ComboBox_InterValTimeUnit_SelectedIndexChanged;
                    if (pes.pes.InterValTime < 60)
                    {
                        ComboBox_InterValTimeUnit.SelectedIndex = 0;
                        TextBox_InterValTime.Text = pes.pes.InterValTime.ToString();
                    }
                    else if (pes.pes.InterValTime < 3600)
                    {
                        ComboBox_InterValTimeUnit.SelectedIndex = 1;
                        TextBox_InterValTime.Text = (pes.pes.InterValTime / 60).ToString();
                    }
                    else
                    {
                        ComboBox_InterValTimeUnit.SelectedIndex = 2;
                        TextBox_InterValTime.Text = (pes.pes.InterValTime / 3600).ToString();
                    }
                    break;

                case "tb_timeStr":
                    TextBox_InterValTime              = item as DuiTextBox;
                    TextBox_InterValTime.BackColor    = Color.FromArgb(155, pes.pes.BackColor);
                    TextBox_InterValTime.AutoHeight   = true;
                    TextBox_InterValTime.Invalidated += TextBox_InterValTime_TextChanged;
                    //TextBox_InterValTime.Text = pes.pes.InterValTime.ToString();
                    break;

                default:
                    if (item is DuiButton && item.Name.Contains("btn_"))
                    {
                        DuiButton Button_SwitchWallpaperType = item as DuiButton;
                        Button_SwitchWallpaperType.Cursor          = System.Windows.Forms.Cursors.Hand;
                        Button_SwitchWallpaperType.MouseClick     += Button_SwitchWallpaperType_MouseClick;
                        Button_SwitchWallpaperType.BaseColor       = Color.Transparent;
                        Button_SwitchWallpaperType.BackgroundImage = Properties.Resources.btn_n;
                        Button_SwitchWallpaperType.IsPureColor     = false;
                        Button_SwitchWallpaperType.Tag             = false.ToString();
                        foreach (var WallpaperType in pes.pes.SwitchWallpaperTypes)
                        {
                            if (item.Name.Replace("btn_", "") == WallpaperType.ToString())
                            {
                                Button_SwitchWallpaperType.Tag             = true.ToString();
                                Button_SwitchWallpaperType.BackgroundImage = Properties.Resources.btn_select_n;
                            }
                        }
                        Button_SwitchWallpaperType.BackgroundImageLayout = ImageLayout.Stretch;
                    }
                    break;
                }
            }
            //下载设置界面相关处理
            foreach (DuiBaseControl item in layeredPanel_xzsz.DUIControls)
            {
                switch (item.Name)
                {
                case "rd_SizeForThumb":
                case "rd_SizeFor1600900":
                case "rd_SizeFor1440900":
                case "rd_SizeFor12801024":
                case "rd_SizeFor1024768":
                case "rd_SizeFor1280800":
                    RadioButton_picSize = item as DuiRadioButton;
                    RadioButton_picSize.CheckFlagColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_picSize.CheckRectColor  = Color.FromArgb(155, pes.pes.BackColor);
                    RadioButton_picSize.CheckedChanged += RadioButton_picSize_CheckedChanged;
                    if ("rd_SizeFor" + (pes.pes.PicSize == "default" ? "Thumb" : pes.pes.PicSize) == item.Name)
                    {
                        RadioButton_picSize.Checked = true;
                    }
                    else
                    {
                        RadioButton_picSize.Checked = false;
                    }
                    break;

                case "text_downloadPath":
                    lb_downloadPath           = item as DuiTextBox;
                    lb_downloadPath.BackColor = Color.FromArgb(155, pes.pes.BackColor);
                    lb_downloadPath.Text      = (String.IsNullOrEmpty(pes.pes.DownloadPath) ? AppDomain.CurrentDomain.BaseDirectory + @"ImageWallpaper\" : pes.pes.DownloadPath);
                    break;

                case "btn_selectDownloadPath":
                    btn_selectDownloadPath             = item as DuiButton;
                    btn_selectDownloadPath.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_selectDownloadPath.MouseClick += Btn_selectDownloadPath_MouseClick;
                    break;

                case "text_cachePath":
                    lb_cachePath           = item as DuiTextBox;
                    lb_cachePath.BackColor = Color.FromArgb(155, pes.pes.BackColor);
                    lb_cachePath.Text      = (String.IsNullOrEmpty(pes.pes.CachePath) ? AppDomain.CurrentDomain.BaseDirectory + @"CacheWallpaper\" : pes.pes.CachePath);
                    if (lb_nowCacheSize != null && lb_cachePath != null)
                    {
                        lb_nowCacheSize.Text = "当前缓存:" + GetDirectoryLength(lb_cachePath.Text) / (1024 * 1024) + "MB";
                    }

                    break;

                case "btn_selectCachePath":
                    btn_selectCachePath             = item as DuiButton;
                    btn_selectCachePath.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_selectCachePath.MouseClick += Btn_selectCachePath_MouseClick;
                    break;

                case "lb_nowCacheSize":
                    lb_nowCacheSize = item as DuiLabel;
                    if (lb_cachePath != null && lb_nowCacheSize != null)
                    {
                        lb_nowCacheSize.Text = "当前缓存:" + GetDirectoryLength(lb_cachePath.Text) / (1024 * 1024) + "MB";
                    }
                    break;

                case "lb_clearCache":
                    lb_clearCache             = item as DuiLabel;
                    lb_clearCache.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_clearCache.MouseClick += Lb_clearCache_MouseClick;
                    break;

                default:
                    break;
                }
            }
            //关于界面相关处理
            foreach (DuiBaseControl item in layeredPanel_gy.DUIControls)
            {
                switch (item.Name)
                {
                case "lb_ver":
                    lb_ver      = item as DuiLabel;
                    lb_ver.Text = pes.pes.VerNo;
                    break;

                case "btn_update":
                    btn_update             = item as DuiButton;
                    btn_update.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_update.BaseColor   = Color.FromArgb(155, pes.pes.BackColor);
                    btn_update.MouseClick += Btn_update_MouseClick;
                    break;

                case "btn_sendyj":
                    btn_sendyj             = item as DuiButton;
                    btn_sendyj.Cursor      = System.Windows.Forms.Cursors.Hand;
                    btn_sendyj.BaseColor   = Color.FromArgb(155, pes.pes.BackColor);
                    btn_sendyj.MouseClick += Btn_sendyj_MouseClick;
                    break;

                case "lb_mxnr1":
                    lb_mxnr1             = item as DuiLabel;
                    lb_mxnr1.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_mxnr1.MouseClick += Lb_mxnr1_MouseClick;
                    break;

                case "lb_mxnr2":
                    lb_mxnr2             = item as DuiLabel;
                    lb_mxnr2.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_mxnr2.MouseClick += Lb_mxnr1_MouseClick;
                    break;

                case "lb_zzemail":
                    lb_zzemail             = item as DuiLabel;
                    lb_zzemail.Cursor      = System.Windows.Forms.Cursors.Hand;
                    lb_zzemail.MouseClick += Lb_zzemail_MouseClick;
                    break;

                default:
                    break;
                }
            }
        }