public static RepositoryItemCheckEdit CotCheckEdit(TreeListColumn Column , string ColumnField) { SetHorzAlignment(Column, HorzAlignment.Center); Column.ColumnEdit = HelpRepository.GetCheckEdit(false); if (ColumnField != null) Column.FieldName = ColumnField; return (RepositoryItemCheckEdit)Column.ColumnEdit; }
public virtual void PaintCell(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column, TreeList.TextFormatting format, object data) { if (format.BackColor != Color.Transparent) { Rectangle r = cellRect; r.X = column.CalculatedRect.X; r.Width = column.CalculatedRect.Width; SolidBrush brush = new SolidBrush(format.BackColor); dc.FillRectangle(brush, r); brush.Dispose(); } if (data != null) { cellRect = CommonTools.Util.AdjustRectangle(cellRect, format.Padding); //dc.DrawRectangle(Pens.Black, cellRect); Color color = format.ForeColor; if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles == false) color = SystemColors.HighlightText; TextFormatFlags flags= TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); TextRenderer.DrawText(dc, data.ToString(), m_owner.Font, cellRect, color, flags); } }
public static RepositoryItemCalcEdit CotCalcEdit(TreeListColumn Column , string ColumnField , int SoThapPhan) { SetHorzAlignment(Column, HorzAlignment.Far); Column.ColumnEdit = HelpRepository.GetCalcEdit(SoThapPhan); if (ColumnField != null) Column.FieldName = ColumnField; return (RepositoryItemCalcEdit)Column.ColumnEdit; }
//添加年份后,新增一列 private void AddColumn(int year) { TreeListColumn column = new TreeListColumn(); column.OptionsColumn.AllowEdit = false; column.FieldName = "y" + year; column.Tag = year; column.Caption = year + "年"; column.Name = year.ToString(); column.Width = 100; //column.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; column.VisibleIndex = year;//有两列隐藏列 // // repositoryItemTextEdit1 // RepositoryItemTextEdit repositoryItemTextEdit1 = new RepositoryItemTextEdit(); repositoryItemTextEdit1.AutoHeight = false; repositoryItemTextEdit1.DisplayFormat.FormatString = "n2"; repositoryItemTextEdit1.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; repositoryItemTextEdit1.Mask.EditMask = "n2"; repositoryItemTextEdit1.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; column.ColumnEdit = repositoryItemTextEdit1; //column.DisplayFormat.FormatString = "#####################0.##"; //column.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; this.treeList2.Columns.AddRange(new TreeListColumn[] { column}); }
private void chkNode_CheckedChanged(object sender, EventArgs e, TreeListColumn column) { trlPermission.PostEditor(); TreeListNode node = trlPermission.FocusedNode; TreeListChangeChildNodesOperation operation = new TreeListChangeChildNodesOperation(column, node, (sender as CheckEdit).Checked); trlPermission.NodesIterator.DoOperation(operation); }
public static RepositoryComboboxAuto CotComboboxFind(TreeList treeList , TreeListColumn column , string ColumnField , string ValueField, string DisplayField , string TableName , bool StartWith) { column.AppearanceHeader.Options.UseTextOptions = true; column.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; column.FieldName = ColumnField+DisplayField; RepositoryComboboxAuto comboFind = new RepositoryComboboxAuto(treeList ,ColumnField, TableName , ValueField , DisplayField , StartWith); column.ColumnEdit = comboFind; return comboFind; }
public static RepositoryComboboxAdd CotComboboxAdd(TreeList treeList , TreeListColumn column , string ColumnField , string ValueField, string DisplayField , string TableName) { column.AppearanceHeader.Options.UseTextOptions = true; column.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; column.FieldName = ColumnField+DisplayField; RepositoryComboboxAdd comboAdd = new RepositoryComboboxAdd(TableName, ColumnField, ValueField, DisplayField, HelpGen.G_FW_DM_ID, treeList); comboAdd._init(); column.ColumnEdit = comboAdd; return comboAdd; }
public static void SetColumnType(TreeListColumn column, object type) { if (type.Equals(TreeListColumnType.CheckEdit)) HelpTreeColumn.CotCheckEdit(column, column.FieldName); else if (type.Equals(TreeListColumnType.CalcEdit)) column.ColumnEdit = CalcEdit(); else if (type.Equals(TreeListColumnType.DateEdit)) column.ColumnEdit = DateEdit(); else if (type.Equals(TreeListColumnType.SpinEdit)) column.ColumnEdit = SpinEdit(); }
public void InitDeviceType(params string[] type) { if (type.Length == 0) { InitDeviceType(); return; } ArrayList list = new ArrayList(); list.AddRange(type); UCType = type[0]; Stream fs = Assembly.Load("Itop.TLPSP.DEVICE").GetManifestResourceStream("Itop.TLPSP.DEVICE.devicetypes.xml"); //Stream fs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Itop.TLPSP.DEVICE.devicetypes.xml"); //Assembly.GetExecutingAssembly().GetManifestResourceStream XmlDocument xml = new XmlDocument(); xml.Load(fs); XmlNodeList nodes = xml.GetElementsByTagName("device"); DataTable table = new DataTable(); table.Columns.Add("id", typeof(string)); table.Columns.Add("name", typeof(string)); table.Columns.Add("class", typeof(string)); TreeListColumn column = new TreeListColumn(); column.Caption = "�豸����"; column.FieldName = "name"; column.VisibleIndex = 0; column.Width = 180; column.OptionsColumn.AllowEdit = false; column.OptionsColumn.AllowSort = false; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); foreach (XmlNode node in nodes) { string stype = node.Attributes["id"].Value; if (!list.Contains(stype)) continue; DataRow row = table.NewRow(); row["id"] = node.Attributes["id"].Value; row["name"] = node.Attributes["name"].Value; row["class"] = node.Attributes["class"].Value; table.Rows.Add(row); if (stype == "05") { //DataRow row2 = table.NewRow(); //row2["id"] = "01"; //row2["name"] = "ĸ��"; //row2["class"] = "Itop.TLPSP.DEVICE.UCDeviceMX"; //table.Rows.Add(row2); } } treeList1.DataSource = table; }
public static void InitDeviceTypes(DevExpress.XtraTreeList.TreeList treeList1) { TreeListColumn column = new TreeListColumn(); column.Caption = "É豸ÖÖÀà"; column.FieldName = "TypeName"; column.VisibleIndex = 0; column.Width = 180; column.OptionsColumn.AllowEdit = false; column.OptionsColumn.AllowSort = false; treeList1.Columns.AddRange(new TreeListColumn[] { column}); treeList1.KeyFieldName = "Id"; treeList1.ParentFieldName = "ParentId"; treeList1.DataSource = GetDeviceTypes(); }
private void InitTree() { // Create three columns. treeList1.BeginUpdate(); TreeListColumn colObjectId = treeList1.Columns.Add(); colObjectId.Caption = "Id"; colObjectId.Visible = false; TreeListColumn colObjectName = treeList1.Columns.Add(); colObjectName.Caption = "Name"; colObjectName.Visible = true; colObjectName.VisibleIndex = 0; Size columnSize = TextRenderer.MeasureText("".PadLeft(100, 'A'), colObjectName.AppearanceCell.Font); colObjectName.Width = columnSize.Width; TreeListColumn colObjectType = treeList1.Columns.Add(); colObjectType.Caption = "ObjectType"; colObjectId.Visible = false; treeList1.EndUpdate(); // Create a root node . TreeListNode parentForRootNodes = null; foreach (UIObjectBase table in uIObjectBaseXPC) { treeList1.BeginUnboundLoad(); TreeListNode rootNode = treeList1.AppendNode( new object[] { table.Oid, table.FriendlyName, "Table" }, parentForRootNodes); rootNode.ImageIndex = 0; // Create a child of the rootNode foreach (UILabel field in table.ObjectLabels) { var childNode = treeList1.AppendNode(new object[] { field.LabelId, field.ColumnName, "Field" }, rootNode); childNode.ImageIndex = 1; } treeList1.EndUnboundLoad(); } }
//添加固定列 private void AddFixColumn() { TreeListColumn column = new TreeListColumn(); column.FieldName = "Title"; column.Caption = "分类名"; column.VisibleIndex = 0; column.Width = 180; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); column = new TreeListColumn(); column.FieldName = "Sort"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); column = new TreeListColumn(); column.FieldName = "ForecastID"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); column = new TreeListColumn(); column.FieldName = "Forecast"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); column = new TreeListColumn(); column.FieldName = "ID"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); column = new TreeListColumn(); column.FieldName = "ParentID"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); }
private void TreePicker_Load(object sender, EventArgs e) { //tr.Columns.Clear(); tr.OptionsBehavior.Editable = false; foreach (Sys_PopupBind sys_PopupBind in PopupBindList.OrderBy(p => p.PopupBind_Sort)) { TreeListColumn gc = new TreeListColumn(); gc.FieldName = sys_PopupBind.PopupBind_Field; gc.VisibleIndex = sys_PopupBind.PopupBind_Sort; gc.Visible = sys_PopupBind.PopupBind_Visible; gc.Caption = sys_PopupBind.PopupBind_Nick; gc.OptionsFilter.AutoFilterCondition = AutoFilterCondition.Contains; tr.Columns.Add(gc); } tr.ForceInitialize(); tr.ExpandAll(); tr.BestFitColumns(); }
internal override void HandleValueChanged(TreeListNode node, TreeListColumn column, string value) { //check if a change value of a formula or condition requires to add new footnotes (e.g. user selected amount#x1 in itelli -> #x_amount needs to be added) Dictionary <KeyValuePair <string, string>, DefinitionAdmin.Par> footnoteParametersToAdd = ParameterValidation.GetFootnoteParametersToAdd(node, ref value); ActionGroup editActions = new ActionGroup(); foreach (KeyValuePair <string, string> footnoteParameterToAdd in footnoteParametersToAdd.Keys) { editActions.AddAction(new AddParameterAction(node, footnoteParameterToAdd.Key, footnoteParametersToAdd[footnoteParameterToAdd], footnoteParameterToAdd.Value)); } editActions.AddAction(new ChangeParameterValueAction(node, column, value)); //change formula/condition itself _mainForm.PerformAction(editActions, //peform all necessary changes footnoteParametersToAdd.Count > 0, //update nodes only if parameters added false, //no update of columns node.ParentNode); //performance optimisation Aug 13: update only the concerned function instead of the whole tree }
public void SetColumn(int Index, TreeListColumn Column) { if ((Column != null) && (Index >= 0) && (Index < Width)) { int Handle = IndexToColumnHandle(Index); MyTreeListBand Child = Children.FindAtHandle(Handle); if (Child == null) { Columns[Index] = Column; Column.VisibleIndex = Handle; } else { Child.SetColumn(Child.ColumnHandleToIndex(Handle), Column); Columns[Index] = null; } } }
private void OpenComponent(object sender, EventArgs e) { TreeListColumn clickedColumn = (sender as DXMenuItem).Tag as TreeListColumn; TreeList tl = clickedColumn.TreeList; TreeListNode node = tl.FocusedNode; if (node == null) { return; } ComponentInfo componentInfo = (ComponentInfo)node.Tag; string FFN = componentInfo.FFN; body.OpenDocument(componentInfo.FFN); //foreach (TreeListColumn column in tl.Columns) // column.SummaryFooter = SummaryItemType.None; }
protected bool IsBeforeFixedRight(TreeListColumn column) { if (column.Fixed != FixedStyle.None) { return(false); } int index = column.VisibleIndex; if (++index > TreeList.VisibleColumns.Count - 1) { return(false); } if (TreeList.VisibleColumns[index] == ViewInfo.FixedRightColumn) { return(true); } return(false); }
private void TreeListLoad() { treeList1.KeyFieldName = "Id"; treeList1.OptionsBehavior.PopulateServiceColumns = true; treeList1.DataSource = UserDataGenerator.CreateData(); treeList1.RowHeight = 25; TreeListColumn colUserName = treeList1.Columns["UserName"]; TreeListColumn colPassword = treeList1.Columns["Password"]; TreeListColumn colIPAddress = treeList1.Columns["IPAddress"]; TreeListColumn colPortNumber = treeList1.Columns["PortNumber"]; treeList1.Columns["Password"].Visible = false; treeList1.Columns[treeList1.KeyFieldName].Visible = false; colUserName.OptionsColumn.ReadOnly = true; colIPAddress.OptionsColumn.ReadOnly = true; colPortNumber.OptionsColumn.ReadOnly = true; colPassword.OptionsColumn.ReadOnly = true; }
public static RepositoryItemGridLookUpEdit CreateTreeGridLookUpEdit(this TreeListColumn treeColumn) { RepositoryItemGridLookUpEdit repositoryItem = new RepositoryItemGridLookUpEdit { AutoHeight = false }; GridView repositoryItemGridLookUpEditView = new GridView { FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus }; repositoryItemGridLookUpEditView.OptionsSelection.EnableAppearanceFocusedCell = false; repositoryItemGridLookUpEditView.OptionsView.ShowGroupPanel = false; repositoryItem.View = repositoryItemGridLookUpEditView; treeColumn.TreeList.RepositoryItems.Add(repositoryItem); treeColumn.ColumnEdit = repositoryItem; return(repositoryItem); }
private TreeListFormatRule CreateRule(TreeListColumn column, bool value, Color foreColor, Color backColor) { TreeListFormatRule rule = new TreeListFormatRule(); FormatConditionRuleValue cond = new FormatConditionRuleValue(); cond.Appearance.ForeColor = foreColor; cond.Appearance.BackColor = backColor; cond.Condition = FormatCondition.Equal; cond.Value1 = value; rule.Tag = new object(); rule.Name = column.FieldName + "Equal" + rule.GetHashCode(); rule.Column = column; rule.ApplyToRow = true; rule.ColumnApplyTo = column; rule.Rule = cond; return(rule); }
private void createTreeColumns() { colName = new BodyArchitect.Controls.External.TreeListColumn("Name", "Name"); colShortcut = new BodyArchitect.Controls.External.TreeListColumn("Shortcut", "Shortcut"); colName.Caption = StrengthTrainingEntryStrings.ColumnExerciseName; colShortcut.Caption = StrengthTrainingEntryStrings.ColumnExerciseShortcut; colName.AutoSize = true; colName.AutoSizeMinSize = 0; colName.Width = 50; colShortcut.AutoSizeMinSize = 0; colShortcut.Width = 50; this.Columns.AddRange(new BodyArchitect.Controls.External.TreeListColumn[] { colName, colShortcut }); }
private void FillTreeList(Folder folder, Folder root) { // Configure the list columns if (root == null) { tlsFolders.BeginUpdate(); TreeListColumn col = tlsFolders.Columns.Add(); col.Caption = "Folder"; col.VisibleIndex = 0; tlsFolders.EndUpdate(); } tlsFolders.BeginUnboundLoad(); tlsFolders.EndUnboundLoad(); }
public override void Init(string _titleold, string _menuName, object _param) { this._menuPageName = _menuName; Param = _param as string; string _title = StrUtils.GetMetaByName2("标题", Param); this.Text = _title; string _extFieldStrs = StrUtils.GetMetaByName2("扩展字段", Param); ExtendFields.Clear(); foreach (string _s in _extFieldStrs.Split(',')) { if (_s.Trim().Length > 0) { string[] _cs = _s.Split(':'); ExtendFields.Add(new OrgExtFieldDefine(_cs[0].Trim(), _cs[1].Trim(), _cs[2].Trim())); PropertieDefines.Add(new OrgExtFieldDefine(_cs[0].Trim(), _cs[1].Trim(), _cs[2].Trim())); } } int _order = 10; if (this.ExtendFields.Count > 0) { foreach (OrgExtFieldDefine _item in this.ExtendFields) { TreeListColumn _tc = this.treeList1.Columns.Add(); _tc.Caption = _item.DisplayTitle; _tc.FieldName = _item.FieldName; if (_item.FieldType == "BOOL") { _tc.ColumnEdit = this.repositoryItemCheckEdit1; } _tc.VisibleIndex = _order++; _tc.BestFit(); } } ExtendFields.Add(new OrgExtFieldDefine("ZZJGID", "组织机构ID", "VARCHAR2")); ExtendFields.Add(new OrgExtFieldDefine("SJDWID", "上级单位ID", "VARCHAR2")); ExtendFields.Add(new OrgExtFieldDefine("ZZJGQC", "组织机构全称", "VARCHAR2")); ExtendFields.Add(new OrgExtFieldDefine("JGXSMC", "显示名称", "VARCHAR2")); ExtendFields.Add(new OrgExtFieldDefine("ISDISPLAY", "是否显示", "BOOL")); ExtendFields.Add(new OrgExtFieldDefine("DISPLAYORDER", "显示顺序", "NUMBER")); ShowData(); this._initFinished = true; }
private void AddColumn1()//静态总投资 { //TreeListColumn column = treeList1.Columns["StartYear"]; //column.Caption = "计划开工时间"; //column.Width = 70; //column.OptionsColumn.AllowSort = false; //column.VisibleIndex = -1; ////column.ColumnEdit = repositoryItemTextEdit1; //column.ColumnEdit = this.repositoryItemMemoEdit1; //column.OptionsColumn.AllowEdit = false; //column = treeList1.Columns["EndYear"]; //column.Caption = "计划结束时间"; //column.Width = 70; //column.OptionsColumn.AllowSort = false; //column.VisibleIndex = -1; ////column.ColumnEdit = repositoryItemTextEdit1; //column.ColumnEdit = this.repositoryItemMemoEdit1; //column.OptionsColumn.AllowEdit = false; TreeListColumn column = treeList1.Columns["Remark"]; column.Caption = "备注"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = 799; //column.ColumnEdit = repositoryItemTextEdit1; column.ColumnEdit = this.repositoryItemMemoEdit1; column.OptionsColumn.AllowEdit = false; TreeListColumn column1 = treeList1.Columns["Code"]; column1.Caption = "备注"; column1.Width = 70; column1.OptionsColumn.AllowSort = false; column1.VisibleIndex = 799; //column1.ColumnEdit = repositoryItemTextEdit1; column.ColumnEdit = this.repositoryItemMemoEdit1; column1.OptionsColumn.AllowEdit = false; column1.VisibleIndex = -1; column1.OptionsColumn.ShowInCustomizationForm = false; }
//添加年份后,新增一列 private void AddColumn(int year) { TreeListColumn column = new TreeListColumn(); column.FieldName = "y" + year; column.Tag = year; column.Caption = year + "年"; column.Name = year.ToString(); column.Width = 70; //column.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; column.VisibleIndex = year;//有两列隐藏列 //column.DisplayFormat.FormatString = "#####################0.##"; //column.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; column.Format.FormatString = "#####################0.##"; column.Format.FormatType = DevExpress.Utils.FormatType.Numeric; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); }
public bool TryToSwapColumns(TreeListColumn A, TreeListColumn B) { if ((A == null) || (B == null)) { return(false); } if (TryToSwapBandColumns(A, B)) { return(true); } foreach (MyTreeListBand Child in Children) { if (Child.TryToSwapColumns(A, B)) { return(true); } } return(false); }
/// <summary> /// 将GridView列复制到TreeList /// </summary> /// <param name="sourceGrid">源表格</param> /// <param name="targetTree">目标树</param> public static void CopyColumn(GridView sourceGrid, TreeList targetTree) { foreach (GridColumn item in sourceGrid.Columns.OrderBy(c => c.VisibleIndex)) { if (targetTree.Columns[item.FieldName] == null) { TreeListColumn tc = new TreeListColumn(); tc.FieldName = item.FieldName; tc.Caption = item.Caption; tc.ColumnEdit = item.ColumnEdit; tc.VisibleIndex = item.VisibleIndex; tc.Visible = item.Visible; tc.Width = item.Width; tc.OptionsColumn.AllowEdit = item.OptionsColumn.AllowEdit; tc.OptionsColumn.ReadOnly = item.OptionsColumn.ReadOnly; targetTree.Columns.Add(tc); } } }
private void MainForm_Load(object sender, EventArgs e) { NodeCustomerAccNo = mgr.CreateRootNodeWithCustomerAccountNumber(CustomerAccNo); treeList1.OptionsBehavior.Editable = false; treeList1.OptionsView.ShowIndicator = false; treeList1.OptionsView.ShowVertLines = false; treeList1.OptionsView.ShowHorzLines = false; treeList1.OptionsView.ShowColumns = false; treeList1.OptionsView.ShowSummaryFooter = true; TreeListColumn column = treeList1.Columns[1]; column.AllNodesSummary = true; column.SummaryFooterStrFormat = "{0:0.00}"; column.SummaryFooter = SummaryItemType.Sum; }
private void AddColumn2()//建设期间贷款利息 { TreeListColumn column = treeList1.Columns["L1"]; column.Caption = "长度"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = 800; column.ColumnEdit = repositoryItemTextEdit1; column.OptionsColumn.AllowEdit = false; column = treeList1.Columns["L2"]; column.Caption = "类型"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = 801; column.ColumnEdit = repositoryItemTextEdit1; column.OptionsColumn.AllowEdit = false; column = treeList1.Columns["L3"]; column.Caption = "电压"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = 802; column.ColumnEdit = repositoryItemTextEdit1; column.OptionsColumn.AllowEdit = false; column = treeList1.Columns["L4"]; column.Caption = "负荷率"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = 803; column.ColumnEdit = repositoryItemTextEdit1; column.OptionsColumn.AllowEdit = false; column = treeList1.Columns["L5"]; column.Caption = "所属区域"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = 804; column.ColumnEdit = repositoryItemTextEdit1; column.OptionsColumn.AllowEdit = false; }
/// <summary> /// Function:Set GroupItemControl property /// Author: Jerry Xu /// Date:2008-7-9 /// </summary> private void SetGroupItemControlProperty1() { TreeListColumn column; //Active column = new TreeListColumn(); column.Name = "tlcIsActive"; column.Caption = Resource.GetString(Resource.Strings.PlayListTimeSliceGroupControlGroupItemActiveTitle); column.ColumnEdit = this.ckEdit; column.FieldName = "IsActive"; column.Visible = true; column.VisibleIndex = 0; column.Width = 70; //Name column = new TreeListColumn(); column.Name = "tlcName"; column.Caption = Resource.GetString(Resource.Strings.PlayListTimeSliceGroupControlGroupItemNameTitle); column.FieldName = "Name"; column.Visible = true; column.VisibleIndex = 1; column.Width = 69; //Type column = new TreeListColumn(); column.Name = "tlcType"; column.Caption = Resource.GetString(Resource.Strings.PlayListTimeSliceGroupControlGroupItemTypeTitle); column.FieldName = "Type"; column.Visible = true; column.VisibleIndex = 2; column.Width = 69; //Length column = new TreeListColumn(); column.Name = "tlcLength"; column.Caption = Resource.GetString(Resource.Strings.PlayListTimeSliceGroupControlGroupItemLengthTitle); column.FieldName = "LENGTH"; column.Visible = true; column.VisibleIndex = 3; column.Width = 69; //RepositoryItemCheckEdit ckEdit = new RepositoryItemCheckEdit(); }
private void SetCheckParentNode(TreeListNode node, TreeListColumn col, bool check) { if (node.ParentNode != null) { bool b = false; for (int i = 0; i < node.ParentNode.Nodes.Count; i++) { var state = (bool)node.ParentNode.Nodes[i][col]; if (!check.Equals(state)) { b = true; break; } } bool bb = !b && check; node.ParentNode[col] = bb; SetCheckParentNode(node.ParentNode, col, check); } }
//添加年份后,新增一列 private void AddColumn(int year) { try { int nInsertIndex = GetInsertIndex(year); dataTable.Columns.Add(year + "年", typeof(double)); TreeListColumn column = treeList1.Columns.Insert(nInsertIndex); column.FieldName = year + "年"; column.Tag = year; column.Caption = year + "年"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = nInsertIndex - 2;//有两列隐藏列 } catch { } //column.ColumnEdit = repositoryItemTextEdit1; //treeList1.RefreshDataSource(); }
/// <summary> /// Thiết lập cấu hình TreeList /// </summary> /// <param name="tree">TreeList cần khởi gán</param> /// <param name="showFields">Tên các cột của datasource</param> /// <param name="showFieldNames">Tên các cột hiển thị</param> /// <param name="columnWidth">Độ rộng các cột</param> /// <param name="keyFieldName">Tên cột làm khóa</param> /// <param name="parentFieldName">Tên cột liên kết với node chứa nó</param> public static void Init(TreeList tree, string[] showFields, string[] showFieldNames, int[] columnWidth , string keyFieldName, string parentFieldName) { TreeListColumn treeCol; for (int i = 0; i < showFields.Length; i++) { treeCol = new TreeListColumn(); treeCol.Caption = showFieldNames[i]; treeCol.FieldName = showFields[i]; treeCol.Name = "treeCol" + (i + 1); treeCol.Width = columnWidth[i]; treeCol.Visible = true; treeCol.VisibleIndex = 0; tree.Columns.Add(treeCol); } tree.KeyFieldName = keyFieldName; tree.ParentFieldName = parentFieldName; }
void ShowExamplesInTreeList(TreeList treeList, List <CodeExampleGroup> examples) { #region InitializeTreeList treeList.OptionsPrint.UsePrintStyles = true; treeList.FocusedNodeChanged += new FocusedNodeChangedEventHandler(this.OnNewExampleSelected); treeList.OptionsView.ShowColumns = false; treeList.OptionsView.ShowIndicator = false; treeList.VirtualTreeGetChildNodes += treeList_VirtualTreeGetChildNodes; treeList.VirtualTreeGetCellValue += treeList_VirtualTreeGetCellValue; #endregion TreeListColumn col1 = new TreeListColumn(); col1.VisibleIndex = 0; col1.OptionsColumn.AllowEdit = false; col1.OptionsColumn.AllowMove = false; col1.OptionsColumn.ReadOnly = true; treeList.Columns.AddRange(new TreeListColumn[] { col1 }); treeList.DataSource = new Object(); treeList.ExpandAll(); }
//添加年份后,新增一列 private void AddColumn(int year) { int nInsertIndex = GetInsertIndex(year); dt1.Columns.Add(year + "年", typeof(double)); TreeListColumn column = treeList1.Columns.Insert(nInsertIndex); column.FieldName = year + "年"; column.Tag = year; column.Caption = year + "年"; column.Width = 70; column.OptionsColumn.AllowSort = false; column.VisibleIndex = nInsertIndex - 2;//有两列隐藏列 column.ColumnEdit = repositoryItemTextEdit1; column.Format.FormatType = DevExpress.Utils.FormatType.Custom; column.Format.FormatString = "p2"; //treeList1.RefreshDataSource(); }
private static bool IsNodeMatchFilter(TreeListNode node, TreeListColumn column) { var filterValue = column.FilterInfo.AutoFilterRowValue.ToString(); if (node.GetDisplayText(column) .ToLower() .Contains(filterValue.ToLower())) { return(true); } foreach (TreeListNode n in node.Nodes) { if (IsNodeMatchFilter(n, column)) { return(true); } } return(false); }
private DataTable GetSelectedMenu(ASPxTreeList treelist) { DataTable dtSel = new DataTable(); try { dtSel.Columns.Add("Name"); TreeListNodeIterator iterator = treelist.CreateNodeIterator(); TreeListNode node; TreeListColumn columnId = treelist.Columns["Name"]; while (true) { node = iterator.GetNext(); if (node == null) { break; } if (node.Selected) { DataRow dr = dtSel.NewRow(); dr["Name"] = node.GetValue("Name"); dtSel.Rows.Add(dr); } } } catch (Exception ex) { //Log.Entry.Ins.Write(Server.MapPath("~/LogFiles/"), "VSPlusLog.txt", DateTime.Now.ToString() + " Error in Page: " + // Request.Url.AbsolutePath + ", Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name + // ", Error: " + ex.ToString()); Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } return(dtSel); }
private void CreateColumns(TreeList tl) { RepositoryItemCheckEdit edit; edit = treeList1.RepositoryItems.Add("CheckEdit") as RepositoryItemCheckEdit; tl.BeginUpdate(); TreeListColumn column = treeList1.Columns.Add(); column.FieldName = "rolename"; column.Caption = "Phân quyền"; column.VisibleIndex = 0; TreeListColumn column1 = treeList1.Columns.Add(); column1.FieldName = "per_access"; column1.Caption = "Truy xuất"; column1.VisibleIndex = 1; tl.Columns[1].ColumnEdit = edit; TreeListColumn column2 = treeList1.Columns.Add(); column2.FieldName = "per_read"; column2.Caption = "Đọc"; column2.VisibleIndex = 2; tl.Columns[2].ColumnEdit = edit; TreeListColumn column3 = treeList1.Columns.Add(); column3.FieldName = "per_write"; column3.Caption = "Ghi"; column3.VisibleIndex = 3; tl.Columns[3].ColumnEdit = edit; TreeListColumn column4 = treeList1.Columns.Add(); column4.FieldName = "per_delete"; column4.Caption = "Xóa"; column4.VisibleIndex = 4; tl.Columns[4].ColumnEdit = edit; TreeListColumn column5 = treeList1.Columns.Add(); column5.FieldName = "ID"; column5.Caption = "ID"; tl.Columns[5].VisibleIndex = -1; tl.EndUpdate(); }
private void treeList_CentroCosto_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { try { TreeListColumn Centro_costo = treeList_CentroCosto.Columns["Centro_costo"]; TreeListColumn Centro_costoPadre = treeList_CentroCosto.Columns["Centro_costoPadre"]; TreeListColumn IdCentroCosto = treeList_CentroCosto.Columns["IdCentroCosto"]; TreeListColumn IdCtaCble = treeList_CentroCosto.Columns["IdCtaCble"]; _CentroCostoInfo.Centro_costo = Convert.ToString(e.Node.GetValue(Centro_costo)); _CentroCostoInfo.Centro_costoPadre = Convert.ToString(e.Node.GetValue(Centro_costoPadre)); _CentroCostoInfo.IdCentroCosto = Convert.ToString(e.Node.GetValue(IdCentroCosto)); _CentroCostoInfo.IdCtaCble = Convert.ToString(e.Node.GetValue(IdCtaCble)); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static RepositoryItemImageComboBox CotCombobox(TreeListColumn column, string LookupTable, string IDField, string DisplayField, string ColumnField) { column.AppearanceHeader.Options.UseTextOptions = true; column.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; column.AppearanceCell.Options.UseTextOptions = true; column.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; DatabaseFB db = DABase.getDatabase(); DataSet ds = new DataSet(); ds = db.LoadTable(LookupTable); RepositoryItemImageComboBox rCBB = new RepositoryItemImageComboBox(); //rCBB.Name = "repositoryItemImageComboBoxCode" + LookupTable; foreach (DataRow row in ds.Tables[0].Rows) rCBB.Items.Add(new ImageComboBoxItem("" + row[DisplayField].ToString(), row[IDField])); column.ColumnEdit = rCBB; if (ColumnField != null) column.FieldName = ColumnField; return rCBB; }
private void frmMain_Load(object sender, EventArgs e) { SetTreeViewDataSource(); InitBarItem(); TreeListColumn column = myTreeList.Columns.Add(); column.Caption = "Нэр"; column.FieldName = "NAME"; column.Visible = true; column.VisibleIndex = 0; myTreeList.DoubleClick += new EventHandler(treeList1_DoubleClick); myTreeList.BeforeExpand += new BeforeExpandEventHandler(tree_BeforeExpand); myTreeList.AfterExpand += new NodeEventHandler(tree_AfterExpand); myTreeList.BeforeCollapse += new BeforeCollapseEventHandler(tree_BeforeCollapse); myTreeList.AfterCollapse += new NodeEventHandler(tree_AfterCollapse); myTreeList.DataSource = treeViewDataSource; myTreeList.BringToFront(); }
private bool IsValidColumn(TreeListColumn column, GraphicsInfoArgs columnInfo) { return columnInfo != null && column.Fixed == FixedStyle.None && ((!tree.ViewInfo.HasFixedLeft && columnInfo.Bounds.X > 0) || (tree.ViewInfo.HasFixedLeft && columnInfo.Bounds.X >= tree.ViewInfo.ViewRects.FixedLeft.Right)); }
private static bool IsNodeMatchFilter(TreeListNode node, TreeListColumn column) { var filterValue = column.FilterInfo.AutoFilterRowValue.ToString(); if (node.GetDisplayText(column) .ToLower() .Contains(filterValue.ToLower())) { return true; } foreach (TreeListNode n in node.Nodes) { if (IsNodeMatchFilter(n, column)) { return true; } } return false; }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GeneralCriteria)); this.pnlMain = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel(); this.lv_condition = new DevExpress.XtraTreeList.TreeList(); this.col_Rel = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.col_condition = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.col_op = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.col_value = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.col_fieldid = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.col_type = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.col_tableName = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.splitter1 = new System.Windows.Forms.Splitter(); this.panel1 = new System.Windows.Forms.Panel(); this.gbFilter = new System.Windows.Forms.GroupBox(); this.bt_DelFilter = new System.Windows.Forms.Button(); this.bt_SaveFilter = new System.Windows.Forms.Button(); this.txtFilterName = new System.Windows.Forms.TextBox(); this.bt_DelRow = new System.Windows.Forms.Button(); this.bt_Ok = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); this.tv_List = new System.Windows.Forms.TreeView(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.pnlMain.SuspendLayout(); this.panel2.SuspendLayout(); this.panel4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.lv_condition)).BeginInit(); this.panel1.SuspendLayout(); this.gbFilter.SuspendLayout(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // pnlMain // this.pnlMain.BackColor = System.Drawing.Color.Transparent; this.pnlMain.Controls.Add(this.panel2); this.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlMain.Location = new System.Drawing.Point(0, 0); this.pnlMain.Name = "pnlMain"; this.pnlMain.Size = new System.Drawing.Size(696, 167); this.pnlMain.TabIndex = 0; // // panel2 // this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.Controls.Add(this.panel4); this.panel2.Controls.Add(this.splitter1); this.panel2.Controls.Add(this.panel1); this.panel2.Controls.Add(this.panel3); this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(696, 167); this.panel2.TabIndex = 10; // // panel4 // this.panel4.BackColor = System.Drawing.SystemColors.Control; this.panel4.Controls.Add(this.lv_condition); this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; this.panel4.Location = new System.Drawing.Point(155, 0); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(405, 167); this.panel4.TabIndex = 10; // // lv_condition // this.lv_condition.Appearance.EvenRow.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lv_condition.Appearance.EvenRow.Options.UseFont = true; this.lv_condition.Appearance.OddRow.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lv_condition.Appearance.OddRow.Options.UseFont = true; this.lv_condition.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Style3D; this.lv_condition.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] { this.col_Rel, this.col_condition, this.col_op, this.col_value, this.col_fieldid, this.col_type, this.col_tableName}); this.lv_condition.Dock = System.Windows.Forms.DockStyle.Fill; this.lv_condition.Font = new System.Drawing.Font("SimSun", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lv_condition.IndicatorWidth = 4; this.lv_condition.Location = new System.Drawing.Point(0, 0); this.lv_condition.LookAndFeel.UseDefaultLookAndFeel = false; this.lv_condition.Name = "lv_condition"; this.lv_condition.RootValue = "0"; this.lv_condition.Size = new System.Drawing.Size(405, 167); this.lv_condition.TabIndex = 2; this.lv_condition.TreeLineStyle = DevExpress.XtraTreeList.LineStyle.None; this.lv_condition.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lvMouseDown); this.lv_condition.CustomNodeCellEdit += new DevExpress.XtraTreeList.GetCustomNodeCellEditEventHandler(this.lv_condition_GetCustomNodeCellEdit); this.lv_condition.KeyUp += new System.Windows.Forms.KeyEventHandler(this.lv_condition_KeyUp); // // col_Rel // this.col_Rel.Caption = "关系"; this.col_Rel.FieldName = "关系"; this.col_Rel.Name = "col_Rel"; this.col_Rel.OptionsColumn.AllowSort = false; this.col_Rel.Visible = true; this.col_Rel.VisibleIndex = 0; // // col_condition // this.col_condition.Caption = "字段"; this.col_condition.FieldName = "字段"; this.col_condition.Name = "col_condition"; this.col_condition.OptionsColumn.AllowSort = false; this.col_condition.Visible = true; this.col_condition.VisibleIndex = 1; this.col_condition.Width = 148; // // col_op // this.col_op.Caption = "比较"; this.col_op.FieldName = "比较"; this.col_op.Name = "col_op"; this.col_op.OptionsColumn.AllowSort = false; this.col_op.Visible = true; this.col_op.VisibleIndex = 2; this.col_op.Width = 119; // // col_value // this.col_value.Caption = "比较值"; this.col_value.FieldName = "比较值"; this.col_value.Name = "col_value"; this.col_value.OptionsColumn.AllowSort = false; this.col_value.Visible = true; this.col_value.VisibleIndex = 3; this.col_value.Width = 120; // // col_fieldid // this.col_fieldid.Name = "col_fieldid"; this.col_fieldid.OptionsColumn.AllowSort = false; // // col_type // this.col_type.Name = "col_type"; this.col_type.OptionsColumn.AllowSort = false; // // col_tableName // this.col_tableName.Name = "col_tableName"; this.col_tableName.OptionsColumn.AllowSort = false; // // splitter1 // this.splitter1.BackColor = System.Drawing.SystemColors.Control; this.splitter1.Location = new System.Drawing.Point(152, 0); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(3, 167); this.splitter1.TabIndex = 11; this.splitter1.TabStop = false; // // panel1 // this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Controls.Add(this.gbFilter); this.panel1.Controls.Add(this.bt_DelRow); this.panel1.Controls.Add(this.bt_Ok); this.panel1.Dock = System.Windows.Forms.DockStyle.Right; this.panel1.Location = new System.Drawing.Point(560, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(136, 167); this.panel1.TabIndex = 7; // // gbFilter // this.gbFilter.BackColor = System.Drawing.Color.Transparent; this.gbFilter.Controls.Add(this.bt_DelFilter); this.gbFilter.Controls.Add(this.bt_SaveFilter); this.gbFilter.Controls.Add(this.txtFilterName); this.gbFilter.Dock = System.Windows.Forms.DockStyle.Bottom; this.gbFilter.Location = new System.Drawing.Point(0, 67); this.gbFilter.Name = "gbFilter"; this.gbFilter.Size = new System.Drawing.Size(136, 100); this.gbFilter.TabIndex = 2; this.gbFilter.TabStop = false; this.gbFilter.Text = "保存当明查询条件"; this.gbFilter.Visible = false; // // bt_DelFilter // this.bt_DelFilter.Enabled = false; this.bt_DelFilter.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.bt_DelFilter.Location = new System.Drawing.Point(64, 64); this.bt_DelFilter.Name = "bt_DelFilter"; this.bt_DelFilter.Size = new System.Drawing.Size(48, 24); this.bt_DelFilter.TabIndex = 2; this.bt_DelFilter.Text = "删除"; this.bt_DelFilter.Click += new System.EventHandler(this.bt_DelFilter_Click); // // bt_SaveFilter // this.bt_SaveFilter.Enabled = false; this.bt_SaveFilter.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.bt_SaveFilter.Location = new System.Drawing.Point(8, 64); this.bt_SaveFilter.Name = "bt_SaveFilter"; this.bt_SaveFilter.Size = new System.Drawing.Size(48, 24); this.bt_SaveFilter.TabIndex = 1; this.bt_SaveFilter.Text = "保存"; this.bt_SaveFilter.Click += new System.EventHandler(this.bt_SaveFilter_Click); // // txtFilterName // this.txtFilterName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtFilterName.Location = new System.Drawing.Point(8, 32); this.txtFilterName.Name = "txtFilterName"; this.txtFilterName.Size = new System.Drawing.Size(100, 21); this.txtFilterName.TabIndex = 0; // // bt_DelRow // this.bt_DelRow.BackColor = System.Drawing.Color.Transparent; this.bt_DelRow.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.bt_DelRow.Location = new System.Drawing.Point(8, 35); this.bt_DelRow.Name = "bt_DelRow"; this.bt_DelRow.Size = new System.Drawing.Size(67, 24); this.bt_DelRow.TabIndex = 1; this.bt_DelRow.Text = "删除行"; this.bt_DelRow.UseVisualStyleBackColor = false; this.bt_DelRow.Click += new System.EventHandler(this.BtDelRowClick); // // bt_Ok // this.bt_Ok.BackColor = System.Drawing.Color.Transparent; this.bt_Ok.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.bt_Ok.Location = new System.Drawing.Point(8, 3); this.bt_Ok.Name = "bt_Ok"; this.bt_Ok.Size = new System.Drawing.Size(67, 24); this.bt_Ok.TabIndex = 0; this.bt_Ok.Text = "确定"; this.bt_Ok.UseVisualStyleBackColor = false; this.bt_Ok.Click += new System.EventHandler(this.BtOkClick); // // panel3 // this.panel3.BackColor = System.Drawing.SystemColors.Control; this.panel3.Controls.Add(this.tv_List); this.panel3.Dock = System.Windows.Forms.DockStyle.Left; this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(152, 167); this.panel3.TabIndex = 9; // // tv_List // this.tv_List.Dock = System.Windows.Forms.DockStyle.Fill; this.tv_List.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tv_List.HideSelection = false; this.tv_List.ImageIndex = 0; this.tv_List.ImageList = this.imageList1; this.tv_List.Location = new System.Drawing.Point(0, 0); this.tv_List.Name = "tv_List"; this.tv_List.SelectedImageIndex = 0; this.tv_List.Size = new System.Drawing.Size(152, 167); this.tv_List.TabIndex = 1; this.tv_List.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.AfterSelectCxNode); // // imageList1 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.Images.SetKeyName(0, ""); this.imageList1.Images.SetKeyName(1, ""); this.imageList1.Images.SetKeyName(2, ""); // // GeneralCriteria // this.Controls.Add(this.pnlMain); this.LookAndFeel.UseDefaultLookAndFeel = false; this.Name = "GeneralCriteria"; this.Size = new System.Drawing.Size(696, 167); this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.GeneralCriteria_KeyUp); this.pnlMain.ResumeLayout(false); this.panel2.ResumeLayout(false); this.panel4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.lv_condition)).EndInit(); this.panel1.ResumeLayout(false); this.gbFilter.ResumeLayout(false); this.gbFilter.PerformLayout(); this.panel3.ResumeLayout(false); this.ResumeLayout(false); }
private void Save(TreeListNode node, TreeListColumn column) { Cursor = Cursors.WaitCursor; //List<PSP_ForecastValues> listValues = new List<PSP_ForecastValues>(); string str = ""; str = "set " + column.FieldName + "=" + node.GetValue(column.FieldName) + " where ID='" + node.GetValue("ID") + "'"; try { Common.Services.BaseService.Update("UpdatePs_Forecast_MathbyIDAndYear", str); //MsgBox.Show("���ݱ���ɹ���"); } catch (Exception ex) { MsgBox.Show(ex.Message); } Cursor = Cursors.Default; }
//��ӹ̶��� private void AddFixColumn() { TreeListColumn column = new TreeListColumn(); column.FieldName = "Title"; column.Caption = "������"; column.VisibleIndex = 0; column.Width = 180; column.OptionsColumn.AllowEdit = false; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); column = new TreeListColumn(); column.FieldName = "Sort"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); column = new TreeListColumn(); column.FieldName = "ForecastID"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); column = new TreeListColumn(); column.FieldName = "Forecast"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); column = new TreeListColumn(); column.FieldName = "ID"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); column = new TreeListColumn(); column.FieldName = "ParentID"; column.VisibleIndex = -1; this.treeList1.Columns.AddRange(new TreeListColumn[] { column}); }
public virtual void PaintCellText(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column, TreeList.TextFormatting format, object data) { if (data != null) { cellRect = AdjustRectangle(cellRect, format.Padding); //dc.DrawRectangle(Pens.Black, cellRect); Color color = format.ForeColor; if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles == false && m_owner.Focused) color = SystemColors.HighlightText; TextFormatFlags flags= TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); Font f = m_owner.Font; Font disposefont = null; if(node.Bold && node.Italic) disposefont = f = new Font(f, FontStyle.Bold|FontStyle.Italic); else if (node.Bold) disposefont = f = new Font(f, FontStyle.Bold); else if (node.Italic) disposefont = f = new Font(f, FontStyle.Italic); string datastring = ""; if(m_converter != null) datastring = m_converter(column, data); else datastring = data.ToString(); TextRenderer.DrawText(dc, datastring, f, cellRect, color, flags); if (disposefont != null) disposefont.Dispose(); } }
public virtual void PaintCellText(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column, TreeList.TextFormatting format, object data) { if (data != null) { cellRect = AdjustRectangle(cellRect, format.Padding); //dc.DrawRectangle(Pens.Black, cellRect); Color color = format.ForeColor; if (node.ForeColor != Color.Transparent) color = node.ForeColor; if (m_owner.FocusedNode == node && Application.RenderWithVisualStyles == false && m_owner.Focused) color = SystemColors.HighlightText; TextFormatFlags flags= TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); Font f = m_owner.Font; Font disposefont = null; if(node.Bold && node.Italic) disposefont = f = new Font(f, FontStyle.Bold|FontStyle.Italic); else if (node.Bold) disposefont = f = new Font(f, FontStyle.Bold); else if (node.Italic) disposefont = f = new Font(f, FontStyle.Italic); string datastring = ""; if(m_converter != null) datastring = m_converter(column, data); else datastring = data.ToString(); TextRenderer.DrawText(dc, datastring, f, cellRect, color, flags); Size sz = TextRenderer.MeasureText(dc, datastring, f, new Size(1000000, 10000), flags); int treecolumn = node.TreeColumn; if (treecolumn < 0) treecolumn = node.OwnerView.TreeColumn; if (column.Index == treecolumn) node.ClippedText = (sz.Width > cellRect.Width || sz.Height > cellRect.Height); if (disposefont != null) disposefont.Dispose(); } }
public static RepositoryItemImageComboBox InitCot(TreeListColumn column, string fieldName, bool ReadOnly) { RepositoryItemImageComboBox r = HelpTreeColumn.CotCombobox(column, TABLE_MAP, "ID", "NAME", fieldName); if (ReadOnly) r.NullText = ""; return r; }
public virtual void PaintCellBackground(Graphics dc, Rectangle cellRect, Node node, TreeListColumn column, TreeList.TextFormatting format, object data) { Color c = Color.Transparent; Point mousePoint = m_owner.PointToClient(Cursor.Position); Node hoverNode = m_owner.CalcHitNode(mousePoint); if (format.BackColor != Color.Transparent) c = format.BackColor; if (!m_owner.NodesSelection.Contains(node) && m_owner.FocusedNode != node && !(hoverNode == node && m_owner.RowOptions.HoverHighlight) && node.DefaultBackColor != Color.Transparent) c = node.DefaultBackColor; if (node.BackColor != Color.Transparent) c = node.BackColor; if (column.Index < node.IndexedBackColor.Length && node.IndexedBackColor[column.Index] != Color.Transparent) c = node.IndexedBackColor[column.Index]; if (c != Color.Transparent) { Rectangle r = cellRect; r.X -= Math.Max(0, column.CalculatedRect.Width - cellRect.Width); r.Width += Math.Max(0, column.CalculatedRect.Width - cellRect.Width); SolidBrush brush = new SolidBrush(c); dc.FillRectangle(brush, r); brush.Dispose(); } }
public void DrawHeaderText(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format) { Color color = format.ForeColor; TextFormatFlags flags = TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); TextRenderer.DrawText(dc, column.Caption, column.Font, cellRect, color, flags); }
public virtual void DrawHeader(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format, bool isHot, bool highlight) { Rectangle textRect = AdjustRectangle(cellRect, format.Padding); if (!Application.RenderWithVisualStyles) { ControlPaint.DrawButton(dc, cellRect, m_owner.ViewOptions.UserRearrangeableColumns && highlight ? ButtonState.Pushed : ButtonState.Flat); DrawHeaderText(dc, textRect, column, format); return; } VisualStyleElement element = VisualStyleElement.Header.Item.Normal; if (isHot || highlight) element = VisualStyleElement.Header.Item.Hot; if (VisualStyleRenderer.IsElementDefined(element)) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(dc, cellRect); if (format.BackColor != Color.Transparent) { SolidBrush brush = new SolidBrush(format.BackColor); dc.FillRectangle(brush, cellRect); brush.Dispose(); } //dc.DrawRectangle(Pens.Black, cellRect); DrawHeaderText(dc, textRect, column, format); } }
private void treeList1_ShownEditor(object sender, EventArgs e) { lastEditColumn = treeList1.FocusedColumn; lastEditNode = treeList1.FocusedNode; lastEditValue = treeList1.FocusedNode.GetValue(lastEditColumn.FieldName).ToString(); }
private void InitControl() { DMHardDisks.InitCtrl(HD,false); HD.imgCombo.Properties.ReadOnly = ReadOnlyHD; HD.imgCombo.Properties.Buttons[0].Visible = !ReadOnlyHD; dmTree =new DMTreeGroup(); string table = (this.IsAdd == true ? "V_HARD_DISKS_VISIBLE" : "HARD_DISKS"); dmTree.Init(GroupElementType.ONLY_CHOICE, table, "ID", "PARENT_ID", new string[] { "NAME" }, new String[] { "Thư mục"}, "G_FW_DT_ID", new object[] { TreeListColumnType.TextType }, new FieldNameCheck[] { new FieldNameCheck("NAME", new CheckType[]{ CheckType.Required, CheckType.RequireMaxLength }, "Thư mục", new object[]{ null, 200 }) } ); dmTree.VisibleChanged += delegate(object sender, EventArgs e) { DataTable dtSource = dmTree.TreeList_1.DataSource as DataTable; dmTree.TreeList_1.DataSource = AppUtil.SortLogicalTable(dtSource, "NAME"); }; columnRoot = dmTree.TreeList_1.Columns.Add(); columnRoot.FieldName = "ID_ROOT"; columnRoot.Caption = ""; columnRoot.Visible = false; dmTree.btnAdd.Owner.Visible = false; panel1.Controls.Add(dmTree); dmTree.Dock = DockStyle.Fill; if (hideTextFile) { textEdit1.Visible = false; pllblTenFile.Visible = false; } }
//////计算静态总投资列表 ////private void Sumss(TreeListNode node, TreeListColumn column) ////{ //// TreeListNode parentNode = node.ParentNode; //// if (parentNode == null) //// { //// return; //// } //// double sum = 0; //// foreach (TreeListNode nd in parentNode.Nodes) //// { //// object value = nd.GetValue(column.FieldName); //// if (value != null && value != DBNull.Value) //// { //// sum += Convert.ToDouble(value); //// } //// } //// parentNode.SetValue(column.FieldName, sum); //// Sumss(parentNode, column); ////} //////计算静态总投资 ////private void CalculateNodeSum(TreeListNode node) ////{ //// double sum = 0.0; //// foreach (TreeListColumn col in treeList1.Columns) //// { //// if (col.Caption.IndexOf("年") > 0) //// { //// try //// { //// sum += (double)node[col.FieldName]; //// } //// catch { } //// } //// } //// node["JingTai"] = sum; //// if (node.ParentNode != null) //// { //// CalculateNodeSum(node.ParentNode); //// } ////} //当子分类数据改变时,计算其父分类的值 private void CalculateSum(TreeListNode node, TreeListColumn column) { TreeListNode parentNode = node.ParentNode; if (parentNode == null) { return; } double sum = 0; foreach(TreeListNode nd in parentNode.Nodes) { object value = nd.GetValue(column.FieldName); if(value != null && value != DBNull.Value) { sum += Convert.ToDouble(value); } } parentNode.SetValue(column.FieldName, sum); if (column.FieldName != "Lixi" && column.FieldName != "Yubei" && column.FieldName != "Dongtai") { SaveCellValue((int)column.Tag, (int)parentNode.GetValue("ID"), sum); } else { // SaveCellValue(column.FieldName,(int)parentNode.GetValue("ID"), sum); } CalculateSum(parentNode, column); }
public virtual void PaintCellPlusMinus(Graphics dc, Rectangle glyphRect, Node node, TreeListColumn column, TreeList.TextFormatting format) { if (!Application.RenderWithVisualStyles) { // find square rect first int diff = glyphRect.Height-glyphRect.Width; glyphRect.Y += diff/2; glyphRect.Height -= diff; // draw 8x8 box centred while (glyphRect.Height > 8) { glyphRect.Height -= 2; glyphRect.Y += 1; glyphRect.X += 1; } // make a box glyphRect.Width = glyphRect.Height; // clear first SolidBrush brush = new SolidBrush(format.BackColor); if (format.BackColor == Color.Transparent) brush = new SolidBrush(m_owner.BackColor); dc.FillRectangle(brush, glyphRect); brush.Dispose(); // draw outline Pen p = new Pen(SystemColors.ControlDark); dc.DrawRectangle(p, glyphRect); p.Dispose(); p = new Pen(SystemColors.ControlText); // reduce box for internal lines glyphRect.X += 2; glyphRect.Y += 2; glyphRect.Width -= 4; glyphRect.Height -= 4; // draw horizontal line always dc.DrawLine(p, glyphRect.X, glyphRect.Y + glyphRect.Height / 2, glyphRect.X + glyphRect.Width, glyphRect.Y + glyphRect.Height / 2); // draw vertical line if this should be a + if(!node.Expanded) dc.DrawLine(p, glyphRect.X + glyphRect.Width / 2, glyphRect.Y, glyphRect.X + glyphRect.Width / 2, glyphRect.Y + glyphRect.Height); p.Dispose(); return; } VisualStyleElement element = VisualStyleElement.TreeView.Glyph.Closed; if (node.Expanded) element = VisualStyleElement.TreeView.Glyph.Opened; if (VisualStyleRenderer.IsElementDefined(element)) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(dc, glyphRect); } }
//���ӷ������ݸı�ʱ�������丸�����ֵ private void CalculateSum2(TreeListNode node, TreeListColumn column) { TreeListNode parentNode = node.ParentNode; if (parentNode == null) { return; } double sum = 0; foreach (TreeListNode nd in parentNode.Nodes) { object value = nd.GetValue(column.FieldName); if (value != null && value != DBNull.Value) { sum += Convert.ToDouble(value); } } parentNode.SetValue(column.FieldName, sum); CalculateSum2(parentNode, column); }
private void CalculateSum(TreeListNode node, TreeListColumn column) { DataRow row = (node.TreeList.GetDataRecordByNode(node) as DataRowView).Row; Ps_Forecast_Math v = DataConverter.RowToObject<Ps_Forecast_Math>(row); Common.Services.BaseService.Update<Ps_Forecast_Math>(v); TreeListNode parentNode = node.ParentNode; if (parentNode == null) { return; } double sum = 0; bool TSL_falg = false; double Tsl_double = 0; foreach (TreeListNode nd in parentNode.Nodes) { if (nd["Title"].ToString().Contains("ͬʱ��")) { //��¼ͬʱ�� if (Convert.ToDouble(nd[column].ToString()) != 0) { TSL_falg = true; Tsl_double = Convert.ToDouble(nd[column].ToString()); } continue; } object value = nd.GetValue(column.FieldName); if (value != null && value != DBNull.Value) { sum += Convert.ToDouble(value); } } if (sum != 0) { if (TSL_falg) { sum = sum * Tsl_double; } parentNode.SetValue(column.FieldName, sum); } else { parentNode.SetValue(column.FieldName, null); } CalculateSum(parentNode, column); }
//���ӷ������ݸı�ʱ�������丸�����ֵ private void CalculateSum2(TreeListNode node, TreeListColumn column) { TreeListNode parentNode = node.ParentNode; if (parentNode == null) { return; } double sum = 0; bool TSL_falg = false; double Tsl_double = 0; foreach (TreeListNode nd in parentNode.Nodes) { if (nd["Title"].ToString().Contains("ͬʱ��")) { //��¼ͬʱ�� if (Convert.ToDouble(nd[column].ToString()) != 0) { TSL_falg = true; Tsl_double = Convert.ToDouble(nd[column].ToString()); } continue; } object value = nd.GetValue(column.FieldName); if (value != null && value != DBNull.Value) { sum += Convert.ToDouble(value); } } if (TSL_falg) { sum = sum * Tsl_double; } parentNode.SetValue(column.FieldName, sum); Save(node, column); CalculateSum2(parentNode, column); }
public virtual void DrawHeader(Graphics dc, Rectangle cellRect, TreeListColumn column, TreeList.TextFormatting format, bool isHot) { if (!Application.RenderWithVisualStyles) { ControlPaint.DrawButton(dc, cellRect, ButtonState.Flat); return; } VisualStyleElement element = VisualStyleElement.Header.Item.Normal; if (isHot) element = VisualStyleElement.Header.Item.Hot; if (VisualStyleRenderer.IsElementDefined(element)) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(dc, cellRect); if (format.BackColor != Color.Transparent) { SolidBrush brush = new SolidBrush(format.BackColor); dc.FillRectangle(brush, cellRect); brush.Dispose(); } cellRect = CommonTools.Util.AdjustRectangle(cellRect, format.Padding); //dc.DrawRectangle(Pens.Black, cellRect); Color color = format.ForeColor; TextFormatFlags flags= TextFormatFlags.EndEllipsis | format.GetFormattingFlags(); TextRenderer.DrawText(dc, column.Caption, column.Font, cellRect, color, flags); } }