private void Button_MouseLeave(object sender, EventArgs e) { MyNormalButton pan = (MyNormalButton)sender; object g = pan.Tag; if (g != null) { int hj = (int)g; Control oo = flowLayoutPanel_installedskins.Controls[hj]; Panel ooo = (Panel)oo; ooo.BackColor = Color.White; } }
private void ClickBtn(object sender, EventArgs e) { MyNormalButton n = (MyNormalButton)sender; object jp = n.Tag; try { if (jp != null) { string[] pp = (string[])jp; string cmd = pp[0]; string arg = pp[1]; if (SGFunction.FileSystemOperate.FileSystemOperate_GetFileExists(cmd) == true) { SGFunction.SystemFunctionAndInformation.ShellPrograms(cmd, arg, false, false, true, false); } else { SGFunction.CommonDialogs.MessageDialog_ShowInfo("无法启动这个工具,因为该工具不存在", 2); } } } catch { } }
public SGForm_TasksChoose(string title, string[] tasks, string ico) { InitializeComponent(); //SKIN Color dialog_stand_bd = SGFunction.Skins.Skins_GetControlColorSetting("DIALOG_STANDARD", "bd"); Color dialog_stand_title_fr = SGFunction.Skins.Skins_GetControlColorSetting("DIALOG_STANDARD", "title_fr"); Color dialog_stand_title_bk = SGFunction.Skins.Skins_GetControlColorSetting("DIALOG_STANDARD", "TITLE_BK"); Color dialog_stand_bk = SGFunction.Skins.Skins_GetControlColorSetting("DIALOG_STANDARD", "BK"); // Color mainc = SGFunction.Skins.Skins_GetMainColorSetting("maincolor", "defaultcolor"); Color mainpanel = SGFunction.Skins.Skins_GetControlColorSetting("SGTAB", "PC");;; Color o_bk = SGFunction.Skins.Skins_GetControlColorSetting("btn_other", "bk"); Color o_fr = SGFunction.Skins.Skins_GetControlColorSetting("btn_other", "fr"); Color o1_bk = SGFunction.Skins.Skins_GetControlColorSetting("btn_other1", "bk"); Color o1_fr = SGFunction.Skins.Skins_GetControlColorSetting("btn_other1", "fr"); Color lab_ma_fr = SGFunction.Skins.Skins_GetControlColorSetting("label_maininfo", "fr"); Color lab_fu_fr = SGFunction.Skins.Skins_GetControlColorSetting("label_funinfo", "fr"); panel1.BackColor = dialog_stand_bd; MyNormalButton1.BackColor = dialog_stand_title_bk; this.BackColor = dialog_stand_bk; label_title.ForeColor = dialog_stand_title_fr; //load flowLayoutPanel1.Controls.Clear(); this.Text = label_title.Text = title; bool isallico = true; string[] arr = ico.Split('|'); Image r = null; if (arr != null) { if (arr.Length == tasks.Length) { isallico = false; } } //图标选项 if (isallico == true) { r = SGFunction.ImageAndIconOperate.LoadIconsFormResourcesFileIcon(ico); } for (int j = 1; j <= tasks.Length; j++) { MyNormalButton p = new MyNormalButton(); p.BackColor = this.BackColor; p.Font = new System.Drawing.Font(this.Font.FontFamily, 10f, FontStyle.Bold); p.Size = new System.Drawing.Size(flowLayoutPanel1.Width - 5, 40); p.Text = " " + tasks[j - 1]; p.ForeColor = lab_ma_fr; p.ImageAlign = p.TextAlign = ContentAlignment.MiddleLeft; if (isallico == false) { r = SGFunction.ImageAndIconOperate.LoadIconsFormResourcesFileIcon(arr[j - 1]); } p.Image = r; p.Tag = j.ToString(); p.Click += new EventHandler(this.MyNormalButton1_OnButtonClick); //add flowLayoutPanel1.Controls.Add(p); } }
private void loadinstalledskins() { flowLayoutPanel_installedskins.Controls.Clear(); string cfg = SGFunction.SpecialFoldersOrFile.GetSystemGearSpecialFolderOrFile("config") + "\\skins.sgcf"; string[] values; string[] keys; int count = SGFunction.ConfigFileOperate.CFGOperate_GetAllKeyValues("installedskins", out keys, out values, cfg, true); //获取当前的主题文件 string currentskinfile_file = SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue("main", "select_skin", "", cfg, true); string currentskinfile_name = SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue("info", "name", "", currentskinfile_file, false); if (count >= 1) { for (int o = 1; o <= count; o++) { string skincfg = values[o - 1]; string skincfg_old = skincfg; skincfg = SGFunction.PathOperate.ConvertStringToTurePath(skincfg, skincfg); string skin_name = SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue("info", "name", "", skincfg, true); string skin_color_str = SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue("info", "color_default", "", skincfg, true); Color skin_color_rgb = SGFunction.ColorOperate.GetColorFromStr(skin_color_str); Image skin_selectimg_image = null; string skin_selectimg = SGFunction.SpecialFoldersOrFile.GetSystemGearSpecialFolderOrFile("skins") + "\\" + SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue("info", "select_showimages", "", skincfg, false); if (SGFunction.FileSystemOperate.FileSystemOperate_GetFileExists(skin_selectimg) == true) { try { skin_selectimg_image = Image.FromFile(skin_selectimg); } catch { skin_selectimg_image = null; } } Panel pan = new Panel(); MyNormalButton my = new MyNormalButton(); SGLabel lab = new SGLabel(); ///// pan.Size = new Size(189, 135); //// lab.AutoSize = false; lab.TextAlign = ContentAlignment.MiddleCenter; lab.ForeColor = skin_color_rgb; lab.Text = skin_name; lab.Font = new System.Drawing.Font("微软雅黑", 9f, FontStyle.Bold); ///// pan.Controls.Add(lab); ///// lab.Dock = DockStyle.Bottom; /////////// my.Size = new System.Drawing.Size(189, 115); my.Location = new Point(0, 0); my.BackgroundImage = skin_selectimg_image; pan.Controls.Add(my); flowLayoutPanel_installedskins.Controls.Add(pan); //eent pan.MouseMove += new MouseEventHandler(this.Panel_MouseMove); pan.MouseLeave += new EventHandler(this.Panel_MouseLeave); lab.MouseLeave += new EventHandler(SGLabel_MouseLeave); lab.MouseMove += new MouseEventHandler(SGLabel_MouseMove); //my.MouseMove +=new MouseEventHandler(this.Button_MouseMove ); // my.MouseLeave +=new EventHandler(this.Button_MouseLeave ); my.Click += new EventHandler(this.Button_MouseClick); lab.Click += new EventHandler(this.SgLabel_MouseClick); int panindex = flowLayoutPanel_installedskins.Controls.Count - 1; //is current if (skin_name.ToUpper() == currentskinfile_name.ToUpper()) { my.Image = SystemGear.Properties.Resources.SkinSelected; //top tip this.toolTip1.SetToolTip(my, @"您已经选择该主题:""" + skin_name + @""""); this.toolTip1.SetToolTip(pan, @"您已经选择该主题:""" + skin_name + @""""); this.toolTip1.SetToolTip(lab, @"您已经选择该主题:""" + skin_name + @""""); currentindex = panindex; } else { my.Image = null; //top tip this.toolTip1.SetToolTip(my, @"单击左键选择该主题:""" + skin_name + @""""); this.toolTip1.SetToolTip(pan, @"单击左键选择该主题:""" + skin_name + @""""); this.toolTip1.SetToolTip(lab, @"单击左键选择该主题:""" + skin_name + @""""); } my.Cursor = Cursors.Hand; pan.Cursor = Cursors.Hand; lab.Cursor = Cursors.Hand; //TAG my.Tag = panindex; lab.Tag = panindex; skins_files.Add(skincfg_old); } } else { //no installed } }
private void Button_MouseClick(object sender, EventArgs e) { MyNormalButton pan = (MyNormalButton)sender; if (pan.Image != null) { SGFunction.CommonDialogs.MessageDialog_ShowInfo("您已经选择该主题了哦", 2); return; } object g = pan.Tag; if (g != null) { int hj = (int)g; string skfile = skins_files[hj]; string skfile_old = skfile; skfile = SGFunction.PathOperate.ConvertStringToTurePath(skfile, skfile); SGFunction.Skins._SKINSCONFIG = skfile; //MessageBox.Show(skfile); if (sgfrm != null) { if (mainfrm == null) { SGSystemStyle.LoadSkin.LoadColorSetting(sgfrm); sgfrm.sgItems1.Settings_ChooseItemsIndex = sgfrm.sgItems1.Settings_ChooseItemsIndex; } else { SGSystemStyle.LoadSkin.LoadColorSetting(sgfrm); SystemGear.类或代码.SGMain.Skins.LoadSkins(mainfrm); mainfrm.sgItems1.Settings_ChooseItemsIndex = mainfrm.sgItems1.Settings_ChooseItemsIndex; sgfrm.sgItems1.Settings_ChooseItemsIndex = sgfrm.sgItems1.Settings_ChooseItemsIndex; //绘制ALLFUNCTION 防止颜色出错 SystemGear.类或代码.SGMain.Skins.DrawAllClassFunctionsTile(mainfrm); } //绘制颜色 重新修改配置 Form ff = this.FindForm(); SystemGear.窗体.SGForm_GuidDialog gg = (SystemGear.窗体.SGForm_GuidDialog)ff; //MessageBox.Show(gg.Text); gg.DrawSkin(); this.DrawSkin(); string cfg = SGFunction.SpecialFoldersOrFile.GetSystemGearSpecialFolderOrFile("config") + "\\skins.sgcf"; SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("main", "select_skin", skfile_old, "Config", false, cfg); this.loadinstalledskins(); } else { if (sgfrm == null) { if (mainfrm == null) { //SGSystemStyle.LoadSkin.LoadColorSetting(sgfrm); ///SystemGear.类或代码.SGMain.Skins.LoadSkins(mainfrm); } else { //SGSystemStyle.LoadSkin.LoadColorSetting(sgfrm); SystemGear.类或代码.SGMain.Skins.LoadSkins(mainfrm); mainfrm.sgItems1.Settings_ChooseItemsIndex = mainfrm.sgItems1.Settings_ChooseItemsIndex; //mainfrm.sgTabPageControl_allfunction.SelectedIndex = 0; //mainfrm.RUNONCE_ALLFUNCTION = false; //绘制ALLFUNCTION 防止颜色出错 SystemGear.类或代码.SGMain.Skins.DrawAllClassFunctionsTile(mainfrm); //绘制颜色 重新修改配置 Form ff = this.FindForm(); SystemGear.窗体.SGForm_GuidDialog gg = (SystemGear.窗体.SGForm_GuidDialog)ff; //MessageBox.Show(gg.Text); gg.DrawSkin(); this.DrawSkin(); string cfg = SGFunction.SpecialFoldersOrFile.GetSystemGearSpecialFolderOrFile("config") + "\\skins.sgcf"; SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("main", "select_skin", skfile_old, "Config", false, cfg); this.loadinstalledskins(); } } } } }
void LoadTools() { //COLOR Color sgtab_af_fr = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "fr"); Color sgtab_af_bk = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "bk"); Color sgtab_af_sb = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "sb"); Color sgtab_af_sf = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "sf"); Color sgtab_af_uc = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "uc"); Color sgtab_af_suc = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "suc"); Color sgtab_af_bd = SGFunction.Skins.Skins_GetControlColorSetting("sgtab_allfunctions", "bd"); this.sgTabPageControl1.SGCS_Style = "light"; this.sgTabPageControl1.SGCS_Light_FontColor = sgtab_af_fr; this.sgTabPageControl1.SGCS_Light_BackColor = sgtab_af_bk; this.sgTabPageControl1.SGCS_Light_SelectFontColor = sgtab_af_sf; this.sgTabPageControl1.SGCS_Light_SelectUnderLineColor = sgtab_af_suc; this.sgTabPageControl1.SGCS_Light_UnderLineColor = sgtab_af_uc; // sgTabPageControl1.TabPages.Clear(); string cfg = SGFunction.SpecialFoldersOrFile.GetSystemGearSpecialFolderOrFile("CONFIG") + "\\SystemTools.SGCF"; string readjie = SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue("systemtoolbox", "NT" + SGFunction.SystemFunctionAndInformation.GetOSVersion(), "", cfg, false); if (readjie != "") { try { string[] jies = readjie.Split('|'); int jj = jies.Length; //MessageBox.Show(jj.ToString()); int size_w = sgTabPageControl1.ItemSize.Width * jj; this.Size = new Size(size_w, this.Size.Height); //MessageBox.Show(size_w.ToString()); sgTabPageControl1.Size = new Size(size_w + 100 + 2, sgTabPageControl1.Height); //MessageBox.Show(sgTabPageControl1.Size.Width .ToString()); for (int u = 1; u <= jies.Length; u++) { string jiename = SGFunction.ConfigFileOperate.SGCFFileOperate_GetValue(jies[u - 1], "mainname", "", cfg, false); TabPage newpage = new TabPage(jiename); newpage.BackColor = SGFunction.Skins.Skins_GetControlColorSetting("sgtab", "pc"); newpage.AutoScroll = true; //MessageBox.Show(newpage.Size.Width.ToString()); sgTabPageControl1.TabPages.Add(newpage); //添加FL //tagpage.AutoScroll = true; FlowLayoutPanel fl = new FlowLayoutPanel(); fl.AutoScroll = true; newpage.Controls.Add(fl); fl.Size = new System.Drawing.Size(newpage.Size.Width - 75, newpage.Size.Height); fl.Location = new Point(0, 0); string[] keys, valus; SGFunction.ConfigFileOperate.CFGOperate_GetAllKeyValues(jies[u - 1], out keys, out valus, cfg, true); for (int j = 1; j <= keys.Length; j++) { if (keys[j - 1].ToUpper() != "MAINNAME") { MyNormalButton btn = new MyNormalButton(); fl.Controls.Add(btn); btn.Margin = new Padding(0, 0, 0, 0); btn.Size = new Size(70, 100); btn.ImageAlign = ContentAlignment.TopCenter; btn.BackColor = Color.White; btn.TextAlign = ContentAlignment.BottomCenter; btn.Font = new System.Drawing.Font("微软雅黑", 8f, FontStyle.Bold); btn.ForeColor = SGFunction.Skins.Skins_GetMainColorSetting("maincolor", "defaultcolor"); string cmdread = valus[j - 1]; string ico = "%windir%\\system32\\imageres.dll,11"; string cmd = "", arg = ""; string name = ""; string runtype = "NO"; if (cmdread != "") { string[] rs = cmdread.Split('|'); if (rs != null) { if (rs.Length == 4) { name = rs[0]; cmd = rs[1]; ico = rs[2]; arg = rs[3]; if (name.Length > 3) { runtype = name.Substring(0, name.IndexOf(",")); name = name.Substring(name.IndexOf(",") + 1, name.Length - name.IndexOf(",") - 1); } } } } //显示图标 //变量 name = SGFunction.PathOperate.ConvertStringToTurePath(name, name); ico = SGFunction.PathOperate.ConvertStringToTurePath(ico, ico); cmd = SGFunction.PathOperate.ConvertStringToTurePath(cmd, cmd); //DISPLAY btn.Text = name; btn.Image = SGFunction.ImageAndIconOperate.LoadIconsFormResourcesFileIcon(ico, "%SYSTEMROOT%\\SYSTEM32\\IMAGERES.DLL,11"); string[] iu = new string[] { cmd, arg, ico, runtype }; btn.Tag = iu; btn.Click += new EventHandler(this.ClickBtn); btn.ContextMenuStrip = this.sgRightMenus1; btn.MouseDown += new MouseEventHandler(this.MouseDownBtn); } } } //MessageBox.Show(sgTabPageControl1.TabPages[0].Size.Width.ToString()); } catch { sgTabPageControl1.TabPages.Clear(); } } }
private void MouseDownBtn(object sender, MouseEventArgs e) { se = (MyNormalButton)sender; }
public SGUserControl_HelpUserToDo(string[] images, string[] texts, string title, string cfg, string b1, string b2, bool rem) { InitializeComponent(); sgCheckBox1.Checked = sgCheckBox1.Visible = rem; // this.FindForm().TopMost = true; //skin panel1.BackColor = SGFunction.Skins.Skins_GetMainColorSetting("maincolor", "light"); flowLayoutPanel1.BackColor = SGFunction.Skins.Skins_GetControlColorSetting("dialog_standard", "bk"); sgCheckBox1.ForeColor = SGFunction.Skins.Skins_GetControlColorSetting("checkbox", "fr"); MyNormalButton1.BackColor = MyNormalButton2.BackColor = SGFunction.Skins.Skins_GetControlColorSetting("btn_other", "bk"); MyNormalButton1.ForeColor = MyNormalButton2.ForeColor = SGFunction.Skins.Skins_GetControlColorSetting("btn_other", "fr"); //code flowLayoutPanel1.Controls.Clear(); this.cfg = cfg; for (int p = 1; p <= images.Length; p++) { Panel pan = new Panel(); pan.Size = new Size(345, 205); MyNormalButton btn = new MyNormalButton(); PictureBox pic = new PictureBox(); pic.SizeMode = PictureBoxSizeMode.StretchImage; pic.Size = new System.Drawing.Size(345, 158); if (System.IO.File.Exists(images[p - 1]) == true) { pic.Image = System.Drawing.Image.FromFile(images[p - 1]); } btn.Size = new Size(345, 45); btn.ImageAlign = ContentAlignment.MiddleLeft; btn.Font = new Font("微软雅黑", 9f, FontStyle.Bold); btn.Text = texts[p - 1]; btn.Tag = p.ToString(); btn.TextImageRelation = TextImageRelation.ImageBeforeText; btn.Click += new EventHandler(this.MyNormalButton3_Click); btn.BackColor = SGFunction.Skins.Skins_GetControlColorSetting("BTN_OTHER", "BK"); btn.ForeColor = SGFunction.Skins.Skins_GetControlColorSetting("btn_other", "fr"); switch (p) { case 1: btn.Image = Properties.Resources.ToDoTip_1; break; case 2: btn.Image = Properties.Resources.ToDoTip_2; break; case 3: btn.Image = Properties.Resources.ToDoTip_3; break; case 4: btn.Image = Properties.Resources.ToDoTip_4; break; case 5: btn.Image = Properties.Resources.ToDoTip_5; break; default: btn.Image = Properties.Resources.ToDoTip_1; break; } btn.Cursor = System.Windows.Forms.Cursors.Hand; btn.Location = new Point(0, 0); pic.Location = new Point(0, 47); pan.Controls.Add(btn); pan.Controls.Add(pic); flowLayoutPanel1.Controls.Add(pan); if (b1 != "") { MyNormalButton1.Visible = true; MyNormalButton1.Text = b1; } else { MyNormalButton1.Visible = false; } if (b2 != "") { MyNormalButton2.Visible = true; MyNormalButton2.Text = b2; } else { MyNormalButton2.Visible = false; } } }