本文整理汇总了C#中System.Windows.Forms.TreeViewCancelEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TreeViewCancelEventArgs类的具体用法?C# TreeViewCancelEventArgs怎么用?C# TreeViewCancelEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeViewCancelEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了TreeViewCancelEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSubFoldersToCurrentFolder
private static void AddSubFoldersToCurrentFolder(TreeViewCancelEventArgs e, string[] newSubs)
{
if (newSubs.Length > 0)
{
for (int k = 0; k < newSubs.Length; k++)
{
//Only get the non-hidden folders and non-system folders
//TODO: Find out why C:\PerfLogs denies access in Win7 or at least some flag
//that it uses so I don't have to have the string hard-coded into the program
bool isHidden = ((File.GetAttributes(newSubs[k]) & FileAttributes.Hidden) ==
FileAttributes.Hidden);
bool isSystem = ((File.GetAttributes(newSubs[k]) & FileAttributes.System) ==
FileAttributes.System);
if (!isHidden && !newSubs[k].Contains("PerfLogs") && !isSystem)
{
TreeNode subNode = new TreeNode();
subNode.Name = newSubs[k];
string[] tokenPath = newSubs[k].Split(Path.DirectorySeparatorChar);
subNode.Text = tokenPath[tokenPath.Length - 1];
subNode.Tag = newSubs[k];
subNode.ImageIndex = (int)folderTypes.FolderClosed;
subNode.SelectedImageIndex = (int)folderTypes.FolderOpen;
AddPlaceholderForSubFolders(newSubs[k], subNode);
e.Node.Nodes.Add(subNode);
}
}
}
}
示例2: TilesetTree_BeforeExpand
private void TilesetTree_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
ObjectDirectory od = null;
TreeNode node = null;
foreach (TreeNode cNode in e.Node.Nodes)
{
if (cNode.Tag is ObjectDirectory && cNode.Nodes.Count == 0)
{
od = cNode.Tag as ObjectDirectory;
foreach (ObjectDirectory c in od.ObjectDirectories)
{
node = new TreeNode(c.Name);
node.Tag = c;
cNode.Nodes.Add(node);
}
foreach (MapObject c in od.MapObjects)
{
node = new TreeNode(c.Name);
node.Tag = c;
cNode.Nodes.Add(node);
}
}
}
}
示例3: TvWndList_BeforeExpand
private static void TvWndList_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
TreeNode node = e.Node;
if (node.Nodes[0].Name != "none")
{
return;
}
node.Nodes.Clear();
string name = node.Name;
if (!Regex.IsMatch(name, "^\\d+$"))
{
return;
}
var intPtr = (IntPtr)int.Parse(name);
if (intPtr == IntPtr.Zero)
{
return;
}
IntPtr subPtr = IntPtr.Zero;
var classList = new Dictionary<string, int>();
while (true)
{
subPtr = User32API.FindWindowEx(intPtr, subPtr, null, null);
if (subPtr == IntPtr.Zero)
{
break;
}
var temp = new TreeNode { Name = subPtr.ToString(), Text = DisplayNote(subPtr, classList) };
temp.Nodes.Add(new TreeNode { Name = "none" });
node.Nodes.Add(temp);
}
}
示例4: OnBeforeSelect
// cancel selection just in case we get selected somehow
protected override void OnBeforeSelect(TreeViewCancelEventArgs e)
{
base.OnBeforeSelect(e);
if (e.Node.ForeColor == SystemColors.GrayText) {
e.Cancel = true;
}
}
示例5: OnPopulate
protected internal override void OnPopulate( TreeViewCancelEventArgs e )
{
if ( method.MethodSpecs.Count > 0 )
{
this.Nodes.Add( new MethodSpecCollectionTreeNode( method.MethodSpecs ) );
}
}
示例6: OnBeforeExpand
protected override void OnBeforeExpand(TreeViewCancelEventArgs e) {
var node = e.Node as TreeNodeX;
if (node != null) {
node.OnExpand();
}
base.OnBeforeExpand(e);
}
示例7: OnBeforeSelect
protected override void OnBeforeSelect(TreeViewCancelEventArgs e)
{
base.OnBeforeSelect(e);
bool controlKeyDown = (Control.ModifierKeys == Keys.Control);
bool shiftKeyDown = (Control.ModifierKeys == Keys.Shift);
if (controlKeyDown
&& _selectedNodes.Contains(e.Node))
{
// Unselect it (let framework know we don't want selection this time)
e.Cancel = true;
// Update nodes
e.Node.BackColor = this.BackColor;
e.Node.ForeColor = this.ForeColor;
_selectedNodes.Remove(e.Node);
if (this.SelectionChanged != null)
{
this.SelectionChanged(this, EventArgs.Empty);
}
}
else
{
_lastNode = e.Node;
if (!shiftKeyDown)
{
_firstNode = e.Node;
}
}
}
示例8: NodeTree_BeforeExpand
private void NodeTree_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
ExplorerNode node = e.Node.Tag as ExplorerNode;
if (node == null)
return;
node.BeforeExpand(sender, e);
}
示例9: f_filesView_BeforeSelect
private void f_filesView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{
TreeNode selectedNode = f_filesView.SelectedNode;
if (selectedNode == null)
return;
}
示例10: OnPopulate
protected internal override void OnPopulate( TreeViewCancelEventArgs e )
{
foreach ( TypeRefDeclaration externalType in this.decl.TypeRefs )
{
this.Nodes.Add( new ExternalTypeTreeNode( externalType ) );
}
}
示例11: OnBeforeSelect
protected override void OnBeforeSelect(TreeViewCancelEventArgs e)
{
if (Updating)
e.Cancel = true;
else
base.OnBeforeSelect(e);
}
示例12: OnPopulate
protected internal override void OnPopulate( TreeViewCancelEventArgs e )
{
foreach ( InterfaceImplementationDeclaration interfaceImplementation in type.InterfaceImplementations )
{
this.Nodes.Add( new InterfaceImplementationTreeNode( interfaceImplementation.ImplementedInterface ) );
}
}
示例13: OnPopulate
protected internal override void OnPopulate( TreeViewCancelEventArgs e )
{
foreach ( MethodSpecDeclaration methodSpec in methodSpecs )
{
this.Nodes.Add( new MethodSpecTreeNode( methodSpec ) );
}
}
示例14: OnPopulate
protected internal override void OnPopulate( TreeViewCancelEventArgs e )
{
foreach ( GenericParameterDeclaration genericParameter in genericParameters )
{
this.Nodes.Add( new GenericParameterTreeNode( genericParameter ) );
}
}
示例15: treeView1_BeforeExpand
private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
if (e.Node.Nodes.Count > 0)
{
if (e.Node.Nodes[0].Text == "..." && e.Node.Nodes[0].Tag == null)
{
e.Node.Nodes.Clear();
string[] dirs = Directory.GetDirectories(e.Node.Tag.ToString());
foreach(string dir in dirs)
{
if (dir != e.Node.Tag+"System Volume Information")
{
DirectoryInfo di = new DirectoryInfo(dir);
TreeNode node = new TreeNode(di.Name, 0, 1);
node.Tag = dir;
if (di.GetDirectories().Count() > 0)
node.Nodes.Add(null, "...");
e.Node.Nodes.Add(node);
}
else
{
MessageBox.Show(dir);
}
}
}
}
}