本文整理汇总了C#中System.Windows.Forms.TreeView.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.Refresh方法的具体用法?C# TreeView.Refresh怎么用?C# TreeView.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeView
的用法示例。
在下文中一共展示了TreeView.Refresh方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddURLToTreeView
public static void AddURLToTreeView(string url, Mode mode, TreeView treeView, Hashtable htNodes) {
Regex r = new Regex(@"^\s*(?<protocol>https?)://(?<path>.*)", RegexOptions.IgnoreCase);
Match m = r.Match(url);
TreeNodeCollection nodes = treeView.Nodes;
if ( m.Success ) {
Protocol p = (Protocol)Enum.Parse(typeof(Protocol), m.Result("${protocol}"), true);
char[] separators = { '\\', '/' };
ExtendedTreeNode etn = null;
foreach ( string path in m.Result("${path}").Split(separators) ) {
if ( htNodes.ContainsKey(path) ) {
etn = (ExtendedTreeNode)htNodes[path];
}
else {
etn = new ExtendedTreeNode(path);
etn.ForeColor = getColourCode(mode, p);
nodes.Add(etn);
htNodes.Add(path, etn);
}
// Expand the node in mode two
if ( mode == Mode.two )
etn.Expand();
htNodes = etn.children;
nodes = etn.Nodes;
} // next node
etn.ForeColor = getColourCode(mode, p);
treeView.Refresh();
} // if valid url
} // end AddURLToTreeView()
示例2: DisplayTo
public static void DisplayTo( TreeView tree )
{
tree.BeginUpdate();
tree.Nodes.Clear();
Recurse( tree.Nodes, Config.GetUserDirectory( "Macros" ) );
tree.EndUpdate();
tree.Refresh();
tree.Update();
}
示例3: ReadTreeNode
//画树形图,
private static void ReadTreeNode(TreeView xTree)
{
TreeNode tnRet = null;
xTree.Nodes.Clear();
string xSql = "SELECT * FROM MenuView WHERE LimitID='1'";
SqlDataReader xRec = Program.SqlReader(xSql);
if (xRec != null)
{
if (xRec.HasRows == false)
{
xTree.Refresh();
}
else
{
while (xRec.Read())
{
TreeNode tn = new TreeNode(xRec["Nam"].ToString());
tn.Name = xRec["Code"].ToString();
if (xRec["CanRun"].ToString() == "1")
{
tn.Checked = true;
}
else
{
tn.Checked = false;
}
if (xRec["Parent"].ToString() == "000")
{
xTree.Nodes.Add(tn);
}
else
{
if (xRec["Parent"].ToString() != null)
{
foreach (TreeNode xtn in xTree.Nodes)
{
tnRet = FindNode(xtn, xRec["Parent"].ToString());
if (tnRet != null) break;
}
if (tnRet != null)
{
tnRet.Nodes.Add(tn);
tnRet.Expand();
}
}
}
}
}
xRec.Close();
}
}
示例4: fillTreeViewCategorias
public static void fillTreeViewCategorias(TreeView dataCategorias, List<Categoria> result)
{
dataCategorias.Nodes.Clear(); // Clear any existing items
dataCategorias.BeginUpdate(); // prevent overhead and flicker
TreeNode root = dataCategorias.Nodes.Add( "---" );
root.Tag = new Categoria(0);
root.Expand();
Dictionary<short, TreeNode> nodes = new Dictionary<short, TreeNode>();
//asume fathers first
foreach (Categoria cat in result) {
TreeNode node = (cat.categoria_padre == null ? root: nodes[(short)cat.categoria_padre]).Nodes.Add(cat.nombre);
node.Tag = cat;
nodes.Add(cat.id, node);
}
dataCategorias.EndUpdate();
dataCategorias.Refresh();
}
示例5: loadNotifications
private int loadNotifications(TreeView tv)
{
int iCnt = 0;
tv.Nodes.Clear();
TreeNode tnMain = tv.Nodes.Add("Notifications");
int[] iHandles = OpenNETCF.WindowsCE.Notification.Notify.GetUserNotificationHandles();
_sList = new List<string>();
_sList.Clear();
_strArr = new string[iHandles.Length + 1][];
_strArr[0] = new string[7] { "App", "Args", "Event", "Start", "End", "Type", "handle" };
int i = 0;
eventEntries = new EventEntry[iHandles.Length];
foreach (int iHandle in iHandles)
{
OpenNETCF.WindowsCE.Notification.UserNotificationInfoHeader infoHeader = OpenNETCF.WindowsCE.Notification.Notify.GetUserNotification(iHandle);
string[] strArray = new string[] { infoHeader.UserNotificationTrigger.Application, infoHeader.UserNotificationTrigger.Arguments };
TreeNode tn = new TreeNode(infoHeader.UserNotificationTrigger.Application);
tnMain.Nodes.Add(tn);
tn.Nodes.Add("Args: " + infoHeader.UserNotificationTrigger.Arguments);
tn.Nodes.Add("Event: " + infoHeader.UserNotificationTrigger.Event.ToString());
tn.Nodes.Add("Start: " + infoHeader.UserNotificationTrigger.StartTime.ToString("dd.MM.yyyy HH:mm"));
tn.Nodes.Add("End: " + infoHeader.UserNotificationTrigger.EndTime.ToString("dd.MM.yyyy HH:mm"));
tn.Nodes.Add("Type: " + infoHeader.UserNotificationTrigger.Type.ToString());
tn.Nodes.Add("Handle: " + iHandles[i].ToString());
//eventEntries[i].sApp = infoHeader.UserNotificationTrigger.Application;
//eventEntries[i].sEvent = infoHeader.UserNotificationTrigger.Event.ToString();
//eventEntries[i].sArg = infoHeader.UserNotificationTrigger.Arguments;
//eventEntries[i].sStartTime = infoHeader.UserNotificationTrigger.StartTime.ToString("dd.MM.yyyy HH:mm");
//eventEntries[i].sEndTime = infoHeader.UserNotificationTrigger.EndTime.ToString("dd.MM.yyyy HH:mm");
//eventEntries[i].sType = infoHeader.UserNotificationTrigger.Type.ToString();
//eventEntries[i].sHandle = iHandles[i].ToString();
iCnt++;
}
tv.Refresh();
return iCnt;
}
示例6: Write_Tree
public void Write_Tree(TreeView Tree_View, DateTime Date)
{
foreach (Event e in file.All_Events)
{
if (Date > e.Completed && e.Done)
{
}
else
{
TreeNode nod = new TreeNode();
if (e.Done == true)
{
nod.BackColor = Color.LightGray;
}
else if (e.Due_Date)
{
nod.BackColor = Color.LightCoral;
}
else if (e.Completion != 0)
{
nod.BackColor = Color.LightBlue;
}
else
{
nod.BackColor = Color.LightGreen;
}
nod.Tag = nod.BackColor;
nod.Text = e.Title;
nod.Name = "trn_" + e.Title;
Tree_View.Nodes.Add(nod);
Tree_View.SelectedNode = nod;
Write_Node(Tree_View, e, Date);
}
}
Tree_View.ExpandAll();
Tree_View.Refresh();
Tree_View.SelectedNode = null;
}
示例7: ReadTreeNodeNoCheck
private void ReadTreeNodeNoCheck(TreeView xTree, string xSql)
{
TreeNode tnRet = null;
xTree.Nodes.Clear();
SqlDataReader xRec = Program.SqlReader(xSql);
if (xRec != null)
{
if (xRec.HasRows == false)
{
xTree.Refresh();
}
else
{
while (xRec.Read())
{
TreeNode tn = new TreeNode(xRec["Nam"].ToString());
tn.Name = xRec["Code"].ToString();
if (xRec["CanRun"].ToString() == "1")
{
if (xRec["Parent"].ToString() == "000")
{
xTree.Nodes.Add(tn);
}
else
{
if (xRec["Parent"].ToString() != null)
{
foreach (TreeNode xtn in xTree.Nodes)
{
tnRet = FindNode(xtn, xRec["Parent"].ToString());
if (tnRet != null) break;
}
if (tnRet != null)
{
tnRet.Nodes.Add(tn);
tnRet.Expand();
}
}
}
}
}
}
xRec.Close();
}
}