private void dtlpResDirControl1_GetItemTextStyle(object sender, GetItemTextStyleEventArgs e) { e.FontFace = ""; e.FontSize = 0; e.FontStyle = FontStyle.Regular; if (EnabledIndices != null && IsMaskInList(e.Mask, EnabledIndices) == false) { e.ForeColor = ControlPaint.LightLight(ForeColor); e.Result = 1; } else { e.Result = 0; } }
// 填充下级对象 public void FillSub(TreeNode node) { string strPath = ""; if (node != null) { node.Nodes.Clear(); // 清除以前的下级事项 } Package package = null; if (node != null) { strPath = GetPath(node, '/'); } /* * ItemInfo iteminfo = (ItemInfo) * m_itemInfoTable[strPath]; * if (iteminfo == null) * { * iteminfo = new ItemInfo(); * m_itemInfoTable.Add(strPath, iteminfo); * } */ this.Update(); package = GetOneLevelDirPackage(strPath /*, iteminfo*/); if (package == null) { // error // 最好将本Item图标改为带有红色出错标记的样式 if (node != null) { SetLoading(node); node.Collapse(); } return; } for (int i = 0; i < package.Count; i++) { Cell cell = (Cell)package[i]; string strCurPath = cell.Path; if (strPath != "") { // 前方应当完全一致 Debug.Assert(strCurPath.Length >= strPath.Length + 1); strCurPath = strCurPath.Remove(0, strPath.Length + 1); } int nImage = GetImageIndex(cell.Mask); // 新node TreeNode nodeNew = new TreeNode(strCurPath, nImage, nImage); if ((cell.Mask & DtlpChannel.AttrExtend) != 0) { SetLoading(nodeNew); } /* * if (procItemText != null) * { * string strFontFace; * int nFontSize; * FontStyle FontStyle; * Color ForeColor = nodeNew.ForeColor; * int nRet = procItemText(GetPath(nodeNew, '/'),cell.Mask, * out strFontFace, * out nFontSize, * out FontStyle, * ref ForeColor); * if (nRet == 1) * { * if (strFontFace != "") * { * Font font = new Font(strFontFace, nFontSize, FontStyle); * nodeNew.NodeFont = font; * } * nodeNew.ForeColor = ForeColor; * } * }*/ if (this.GetItemTextStyle != null) { GetItemTextStyleEventArgs e = new GetItemTextStyleEventArgs(); e.Path = GetPath(nodeNew, '/'); e.Mask = cell.Mask; e.ForeColor = nodeNew.ForeColor; this.GetItemTextStyle(this, e); if (e.Result == 1) { if (e.FontFace != "") { Font font = new Font(e.FontFace, e.FontSize, e.FontStyle); nodeNew.NodeFont = font; } nodeNew.ForeColor = e.ForeColor; } } if (node == null) { this.Nodes.Add(nodeNew); } else { node.Nodes.Add(nodeNew); } // 确保有一个对应的ItemInfo对象 string strKeyPath = GetPath(nodeNew, '/'); ItemInfo iteminfo = (ItemInfo) m_itemInfoTable[strKeyPath]; if (iteminfo == null) { iteminfo = new ItemInfo(); m_itemInfoTable.Add(strKeyPath, iteminfo); } iteminfo.Mask = cell.Mask; // nodeNew.ForeColor = ControlPaint.LightLight(nodeNew.ForeColor); } }
// 请求给出Item文字参数 private void dtlpResDirControl1_GetItemTextStyle(object sender, GetItemTextStyleEventArgs e) { e.FontFace = ""; e.FontSize = 0; e.FontStyle = FontStyle.Regular; if ((e.Mask & DtlpChannel.TypeStdbase) != 0) { e.Result = 0; } else { e.ForeColor = ControlPaint.LightLight(ForeColor); e.Result = 1; } }
// 填充下级对象 public void FillSub(TreeNode node) { string strPath = ""; if (node != null) { node.Nodes.Clear(); // 清除以前的下级事项 } Package package = null; if (node != null) { strPath = GetPath(node, '/'); } /* ItemInfo iteminfo = (ItemInfo) m_itemInfoTable[strPath]; if (iteminfo == null) { iteminfo = new ItemInfo(); m_itemInfoTable.Add(strPath, iteminfo); } */ this.Update(); package = GetOneLevelDirPackage(strPath/*, iteminfo*/); if (package == null) { // error // 最好将本Item图标改为带有红色出错标记的样式 if (node != null) { SetLoading(node); node.Collapse(); } return; } for(int i=0;i<package.Count;i++) { Cell cell = (Cell)package[i]; string strCurPath = cell.Path; if (strPath != "") { // 前方应当完全一致 Debug.Assert(strCurPath.Length >= strPath.Length+1); strCurPath = strCurPath.Remove(0,strPath.Length + 1); } int nImage = GetImageIndex(cell.Mask); // 新node TreeNode nodeNew = new TreeNode(strCurPath,nImage,nImage); if ((cell.Mask & DtlpChannel.AttrExtend) != 0) { SetLoading(nodeNew); } /* if (procItemText != null) { string strFontFace; int nFontSize; FontStyle FontStyle; Color ForeColor = nodeNew.ForeColor; int nRet = procItemText(GetPath(nodeNew, '/'),cell.Mask, out strFontFace, out nFontSize, out FontStyle, ref ForeColor); if (nRet == 1) { if (strFontFace != "") { Font font = new Font(strFontFace, nFontSize, FontStyle); nodeNew.NodeFont = font; } nodeNew.ForeColor = ForeColor; } }*/ if (this.GetItemTextStyle != null) { GetItemTextStyleEventArgs e = new GetItemTextStyleEventArgs(); e.Path = GetPath(nodeNew, '/'); e.Mask = cell.Mask; e.ForeColor = nodeNew.ForeColor; this.GetItemTextStyle(this, e); if (e.Result == 1) { if (e.FontFace != "") { Font font = new Font(e.FontFace, e.FontSize, e.FontStyle); nodeNew.NodeFont = font; } nodeNew.ForeColor = e.ForeColor; } } if (node == null) this.Nodes.Add(nodeNew); else node.Nodes.Add(nodeNew); // 确保有一个对应的ItemInfo对象 string strKeyPath = GetPath(nodeNew, '/'); ItemInfo iteminfo = (ItemInfo) m_itemInfoTable[strKeyPath]; if (iteminfo == null) { iteminfo = new ItemInfo(); m_itemInfoTable.Add(strKeyPath, iteminfo); } iteminfo.Mask = cell.Mask; // nodeNew.ForeColor = ControlPaint.LightLight(nodeNew.ForeColor); } }