[Mono-winforms-list] TreeView - selected node is hide

Pavel Bansky levap at bansky.net
Wed Oct 12 16:55:35 EDT 2005


Hello Mono folks,

I found strange behaivor of TreeView under KDE. Selected node is hiden 
under 'selection' so you can't see the text. Seems like rectangle around 
selected item is filled with colour. Here is the screenshot 
http://bansky.net/treeview.png

have a nice day

Pavel


Code goes here:

using System;
using System.Drawing;
using System.Windows.Forms;

namespace TreeViewTest
{

	public class MyNode : TreeNode
	{
		public string filename;
	}
	
	public class MainForm : Form
	{
		private System.Windows.Forms.StatusBar statusBar1;
		private System.Windows.Forms.TreeView treeView1;
		private System.Windows.Forms.Button btnAdd;
		public MainForm()
		{
		this.btnAdd = new System.Windows.Forms.Button();
		this.treeView1 = new System.Windows.Forms.TreeView();
		this.statusBar1 = new System.Windows.Forms.StatusBar();
		this.SuspendLayout();

		this.btnAdd.Location = new System.Drawing.Point(8, 8);
		this.btnAdd.Name = "btnAdd";
		this.btnAdd.Text = "button1";
		this.btnAdd.Click += new System.EventHandler(this.BtnAddClick);

		this.treeView1.ImageIndex = -1;
		this.treeView1.Location = new System.Drawing.Point(104, 8);
		this.treeView1.Name = "treeView1";
		this.treeView1.ItemHeight = 20;
		this.treeView1.Size = new System.Drawing.Size(121, 192);
		this.treeView1.AfterSelect += new 
System.Windows.Forms.TreeViewEventHandler(this.TreeView1AfterSelect);

		this.statusBar1.Location = new System.Drawing.Point(0, 223);
		this.statusBar1.Name = "statusBar1";
		this.statusBar1.Size = new System.Drawing.Size(240, 22);
		this.statusBar1.Text = "statusBar1";

		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
		this.ClientSize = new System.Drawing.Size(240, 245);
		this.Controls.Add(this.statusBar1);
		this.Controls.Add(this.btnAdd);
		his.Controls.Add(this.treeView1);
		this.Name = "MainForm";
		this.Text = "MainForm";
		this.ResumeLayout(false);
		}
		
		[STAThread]
		public static void Main(string[] args)
		{
			Application.Run(new MainForm());
		}
		
		void BtnAddClick(object sender, System.EventArgs e)
		{
			MyNode mn = new MyNode();
			mn.Text = "Some_file";
			mn.filename = "some_name.txt";
			treeView1.Nodes.Add(mn);
		}
		
		void TreeView1AfterSelect(object sender, 
System.Windows.Forms.TreeViewEventArgs e)
		{
			MyNode mn = (MyNode)treeView1.SelectedNode;
			statusBar1.Text = mn.filename;
		}
		
	}
}


-- 
__________________________________________________________

Pavel Bánský
levap at bansky.net                        I write code...
__________________________________________________________



More information about the Mono-winforms-list mailing list