private void FileListView_SelectedIndexChanged(object sender, EventArgs e) { if (this.FileListView.SelectedItems.Count == 1) { string strFileName = this.FileListView.SelectedItems[0].SubItems[0].Text; if (strFileName.ToLower().EndsWith(".jpg")) { string strJPGPath = Path.Combine(this.AddressBar.Text, strFileName); Image old = this.FileListView.BackgroundImage; Image img = ImageFast.FromFile(strJPGPath); this.FileListView.BackgroundImage = new Bitmap(img, this.FileListView.Size);//strJPGPath,); this.FileListView.BackgroundImageTiled = false; img.Dispose(); if (old != null) { old.Dispose(); } } } }
public MainForm() { InitializeComponent(); stDirStack = new Stack <string>(); //最大化 this.WindowState = FormWindowState.Maximized; this.FileTreeView.BackColor = this.BackColor; this.FileListView.BackColor = this.BackColor; //iConfiger = new XMLConfigOperater(); //IApplicationContext iac = ContextRegistry.GetContext(); //oM = iac.GetObject("OptionMenu") as OptionMenu; //oM.Visible = false; //iConfiger = iac.GetObject("XMLConfigOperater") as IConfigOperator; //iConfiger.SetProperty("ok","ok"); /////根据不同类型进行设置 string strP = Path.Combine(Application.StartupPath, "icons\\"); oM.AddMenuItem("delete", ImageFast.FromFile(strP + "Folder.png"), new DragEventHandler(OptionMenu_DragDrop)); oM.AddMenuItem("Test", ImageFast.FromFile(strP + "Can.png"), new DragEventHandler(OptionMenu_DragDrop)); oM.AddMenuItem("Next", ImageFast.FromFile(strP + "Behavior.png"), new DragEventHandler(OptionMenu_DragDrop)); oM.AddMenuItem("NPre", ImageFast.FromFile(strP + "x_symbol.png"), new DragEventHandler(OptionMenu_DragDrop)); oM.AddMenuItem("OK", ImageFast.FromFile(strP + "Setting.png"), new DragEventHandler(OptionMenu_DragDrop)); this.BackColor = PropertyMgr.BGColor; foreach (Control item in this.Controls) { item.BackColor = this.BackColor; item.Font = PropertyMgr.Font; } //添加服务 this.FileTreeView.AfterExpand += new TreeViewEventHandler(OnTreeViewExpand); this.FileTreeView.AfterCollapse += new TreeViewEventHandler(OnTreeViewCollapse); this.AddressBar.SelectedItemChanged += new EventHandler(AddressBar_SelectedItemChanged); }