/// <summary> /// 设置隐藏列 /// </summary> void initColumns() { for (int i = 0; i < gridView1.Columns.Count; i++) { gridView1.Columns[i].Caption = AttributeHelper.GetDisplayName(typeof(LP_Record), gridView1.Columns[i].FieldName); } gridView1.Columns["ParentID"].Visible = false; gridView1.Columns["Content"].Visible = false; gridView1.Columns["DocContent"].Visible = false; gridView1.Columns["SignImg"].Visible = false; gridView1.Columns["SortID"].Visible = false; gridView1.Columns["ImageAttachment"].Visible = false; gridView1.Columns["Kind"].Visible = false; gridView1.Columns["Number"].VisibleIndex = 0; gridView1.Columns["Number"].Width = 150; gridView1.Columns["Status"].VisibleIndex = 1; gridView1.Columns["Status"].Width = 100; gridView1.Columns["LastChangeTime"].VisibleIndex = 2; gridView1.Columns["LastChangeTime"].Width = 200; gridView1.Columns["CreateTime"].VisibleIndex = 4; gridView1.Columns["CreateTime"].Width = 200; //gridView1.Columns["OrgName"].Visible = false; //gridView1.Columns["Password"].ColumnEdit = repositoryItemTextEdit1; //repositoryItemTextEdit1.EditValueChanged += new EventHandler(repositoryItemTextEdit1_EditValueChanged); //((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit(); //((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); //if (picview == null) { //imageEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemImageEdit(); //((System.ComponentModel.ISupportInitialize)(this.imageEdit1)).BeginInit(); //// //// imageEdit1 //// //this.imageEdit1.AutoHeight = false; //this.imageEdit1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; //this.imageEdit1.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { // new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); //this.imageEdit1.Name = "imageEdit1"; //this.imageEdit1.PopupFormSize = new System.Drawing.Size(1200, 600); //((System.ComponentModel.ISupportInitialize)(this.imageEdit1)).EndInit(); picview = new DevExpress.XtraGrid.Columns.GridColumn(); picview.Caption = "流程图"; picview.Visible = true; //picview.MaxWidth = 300; //picview.MinWidth = 300; //gridControl1.RepositoryItems.Add(imageEdit1); //picview.ColumnEdit = imageEdit1; //DevExpress.XtraEditors.Repository.RepositoryItem //this.picview.VisibleIndex =1; //picview.FieldName = "Image"; this.repositoryItemHyperLinkEdit1 = new DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit(); this.repositoryItemHyperLinkEdit2 = new DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit(); ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemHyperLinkEdit1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemHyperLinkEdit2)).BeginInit(); this.SuspendLayout(); this.repositoryItemHyperLinkEdit1.AutoHeight = false; ; this.repositoryItemHyperLinkEdit1.Caption = "查看"; this.repositoryItemHyperLinkEdit1.Name = "repositoryItemHyperLinkEdit1"; this.repositoryItemHyperLinkEdit1.Click += new System.EventHandler(this.repositoryItemHyperLinkEdit1_Click); this.picview.Caption = "流程图"; this.picview.ColumnEdit = this.repositoryItemHyperLinkEdit1; this.picview.VisibleIndex = 1; picview.FieldName = "Image"; gridView1.Columns.Add(picview); this.gridView1.Columns["Status"].ColumnEdit = this.repositoryItemHyperLinkEdit2; this.repositoryItemHyperLinkEdit2.AutoHeight = false; this.repositoryItemHyperLinkEdit2.Name = "repositoryItemHyperLinkEdit2"; this.repositoryItemHyperLinkEdit2.Click += new System.EventHandler(this.repositoryItemHyperLinkEdit2_Click); gridView1.Columns.Add(picview); ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemHyperLinkEdit2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.repositoryItemHyperLinkEdit1)).EndInit(); this.ResumeLayout(false); } }
/// <summary>Cột Hyperlink cho phép mở 1 form. /// Chỉ hoạt động đối với lưới có thể cập nhật /// </summary> public static RepositoryItemHyperLinkEdit CotModalFormLink(GridColumn column, String columnField, String ClassFormName) { DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit repos = new DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit(); repos.Click += delegate(object sender, EventArgs e) { DataRow dr = column.View.GetDataRow(column.View.FocusedRowHandle); Int64 key = HelpNumber.ParseInt64(dr[columnField]); // Int64 Key = HelpNumber.ParseInt64(Column.View.EditingValue); if (key < 0) { return; } else { Object obj = GenerateClass.initObject(ClassFormName, key); // Tag quan trọng repos.Tag = obj; } }; column.ColumnEdit = repos; column.FieldName = columnField; return repos; }