private void Refresh_Searches() { List <object[]> searches = Mdb.GetSearches(); for (int i = toolStripDropDownButton2.DropDownItems.Count - 3; i >= 0; i--) { toolStripDropDownButton2.DropDownItems.RemoveAt(i); } foreach (object[] search in searches) { string imgPath = search[1].ToString() == "" ? "" : ((((string)search[1])[1] == ':' ? "" : Application.StartupPath + @"\") + (string)search[1]); ToolStripMenuItem item = new ToolStripMenuItem((string)search[0], File.Exists(imgPath)?Image.FromFile(imgPath):imageList2.Images[1]); item.Tag = string.Format("{0}</>{1}</>{2}", search[0], search[1], search[2]); item.Click += new EventHandler(item_Click); toolStripDropDownButton2.DropDownItems.Insert(toolStripDropDownButton2.DropDownItems.Count - 2, item); } string[] searchInfos = Mdb.GetOther("searchInfo").Split(new string[] { "</>" }, StringSplitOptions.RemoveEmptyEntries); toolStripDropDownButton2.Text = searchInfos[0]; toolStripDropDownButton2.Image = File.Exists(searchInfos[1]) ? Image.FromFile(searchInfos[1]) : imageList2.Images[1]; toolStripDropDownButton2.Tag = searchInfos[2]; }
private void 收藏夹SToolStripMenuItem_Click(object sender, EventArgs e) { panel1.Visible = splitter1.Visible = 收藏夹SToolStripMenuItem.Checked; Mdb.SetOther("collectionStyle", 收藏夹SToolStripMenuItem.Checked ? "1" : "0"); if (收藏夹SToolStripMenuItem.Checked) { 收藏BToolStripMenuItem_DropDownOpening(null, null); Application.DoEvents(); 历史记录HToolStripMenuItem.Checked = false; panel1.Width = int.Parse(Mdb.GetOther("collectionWidth")); if (treeView1.Nodes.Count == 0) { for (int i = 3; i < 收藏BToolStripMenuItem.DropDownItems.Count; i++) { string tag = (string)收藏BToolStripMenuItem.DropDownItems[i].Tag; if (tag != "folder") { TreeNode node = new TreeNode(收藏BToolStripMenuItem.DropDownItems[i].Text, 2, 2); node.Tag = tag; treeView1.Nodes.Add(node); } else { TreeNode nodex = new TreeNode(收藏BToolStripMenuItem.DropDownItems[i].Text, 1, 1); nodex.Tag = tag; treeView1.Nodes.Add(nodex); foreach (ToolStripMenuItem item in ((ToolStripMenuItem)收藏BToolStripMenuItem.DropDownItems[i]).DropDownItems) { TreeNode nodey = new TreeNode(item.Text, 2, 2); nodey.Tag = item.Tag; nodex.Nodes.Add(nodey); } } } } treeView1.BringToFront(); } }
private void Form1_Load(object sender, EventArgs e) { toolStripButton9.Image = imageList1.Images[0]; toolStripButton19.Image = imageList1.Images[0]; toolStripStatusLabel3.Image = imageList2.Images[1]; toolStripStatusLabel1.Image = imageList1.Images[0]; //读取自身收藏夹 //ReadMyFav(); //读取皮肤 skin.SkinFile = Application.StartupPath + @"\skin.ssk"; Application.DoEvents(); //设置任务栏位置 toolStrip3.Dock = Mdb.GetOther("taskbarStyle") == "top" ? DockStyle.Top : DockStyle.Bottom; //设置搜索器 Refresh_Searches(); //设置收藏夹样式 if (Mdb.GetOther("collectionStyle") == "1") { toolStripButton5.Checked = true; toolStripButton5_Click(null, null); } else if (Mdb.GetOther("collectionStyle") == "2") { 历史记录HToolStripMenuItem.Checked = true; 收藏夹SToolStripMenuItem_Click(null, null); } if (Mdb.GetOther("isNormalForm") != "1") { WindowState = FormWindowState.Maximized; } else { Left = int.Parse(Mdb.GetOther("formLeft")); Top = int.Parse(Mdb.GetOther("formTop")); Width = int.Parse(Mdb.GetOther("formWidth")); Height = int.Parse(Mdb.GetOther("formHeight")); } }
private void 历史记录HToolStripMenuItem_Click(object sender, EventArgs e) { panel1.Visible = splitter1.Visible = 历史记录HToolStripMenuItem.Checked; Mdb.SetOther("collectionStyle", 历史记录HToolStripMenuItem.Checked ? "2" : "0"); if (历史记录HToolStripMenuItem.Checked) { 收藏夹SToolStripMenuItem.Checked = toolStripButton5.Checked = false; panel1.Width = int.Parse(Mdb.GetOther("collectionWidth")); if (treeView2.Nodes.Count == 0) { UrlHistoryWrapperClass.STATURLEnumerator enumerator = new UrlHistoryWrapperClass().GetEnumerator(); while (enumerator.MoveNext()) { if (!string.IsNullOrEmpty(enumerator.Current.Title)) { TreeNode node = new TreeNode(enumerator.Current.Title, 2, 2); node.Tag = enumerator.Current.URL; treeView2.Nodes.Add(node); } } } treeView2.BringToFront(); } }