本文整理汇总了C#中System.Windows.Forms.TreeView.Select方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.Select方法的具体用法?C# TreeView.Select怎么用?C# TreeView.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeView
的用法示例。
在下文中一共展示了TreeView.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AreaTextprint
public void AreaTextprint(TreeView DOMTreeView, TreeNode tree_node)
{
try
{
if (tree_node == null) return; //如果沒有選取任何 TreeNode
DOMTreeView.SelectedNode = tree_node; //設定目前在樹狀檢視控制項中選取的樹狀節點。
DOMTreeView.Visible = false;
DOMTreeView.Select(); // Select() 方法會啟動此控制項。
while (DOMTreeView .SelectedNode .Nodes .Count >1) //如果目前沒有選取任何 TreeNode, SelectedNode 屬性為 null。
{
tagname.Push(tree_node);
if (DOMTreeView.SelectedNode == null) return; //如果目前沒有選取任何 TreeNode, SelectedNode 屬性為 null。
DOMTreeView.SelectedNode = DOMTreeView.SelectedNode.NextVisibleNode;
DOMTreeView.Select();
}
DOMTreeView.Visible = true;
}
catch (Exception ex)
{
throw ex;
}
}
示例2: DeletePrevDataArea
/// <summary>
/// 去除資料位置之前的區塊
/// <param name="DOMTreeView">畫面物件</param>
/// <param name="tree_node">dom com樹狀結構</param>
/// <returns>無</returns>
private void DeletePrevDataArea(TreeView DOMTreeView, TreeNode tree_node)
{
string strValue1 = "";
string strValue2 = "";
bool bolStart = false;
try
{
string[] strFullPath1 = tree_node.FullPath.Split('\\');
DOMTreeView.SelectedNode = DOMTreeView.Nodes[0].Nodes[0];
//DOMTreeView.Select();
DOMTreeView.Visible = false;
while (DOMTreeView.SelectedNode != null)
{
if (DOMTreeView.SelectedNode.FullPath == tree_node.FullPath) //取得從根樹狀節點通往目前樹狀節點的路徑
{
goto ReadNext;
}
string[] strFullPath2 = DOMTreeView.SelectedNode.FullPath.Split('\\'); //取得這個執行個體中,由('\\')所分隔之子字串
int cnt = (int)DOMTreeView.SelectedNode.GetNodeCount(false); //傳回子樹狀節點的數目
//取得第一次分支的節點
if (DOMTreeView.SelectedNode.Level < 4 && cnt > 1 && strValue1.Equals(""))
{
TreeNode temp_node1 = tree_node;
for (int i = 0; i < strFullPath1.Length - strFullPath2.Length; i++)
{
strValue1 = temp_node1.ImageKey;
if (temp_node1.Parent == null) break;
temp_node1 = temp_node1.Parent;
}
bolStart = true;
}
//取得第一次分支的節點之下一個子節點
if (!strValue1.Equals("") && !bolStart && strValue2.Equals(""))
{
strValue2 = DOMTreeView.SelectedNode.ImageKey;
}
//判斷是否為同一區塊
//由Body之後區分
if (strFullPath1.Length >= 2 && strFullPath2.Length >= 2)
{
if (strFullPath1[2].ToString() != strFullPath1[2].ToString())
{
// DOMTreeView1.Nodes.Remove(DOMTreeView1.SelectedNode);
}
else
{
if (!strValue1.Equals("") && !strValue2.Equals("") && strValue1 != strValue2)
{
DOMTreeView.Nodes.Remove(DOMTreeView.SelectedNode);
break;
}
}
}
if (bolStart) bolStart = !bolStart;
DOMTreeView.SelectedNode = DOMTreeView.SelectedNode.NextVisibleNode;
DOMTreeView.Select();
}
ReadNext:
DOMTreeView.SelectedNode = tree_node;
//DOMTreeView.Select();
DOMTreeView.Visible = true;
}
catch (Exception ex)
{
throw ex;
}
}
示例3: SparkleSetup
public SparkleSetup()
{
InitializeComponent ();
Program.TranslateWinForm (this);
pictureBox.Image = Icons.side_splash;
this.Icon = Icons.sparkleshare;
Controller.HideWindowEvent += delegate
{
this.Hide();
};
Controller.ShowWindowEvent += delegate
{
this.Show();
};
Controller.ChangePageEvent += delegate (PageType type, string [] warnings) {
tabControl.SafeInvoke ((Action)delegate {
switch (type) {
case PageType.Setup:
tabControl.SelectedIndex = 0;
NameEntry.Text = Controller.GuessedUserName;
EmailEntry.Text = Controller.GuessedUserEmail;
Show();
Controller.CheckSetupPage(NameEntry.Text, EmailEntry.Text);
break;
case PageType.Add:
tabControl.SelectedIndex = 1;
// Add plugins to tree
// ===================
// Check whether the treeView is already created
// If it is dispose it and start over
if (treeView != null) {
treeView.Dispose();
}
// Set up the treeview
ImageList imageList = new ImageList ();
imageList.ImageSize = new Size (24, 24);
treeView = new TreeView ();
treeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText;
treeView.FullRowSelect = true;
treeView.ImageIndex = 0;
treeView.Indent = 35;
treeView.HideSelection = false;
treeView.ItemHeight = 40;
TreeNode [] nodes = new TreeNode [Controller.Plugins.Count];
for (int i = 0; i < Controller.Plugins.Count; i++) {
nodes [i] = new TreeNode (Controller.Plugins [i].Name + ";" + Controller.Plugins [i].Description);
nodes [i].ImageIndex = i;
nodes [i].SelectedImageIndex = i;
nodes [i].Tag = Controller.Plugins [i].Name;
imageList.Images.Add (Image.FromFile (Controller.Plugins [i].ImagePath));
}
treeView.Nodes.AddRange (nodes);
treeView.ImageList = imageList;
treeView.ShowLines = false;
treeView.ShowRootLines = false;
treeView.Size = new System.Drawing.Size (panel_server_selection.Size.Width,
panel_server_selection.Size.Height);
panel_server_selection.Controls.Add (treeView);
// Finished adding and populating tree
// Select first node
treeView.SelectedNode = treeView.Nodes[0];
treeView.Select();
Controller.SelectedPluginChanged(0);
treeView.AfterSelect += new TreeViewEventHandler(CheckTreeNode);
Show ();
Controller.CheckAddPage(ServerEntry.Text, FolderEntry.Text, 1);
break;
case PageType.Invite:
tabControl.SelectedIndex = 5;
InviteAddressEntry.Text = Controller.PendingInvite.Address;
InviteFolderEntry.Text = Controller.PendingInvite.RemotePath;
Show();
break;
case PageType.Syncing:
tabControl.SelectedIndex = 2;
Show();
break;
case PageType.Error:
tabControl.SelectedIndex = 3;
label3.Text = "First, have you tried turning it off and on again?\n\n" +
Controller.PreviousUrl + " is the address we've compiled. Does this look alright?\n\n" +
"The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder?";
Show ();
//.........这里部分代码省略.........