private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = ds.Tables[0].TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.ReadOnly = false; ts.RowHeaderWidth = 10; DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ngay"; TextCol.HeaderText = "Ngày"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "idcls"; TextCol.HeaderText = "ID"; TextCol.Width = 60; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "mabn"; TextCol.HeaderText = "Mã BN"; TextCol.Width = 60; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "hoten"; TextCol.HeaderText = "Họ tên"; TextCol.Width = 150; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "namsinh"; TextCol.HeaderText = "NS"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "may"; TextCol.HeaderText = "Máy"; TextCol.Width = 120; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "vung"; TextCol.HeaderText = "Vùng"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenbs"; TextCol.HeaderText = "Bác sĩ"; TextCol.Width = 150; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "doituong"; TextCol.HeaderText = "Đối tượng"; TextCol.Width = 80; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "cpt"; TextCol.HeaderText = "CP"; TextCol.Width = 60; TextCol.Format = "### ### ### ###"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "lt"; TextCol.HeaderText = "LT"; TextCol.Width = 60; TextCol.Format = "### ### ### ###"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.txtSearch = new System.Windows.Forms.TextBox(); this.lblHeader = new System.Windows.Forms.Label(); this.dgContacts = new System.Windows.Forms.DataGrid(); this.dgStyle = new System.Windows.Forms.DataGridTableStyle(); this.ContactID = new System.Windows.Forms.DataGridTextBoxColumn(); this.ContactCode = new System.Windows.Forms.DataGridTextBoxColumn(); this.ContactName = new System.Windows.Forms.DataGridTextBoxColumn(); this.Debit = new System.Windows.Forms.DataGridTextBoxColumn(); this.Credit = new System.Windows.Forms.DataGridTextBoxColumn(); this.CreditLimit = new System.Windows.Forms.DataGridTextBoxColumn(); this.IsCreditAllowed = new System.Windows.Forms.DataGridTextBoxColumn(); this.PositionName = new System.Windows.Forms.DataGridTextBoxColumn(); this.DepartmentName = new System.Windows.Forms.DataGridTextBoxColumn(); this.imgIcon = new System.Windows.Forms.PictureBox(); this.lblUpdateCustomer = new System.Windows.Forms.Label(); this.lblPress = new System.Windows.Forms.Label(); this.lblF6 = new System.Windows.Forms.Label(); this.lblF2 = new System.Windows.Forms.Label(); this.lblAddNewCustomer = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dgContacts)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgIcon)).BeginInit(); this.SuspendLayout(); // // txtSearch // this.txtSearch.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtSearch.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtSearch.Location = new System.Drawing.Point(67, 27); this.txtSearch.Name = "txtSearch"; this.txtSearch.Size = new System.Drawing.Size(298, 23); this.txtSearch.TabIndex = 0; this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged); // // lblHeader // this.lblHeader.AutoSize = true; this.lblHeader.BackColor = System.Drawing.Color.Transparent; this.lblHeader.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblHeader.ForeColor = System.Drawing.Color.White; this.lblHeader.Location = new System.Drawing.Point(67, 9); this.lblHeader.Name = "lblHeader"; this.lblHeader.Size = new System.Drawing.Size(125, 13); this.lblHeader.TabIndex = 4; this.lblHeader.Text = "Enter search criteria."; // // dgContacts // this.dgContacts.AlternatingBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dgContacts.BackColor = System.Drawing.Color.White; this.dgContacts.BackgroundColor = System.Drawing.Color.White; this.dgContacts.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.dgContacts.CaptionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dgContacts.CaptionFont = new System.Drawing.Font("Tahoma", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgContacts.CaptionForeColor = System.Drawing.Color.Blue; this.dgContacts.CaptionVisible = false; this.dgContacts.DataMember = ""; this.dgContacts.Dock = System.Windows.Forms.DockStyle.Bottom; this.dgContacts.FlatMode = true; this.dgContacts.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgContacts.HeaderBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(81)))), ((int)(((byte)(153))))); this.dgContacts.HeaderFont = new System.Drawing.Font("Tahoma", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgContacts.HeaderForeColor = System.Drawing.Color.White; this.dgContacts.Location = new System.Drawing.Point(0, 67); this.dgContacts.Name = "dgContacts"; this.dgContacts.PreferredRowHeight = 50; this.dgContacts.ReadOnly = true; this.dgContacts.RowHeadersVisible = false; this.dgContacts.RowHeaderWidth = 5; this.dgContacts.SelectionBackColor = System.Drawing.Color.RoyalBlue; this.dgContacts.SelectionForeColor = System.Drawing.Color.WhiteSmoke; this.dgContacts.Size = new System.Drawing.Size(1022, 699); this.dgContacts.TabIndex = 5; this.dgContacts.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] { this.dgStyle }); this.dgContacts.TabStop = false; this.dgContacts.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgContacts_MouseDown); // // dgStyle // this.dgStyle.AlternatingBackColor = System.Drawing.Color.White; this.dgStyle.BackColor = System.Drawing.Color.White; this.dgStyle.DataGrid = this.dgContacts; this.dgStyle.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] { this.ContactID, this.ContactCode, this.ContactName, this.Debit, this.Credit, this.CreditLimit, this.IsCreditAllowed, this.PositionName, this.DepartmentName }); this.dgStyle.HeaderBackColor = System.Drawing.Color.DarkOrange; this.dgStyle.HeaderFont = new System.Drawing.Font("Tahoma", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgStyle.HeaderForeColor = System.Drawing.Color.White; this.dgStyle.MappingName = "tblContacts"; this.dgStyle.PreferredColumnWidth = 180; this.dgStyle.PreferredRowHeight = 40; this.dgStyle.ReadOnly = true; this.dgStyle.RowHeadersVisible = false; this.dgStyle.RowHeaderWidth = 5; this.dgStyle.SelectionBackColor = System.Drawing.Color.Green; this.dgStyle.SelectionForeColor = System.Drawing.Color.White; // // ContactID // this.ContactID.Format = ""; this.ContactID.FormatInfo = null; this.ContactID.HeaderText = "ID"; this.ContactID.MappingName = "ContactID"; this.ContactID.NullText = ""; this.ContactID.ReadOnly = true; this.ContactID.Width = 0; // // ContactCode // this.ContactCode.Format = ""; this.ContactCode.FormatInfo = null; this.ContactCode.HeaderText = "Contact Code"; this.ContactCode.MappingName = "ContactCode"; this.ContactCode.NullText = ""; this.ContactCode.ReadOnly = true; this.ContactCode.Width = 200; // // ContactName // this.ContactName.Format = ""; this.ContactName.FormatInfo = null; this.ContactName.HeaderText = "Contact Name"; this.ContactName.MappingName = "ContactName"; this.ContactName.NullText = ""; this.ContactName.ReadOnly = true; this.ContactName.Width = 200; // // Debit // this.Debit.Format = ""; this.Debit.FormatInfo = null; this.Debit.HeaderText = "Debit"; this.Debit.MappingName = "Debit"; this.Debit.NullText = ""; this.Debit.ReadOnly = true; this.Debit.Width = 0; // // Credit // this.Credit.Format = ""; this.Credit.FormatInfo = null; this.Credit.HeaderText = "Credit"; this.Credit.MappingName = "Credit"; this.Credit.NullText = ""; this.Credit.ReadOnly = true; this.Credit.Width = 0; // // CreditLimit // this.CreditLimit.Format = ""; this.CreditLimit.FormatInfo = null; this.CreditLimit.HeaderText = "CreditLimit"; this.CreditLimit.MappingName = "CreditLimit"; this.CreditLimit.NullText = ""; this.CreditLimit.ReadOnly = true; this.CreditLimit.Width = 0; // // IsCreditAllowed // this.IsCreditAllowed.Format = ""; this.IsCreditAllowed.FormatInfo = null; this.IsCreditAllowed.HeaderText = "Allow Credit"; this.IsCreditAllowed.MappingName = "IsCreditAllowed"; this.IsCreditAllowed.NullText = ""; this.IsCreditAllowed.ReadOnly = true; this.IsCreditAllowed.Width = 0; // // PositionName // this.PositionName.Format = ""; this.PositionName.FormatInfo = null; this.PositionName.HeaderText = "PositionName"; this.PositionName.MappingName = "PositionName"; this.PositionName.NullText = ""; this.PositionName.ReadOnly = true; this.PositionName.Width = 0; // // DepartmentName // this.DepartmentName.Format = ""; this.DepartmentName.FormatInfo = null; this.DepartmentName.HeaderText = "DepartmentName"; this.DepartmentName.MappingName = "DepartmentName"; this.DepartmentName.NullText = ""; this.DepartmentName.ReadOnly = true; this.DepartmentName.Width = 0; // // imgIcon // this.imgIcon.BackColor = System.Drawing.Color.Blue; this.imgIcon.Location = new System.Drawing.Point(9, 5); this.imgIcon.Name = "imgIcon"; this.imgIcon.Size = new System.Drawing.Size(49, 49); this.imgIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.imgIcon.TabIndex = 0; this.imgIcon.TabStop = false; this.imgIcon.Click += new System.EventHandler(this.imgIcon_Click); // // lblUpdateCustomer // this.lblUpdateCustomer.AutoSize = true; this.lblUpdateCustomer.BackColor = System.Drawing.Color.Transparent; this.lblUpdateCustomer.ForeColor = System.Drawing.Color.DarkSlateGray; this.lblUpdateCustomer.Location = new System.Drawing.Point(845, 25); this.lblUpdateCustomer.Name = "lblUpdateCustomer"; this.lblUpdateCustomer.Size = new System.Drawing.Size(147, 13); this.lblUpdateCustomer.TabIndex = 115; this.lblUpdateCustomer.Text = " to update selected customer"; // // lblPress // this.lblPress.AutoSize = true; this.lblPress.BackColor = System.Drawing.Color.Transparent; this.lblPress.ForeColor = System.Drawing.Color.DarkSlateGray; this.lblPress.Location = new System.Drawing.Point(771, 9); this.lblPress.Name = "lblPress"; this.lblPress.Size = new System.Drawing.Size(33, 13); this.lblPress.TabIndex = 114; this.lblPress.Text = "Press"; // // lblF6 // this.lblF6.BackColor = System.Drawing.Color.Transparent; this.lblF6.ForeColor = System.Drawing.Color.Red; this.lblF6.Location = new System.Drawing.Point(806, 25); this.lblF6.Name = "lblF6"; this.lblF6.Size = new System.Drawing.Size(27, 13); this.lblF6.TabIndex = 113; this.lblF6.Text = "[F6]"; // // lblF2 // this.lblF2.AutoSize = true; this.lblF2.BackColor = System.Drawing.Color.Transparent; this.lblF2.ForeColor = System.Drawing.Color.Red; this.lblF2.Location = new System.Drawing.Point(805, 9); this.lblF2.Name = "lblF2"; this.lblF2.Size = new System.Drawing.Size(27, 13); this.lblF2.TabIndex = 112; this.lblF2.Text = "[F2]"; // // lblAddNewCustomer // this.lblAddNewCustomer.AutoSize = true; this.lblAddNewCustomer.BackColor = System.Drawing.Color.Transparent; this.lblAddNewCustomer.ForeColor = System.Drawing.Color.DarkSlateGray; this.lblAddNewCustomer.Location = new System.Drawing.Point(845, 9); this.lblAddNewCustomer.Name = "lblAddNewCustomer"; this.lblAddNewCustomer.Size = new System.Drawing.Size(111, 13); this.lblAddNewCustomer.TabIndex = 111; this.lblAddNewCustomer.Text = " to add new customer"; // // ContactSelectWnd // this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(1022, 766); this.ControlBox = false; this.Controls.Add(this.lblUpdateCustomer); this.Controls.Add(this.lblPress); this.Controls.Add(this.lblF6); this.Controls.Add(this.lblF2); this.Controls.Add(this.lblAddNewCustomer); this.Controls.Add(this.dgContacts); this.Controls.Add(this.lblHeader); this.Controls.Add(this.txtSearch); this.Controls.Add(this.imgIcon); this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.KeyPreview = true; this.MaximizeBox = false; this.Name = "ContactSelectWnd"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.ContactSelectWnd_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ContactSelectWnd_KeyDown); this.Resize += new System.EventHandler(this.ContactSelectWnd_Resize); ((System.ComponentModel.ISupportInitialize)(this.dgContacts)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgIcon)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void PositionDone() { DataGridTableStyle dts = new DataGridTableStyle(); #region DataGridTextBoxColumn DataGridTextBoxColumn dtbc; dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "货位编码"; dtbc.MappingName = "PosCode"; dtbc.Width = 80; dtbc.Format = "G"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "存货编码"; dtbc.MappingName = "InvCode"; dtbc.Width = 120; dtbc.Format = "G"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "存货名称"; dtbc.MappingName = "InvName"; dtbc.Width = 120; dtbc.Format = "G"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "规格型号"; dtbc.MappingName = "InvStd"; dtbc.Width = 100; dtbc.Format = "G"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "扫描数量"; dtbc.MappingName = "Quantity"; dtbc.Width = 100; dtbc.Format = "F4"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "批号"; dtbc.MappingName = "Batch"; dtbc.Width = 100; dtbc.Format = "G"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "产地"; dtbc.MappingName = "Address"; dtbc.Width = 50; dtbc.Format = "G"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "生产日期"; dtbc.MappingName = "MadeDate"; dtbc.Width = 100; dtbc.Format = "yyyy-MM-dd"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "有效期至"; dtbc.MappingName = "ExpirationDate"; dtbc.Width = 100; dtbc.Format = "yyyy-MM-dd"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "失效日期"; dtbc.MappingName = "VDate"; dtbc.Width = 100; dtbc.Format = "yyyy-MM-dd"; dts.GridColumnStyles.Add(dtbc); dgPosition.TableStyles.Add(dts); #endregion dts.MappingName = posList.GetType().Name; }
public frmSaleOutSourceList(List <DispatchDetail> ls) { InitializeComponent(); if (ls == null || ls.Count < 1) { return; } DataGridTableStyle dts = new DataGridTableStyle(); DataGridTextBoxColumn dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "存货编码"; dtbc.MappingName = "cinvcode"; dtbc.Width = 80; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "存货名称"; dtbc.MappingName = "cinvname"; dtbc.Width = 90; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "数量"; dtbc.MappingName = "iquantity"; dtbc.Width = 70; dtbc.Format = "F2"; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "累计发货数量"; dtbc.MappingName = "IFHQuantity"; dtbc.Width = 70; dtbc.Format = "F2"; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "规格"; dtbc.MappingName = "cinvstd"; dtbc.Width = 90; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "产地"; dtbc.MappingName = "cdefine22"; dtbc.Width = 100; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "主计量单位"; dtbc.MappingName = "comunit"; dtbc.Width = 70; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "含税单价"; dtbc.MappingName = "itaxunitprice"; dtbc.Width = 70; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "客户名称"; dtbc.MappingName = "ccusname"; dtbc.Width = 120; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "客户简称"; dtbc.MappingName = "ccusabbname"; dtbc.Width = 120; dts.GridColumnStyles.Add(dtbc); dataGrid1.TableStyles.Add(dts); dataGrid1.RowHeadersVisible = true; dts.MappingName = ls.GetType().Name; this.dataGrid1.DataSource = ls; }
private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = ds.Tables[0].TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.FromArgb(0, 255, 255); ts.SelectionForeColor = Color.PaleGreen; ts.RowHeaderWidth = 3; ts.AllowSorting = false; FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn(); discontinuedCol.MappingName = "chon"; discontinuedCol.HeaderText = "Duyệt"; discontinuedCol.Width = 35; discontinuedCol.ReadOnly = false; discontinuedCol.AllowNull = false; discontinuedCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged); ts.GridColumnStyles.Add(discontinuedCol); dataGrid1.TableStyles.Add(ts); FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "ngay"; TextCol.HeaderText = "Ngày"; TextCol.Width = 55; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "ten"; TextCol.HeaderText = "Tên thuốc - hàm lượng"; TextCol.Width = 150; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "dang"; TextCol.HeaderText = "ĐVT"; TextCol.Width = 30; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "slylenh"; TextCol.HeaderText = "SL"; TextCol.Width = 45; TextCol.Format = "### ##0.00"; TextCol.Alignment = HorizontalAlignment.Right; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "tenkp"; TextCol.HeaderText = "Khoa"; TextCol.Width = 80; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "tenbs"; TextCol.HeaderText = "Bác sĩ"; TextCol.Width = 150; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "mabn"; TextCol.HeaderText = "Mã BN"; TextCol.Width = 60; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "hoten"; TextCol.HeaderText = "Họ tên bệnh nhân"; TextCol.Width = 160; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
private void AddGridTableStyle2() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = ds.Tables[0].TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.FromArgb(0, 255, 255); ts.SelectionForeColor = Color.PaleGreen; ts.RowHeaderWidth = 3; ts.AllowSorting = false; FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn(); discontinuedCol.MappingName = "chon"; discontinuedCol.HeaderText = "Bỏ"; discontinuedCol.Width = 20; discontinuedCol.AllowNull = false; discontinuedCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged2); ts.GridColumnStyles.Add(discontinuedCol); dataGrid2.TableStyles.Add(ts); FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "hoten"; TextCol.HeaderText = "Họ tên"; TextCol.Width = 0; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "ma"; TextCol.HeaderText = "Mã"; TextCol.Width = 60; //TextCol.ReadOnly=true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "ten"; TextCol.HeaderText = "Tên thuốc"; TextCol.Width = 180; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "dang"; TextCol.HeaderText = "ĐVT"; TextCol.Width = 35; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "soluong"; TextCol.HeaderText = "Số lượng"; TextCol.Width = 50; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "makho"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "giaban"; TextCol.HeaderText = "Đơn gía"; TextCol.Width = 60; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "sotienban"; TextCol.HeaderText = "Số tiền"; TextCol.Width = 60; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat2); ts.GridColumnStyles.Add(TextCol); dataGrid2.TableStyles.Add(ts); }
/// <summary> /// 初始化表格控件 /// </summary> private void InitGrid() { var dgts = new DataGridTableStyle { MappingName = rds.RmPo.TableName }; DataGridColumnStyle dgAutoID = new DataGridTextBoxColumn(); dgAutoID.Width = 40; dgAutoID.MappingName = "RowNo"; dgAutoID.HeaderText = "序号"; dgts.GridColumnStyles.Add(dgAutoID); DataGridColumnStyle dgccOrderNumber = new DataGridTextBoxColumn(); dgccOrderNumber.Width = 120; dgccOrderNumber.MappingName = "cOrderNumber"; dgccOrderNumber.HeaderText = "采购单号"; dgts.GridColumnStyles.Add(dgccOrderNumber); DataGridColumnStyle dgccInvCode = new DataGridTextBoxColumn(); dgccInvCode.Width = 60; dgccInvCode.MappingName = "cInvCode"; dgccInvCode.HeaderText = "原料编码"; dgts.GridColumnStyles.Add(dgccInvCode); DataGridColumnStyle dgccInvName = new DataGridTextBoxColumn(); dgccInvName.Width = 80; dgccInvName.MappingName = "cInvName"; dgccInvName.HeaderText = "原料名称"; dgts.GridColumnStyles.Add(dgccInvName); //DataGridColumnStyle dgccUnit = new DataGridTextBoxColumn(); //dgccUnit.Width = 60; //dgccUnit.MappingName = "cUnit"; //dgccUnit.HeaderText = "单位"; //dgts.GridColumnStyles.Add(dgccUnit); DataGridColumnStyle dgciQuantity = new DataGridTextBoxColumn(); dgciQuantity.Width = 70; dgciQuantity.MappingName = "iQuantity"; dgciQuantity.HeaderText = "数量"; dgts.GridColumnStyles.Add(dgciQuantity); DataGridColumnStyle dgccVendor = new DataGridTextBoxColumn(); dgccVendor.Width = 70; dgccVendor.MappingName = "cVendor"; dgccVendor.HeaderText = "供应商"; dgts.GridColumnStyles.Add(dgccVendor); DataGridColumnStyle dgcMemo = new DataGridTextBoxColumn(); dgcMemo.Width = 70; dgcMemo.MappingName = "cMemo"; dgcMemo.HeaderText = "备注"; dgts.GridColumnStyles.Add(dgcMemo); dGridMain.TableStyles.Clear(); dGridMain.TableStyles.Add(dgts); dGridMain.DataSource = rds.RmPo; }
// Methods public virtual int Add(DataGridTableStyle table) {}
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.dataSet = new DataSet(); this.dataTable = new DataTable(); this.domainDataColumn = new DataColumn(); this.sourceDataColumn = new DataColumn(); this.kindDataColumn = new DataColumn(); this.memberDataColumn = new DataColumn(); this.messageDataColumn = new DataColumn(); this.dataGrid = new DataGrid(); this.dataGridTableStyle = new DataGridTableStyle(); this.domainDataGridTextBoxColumn = new DataGridTextBoxColumn(); this.sourceDataGridTextBoxColumn = new DataGridTextBoxColumn(); this.memberDataGridTextBoxColumn = new DataGridTextBoxColumn(); this.kindDataGridTextBoxColumn = new DataGridTextBoxColumn(); this.messageDataGridTextBoxColumn = new DataGridTextBoxColumn(); ((ISupportInitialize)(this.dataSet)).BeginInit(); ((ISupportInitialize)(this.dataTable)).BeginInit(); ((ISupportInitialize)(this.dataGrid)).BeginInit(); this.SuspendLayout(); // // dataSet // this.dataSet.DataSetName = "MetaValidationDataSet"; this.dataSet.Locale = new CultureInfo("nl-BE"); this.dataSet.Tables.AddRange(new DataTable[] { this.dataTable }); // // dataTable // this.dataTable.Columns.AddRange(new DataColumn[] { this.domainDataColumn, this.sourceDataColumn, this.kindDataColumn, this.memberDataColumn, this.messageDataColumn }); this.dataTable.TableName = "Errors"; // // domainDataColumn // this.domainDataColumn.ColumnName = "Domain"; // // sourceDataColumn // this.sourceDataColumn.ColumnName = "Source"; // // kindDataColumn // this.kindDataColumn.ColumnName = "Kind"; // // memberDataColumn // this.memberDataColumn.ColumnName = "Member"; // // messageDataColumn // this.messageDataColumn.ColumnName = "Message"; // // dataGrid // this.dataGrid.CaptionText = "Errors"; this.dataGrid.DataMember = "Errors"; this.dataGrid.DataSource = this.dataSet; this.dataGrid.Dock = DockStyle.Fill; this.dataGrid.HeaderForeColor = SystemColors.ControlText; this.dataGrid.Location = new Point(0, 0); this.dataGrid.Name = "dataGrid"; this.dataGrid.Size = new Size(784, 232); this.dataGrid.TabIndex = 0; this.dataGrid.TableStyles.AddRange(new DataGridTableStyle[] { this.dataGridTableStyle }); // // dataGridTableStyle // this.dataGridTableStyle.DataGrid = this.dataGrid; this.dataGridTableStyle.GridColumnStyles.AddRange(new DataGridColumnStyle[] { this.domainDataGridTextBoxColumn, this.sourceDataGridTextBoxColumn, this.memberDataGridTextBoxColumn, this.kindDataGridTextBoxColumn, this.messageDataGridTextBoxColumn }); this.dataGridTableStyle.HeaderForeColor = SystemColors.ControlText; this.dataGridTableStyle.MappingName = "Errors"; this.dataGridTableStyle.ReadOnly = true; // // domainDataGridTextBoxColumn // this.domainDataGridTextBoxColumn.Format = ""; this.domainDataGridTextBoxColumn.FormatInfo = null; this.domainDataGridTextBoxColumn.HeaderText = "Domain"; this.domainDataGridTextBoxColumn.MappingName = "Domain"; this.domainDataGridTextBoxColumn.NullText = ""; this.domainDataGridTextBoxColumn.ReadOnly = true; this.domainDataGridTextBoxColumn.Width = 120; // // sourceDataGridTextBoxColumn // this.sourceDataGridTextBoxColumn.Format = ""; this.sourceDataGridTextBoxColumn.FormatInfo = null; this.sourceDataGridTextBoxColumn.HeaderText = "Source"; this.sourceDataGridTextBoxColumn.MappingName = "Source"; this.sourceDataGridTextBoxColumn.NullText = ""; this.sourceDataGridTextBoxColumn.ReadOnly = true; this.sourceDataGridTextBoxColumn.Width = 120; // // memberDataGridTextBoxColumn // this.memberDataGridTextBoxColumn.Format = ""; this.memberDataGridTextBoxColumn.FormatInfo = null; this.memberDataGridTextBoxColumn.HeaderText = "Member"; this.memberDataGridTextBoxColumn.MappingName = "Member"; this.memberDataGridTextBoxColumn.NullText = ""; this.memberDataGridTextBoxColumn.ReadOnly = true; this.memberDataGridTextBoxColumn.Width = 120; // // kindDataGridTextBoxColumn // this.kindDataGridTextBoxColumn.Format = ""; this.kindDataGridTextBoxColumn.FormatInfo = null; this.kindDataGridTextBoxColumn.HeaderText = "Kind"; this.kindDataGridTextBoxColumn.MappingName = "Kind"; this.kindDataGridTextBoxColumn.NullText = ""; this.kindDataGridTextBoxColumn.ReadOnly = true; this.kindDataGridTextBoxColumn.Width = 120; // // messageDataGridTextBoxColumn // this.messageDataGridTextBoxColumn.Format = ""; this.messageDataGridTextBoxColumn.FormatInfo = null; this.messageDataGridTextBoxColumn.HeaderText = "Message"; this.messageDataGridTextBoxColumn.MappingName = "Message"; this.messageDataGridTextBoxColumn.NullText = ""; this.messageDataGridTextBoxColumn.ReadOnly = true; this.messageDataGridTextBoxColumn.Width = 250; // // MetavalidationView // this.Controls.Add(this.dataGrid); this.Name = "MetavalidationView"; this.Size = new Size(784, 232); ((ISupportInitialize)(this.dataSet)).EndInit(); ((ISupportInitialize)(this.dataTable)).EndInit(); ((ISupportInitialize)(this.dataGrid)).EndInit(); this.ResumeLayout(false); }
private void InitializeComponent() { try { // Create a Label. myLabel = new Label(); myLabel.Text = "Change width of 'Customer ID' column to see" + "'WidthChanged' event message."; myLabel.Location = new Point(0, 0); myLabel.Size = new System.Drawing.Size(400, 20); myLabel.ForeColor = Color.Blue; // Create the first button. myButtonNone = new Button(); myButtonNone.Location = new Point(24, 21); myButtonNone.Size = new System.Drawing.Size(150, 24); myButtonNone.Text = "Apply 'None' Line Style "; myButtonNone.Click += new EventHandler(OnNoneButtonClick); // Create the second button. myButtonSolid = new Button(); myButtonSolid.Location = new Point(180, 21); myButtonSolid.Size = new System.Drawing.Size(150, 24); myButtonSolid.Text = "Apply 'Solid' Line Style "; myButtonSolid.Click += new EventHandler(OnSolidButtonClick); Text = "DataGridColumnStyle Sample"; ClientSize = new System.Drawing.Size(400, 300); // Create a data grid. myDataGrid = new DataGrid(); myDataGrid.Location = new Point(24, 55); myDataGrid.Size = new Size(345, 200); myDataGrid.CaptionText = "Microsoft DataGrid Control"; // Create a data grid table style. DataGridTableStyle myDataGridTableStyle = new DataGridTableStyle(); myDataGridTableStyle.MappingName = "Customers"; myDataGridTableStyle.AlternatingBackColor = Color.LightGray; // <Snippet1> // Add the 'Customer ID' column style. DataGridColumnStyle myIDCol = new DataGridTextBoxColumn(); myIDCol.MappingName = "custID"; myIDCol.HeaderText = "Customer ID"; myIDCol.Width = 100; myIDCol.WidthChanged += new EventHandler(MyIDColumnWidthChanged); myDataGridTableStyle.GridColumnStyles.Add(myIDCol); // </Snippet1> // Add the 'Customer Name' column style. DataGridColumnStyle myNameCol = new DataGridTextBoxColumn(); myNameCol.MappingName = "custName"; myNameCol.HeaderText = "Customer Name"; myNameCol.Width = 150; myDataGridTableStyle.GridColumnStyles.Add(myNameCol); myDataGrid.TableStyles.Add(myDataGridTableStyle); // Add the controls. Controls.Add(myLabel); Controls.Add(myButtonNone); Controls.Add(myButtonSolid); Controls.Add(myDataGrid); } catch (Exception exc) { Console.WriteLine("Exception caught!!!"); Console.WriteLine("Source : " + exc.Source); Console.WriteLine("Message : " + exc.Message); } }
public void Remove(DataGridTableStyle table) {}
public bool Contains(DataGridTableStyle table) {}
public virtual void AddRange(DataGridTableStyle[] tables) {}
private void AddGridTableStyle() { int IntAvgCharWidth; ts = new DataGridTableStyle(); IntAvgCharWidth = (int)(System.Drawing.Graphics.FromHwnd(this.Handle).MeasureString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", this.Font).Width / 26); objStudentCM = (System.Windows.Forms.CurrencyManager) this.BindingContext[ds.Tables[0]]; ts.MappingName = ds.Tables[0].TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.ReadOnly = false; ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["ngay"])); ts.GridColumnStyles[0].MappingName = "ngay"; ts.GridColumnStyles[0].HeaderText = "Ngày"; ts.GridColumnStyles[0].Width = 70; ts.ReadOnly = true; ts.GridColumnStyles[0].Alignment = HorizontalAlignment.Left; ts.GridColumnStyles[0].NullText = string.Empty; ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["sotien"])); ts.GridColumnStyles[1].MappingName = "sotien"; ts.GridColumnStyles[1].HeaderText = ""; ts.GridColumnStyles[1].Width = 0; ts.ReadOnly = true; ts.GridColumnStyles[1].Alignment = HorizontalAlignment.Left; ts.GridColumnStyles[1].NullText = string.Empty; ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["dvt"])); ts.GridColumnStyles[2].MappingName = "dvt"; ts.GridColumnStyles[2].HeaderText = ""; ts.GridColumnStyles[2].Width = 0; ts.ReadOnly = true; ts.GridColumnStyles[2].Alignment = HorizontalAlignment.Left; ts.GridColumnStyles[2].NullText = string.Empty; ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["ten"])); ts.GridColumnStyles[3].MappingName = "ten"; ts.GridColumnStyles[3].HeaderText = "Số tiền"; ts.GridColumnStyles[3].Width = 100; ts.ReadOnly = true; ts.GridColumnStyles[3].Alignment = HorizontalAlignment.Right; ts.GridColumnStyles[3].NullText = string.Empty; ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["doituongcu"])); ts.GridColumnStyles[4].MappingName = "doituongcu"; ts.GridColumnStyles[4].HeaderText = "Đối tượng củ"; ts.GridColumnStyles[4].Width = 120; ts.ReadOnly = true; ts.GridColumnStyles[4].Alignment = HorizontalAlignment.Left; ts.GridColumnStyles[4].NullText = string.Empty; ts.GridColumnStyles.Add(new DataGridComboBoxColumn(dt, 1, 1)); ts.GridColumnStyles[5].MappingName = "doituong"; ts.GridColumnStyles[5].HeaderText = "Đối tượng mới"; ts.GridColumnStyles[5].Width = 200; ts.GridColumnStyles[5].Alignment = HorizontalAlignment.Left; ts.GridColumnStyles[5].NullText = string.Empty; dataGrid1.CaptionText = string.Empty; ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["kp"])); ts.GridColumnStyles[6].MappingName = "kp"; ts.GridColumnStyles[6].HeaderText = "Khoa"; ts.GridColumnStyles[6].Width = 235; ts.ReadOnly = true; ts.GridColumnStyles[6].Alignment = HorizontalAlignment.Left; ts.GridColumnStyles[6].NullText = string.Empty; dataGrid1.DataSource = ds; dataGrid1.DataMember = ds.Tables[0].TableName; dataGrid1.TableStyles.Add(ts); }
private void cmbAceptar_Click(object sender, EventArgs e) { if (BooleanType.FromObject(ObjectType.BitAndObj(StringType.StrCmp(this.cbPackList.Text, Strings.Space(0), false) == 0, ObjectType.ObjTst(this.cbPackList.SelectedValue, Strings.Space(0), false) == 0))) { Interaction.MsgBox("Debe seleccionar packing list", MsgBoxStyle.Critical, "Operador"); this.cbPackList.Focus(); } else if (StringType.StrCmp(this.txtDespacho.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe ingresar Despacho", MsgBoxStyle.Critical, "Operador"); this.txtDespacho.Focus(); } else if (StringType.StrCmp(this.txtCodAduana.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe ingresar C\x00f3digo de Aduana", MsgBoxStyle.Critical, "Operador"); this.txtCodAduana.Focus(); } else { this.cbPackList.Enabled = false; this.cmbAceptar.Enabled = false; this.GroupBox2.Enabled = false; Variables.gDespacho = this.txtDespacho.Text; Variables.gFechaImp = this.dtpFechaImp.Value; Variables.gCodAduana = this.txtCodAduana.Text; string connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=True;packet size=4096"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); SqlDataReader reader = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj("select * from Recepcion where PackList='", this.cbPackList.SelectedValue), "'")), connection).ExecuteReader(); if (reader.Read()) { reader.Close(); connection.Close(); Interaction.MsgBox("Este packing list ya fue procesado", MsgBoxStyle.Information, "Operador"); this.cbPackList.Enabled = true; this.cmbAceptar.Enabled = true; this.GroupBox2.Enabled = true; this.cbPackList.Focus(); } else { reader.Close(); Variables.gPackList = StringType.FromObject(this.cbPackList.SelectedValue); string selectCommandText = "select * from Despachos where Despacho='" + Variables.gDespacho + "' order by NroFCProv"; this.Adap = new SqlDataAdapter(selectCommandText, connectionString); this.CB = new SqlCommandBuilder(this.Adap); this.Adap.Fill(this.DS, "FCProv"); this.dgFcProv.DataSource = this.DS.Tables["FCProv"]; DataGridTableStyle table = new DataGridTableStyle(); table.MappingName = "FCProv"; DataGridTextBoxColumn column = new DataGridTextBoxColumn(); column = new DataGridTextBoxColumn(); DataGridTextBoxColumn column2 = column; column2.HeaderText = "Factura Proveedor"; column2.MappingName = "NroFCProv"; column2.Width = 150; column2 = null; table.GridColumnStyles.Add(column); this.dgFcProv.TableStyles.Add(table); this.dgFcProv.Refresh(); this.GroupBox1.Visible = true; this.editNroFC.Focus(); } } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FMain)); this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.datasetClients1 = new Allberg.Shooter.WinShooterServer.DatasetClients(); this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle(); this.dataGridTextBoxIPAddress = new System.Windows.Forms.DataGridTextBoxColumn(); this.dataGridTextBoxLastUpdate = new System.Windows.Forms.DataGridTextBoxColumn(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.btnDispose = new System.Windows.Forms.Button(); this.timerClientsUpdate = new System.Windows.Forms.Timer(this.components); this.chkWebServer = new System.Windows.Forms.CheckBox(); this.timerKeepConnection = new System.Windows.Forms.Timer(this.components); this.numCasheSeconds = new System.Windows.Forms.NumericUpDown(); this.progressBarThreads = new System.Windows.Forms.ProgressBar(); this.timerThreadCount = new System.Windows.Forms.Timer(this.components); this.numHttpPort = new System.Windows.Forms.NumericUpDown(); this.btnBackup = new System.Windows.Forms.Button(); this.label4 = new Allberg.Shooter.Windows.Forms.SafeLabel(); this.label3 = new Allberg.Shooter.Windows.Forms.SafeLabel(); this.txtServerAddress = new Allberg.Shooter.Windows.Forms.SafeTextBox(); this.txtFilename = new Allberg.Shooter.Windows.Forms.SafeTextBox(); this.label2 = new Allberg.Shooter.Windows.Forms.SafeLabel(); this.label1 = new Allberg.Shooter.Windows.Forms.SafeLabel(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.datasetClients1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numCasheSeconds)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numHttpPort)).BeginInit(); this.SuspendLayout(); // // dataGrid1 // this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGrid1.CaptionText = "Anslutna klienter"; this.dataGrid1.DataMember = "Clients"; this.dataGrid1.DataSource = this.datasetClients1; this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; this.dataGrid1.Location = new System.Drawing.Point(12, 88); this.dataGrid1.Name = "dataGrid1"; this.dataGrid1.ReadOnly = true; this.dataGrid1.RowHeadersVisible = false; this.dataGrid1.Size = new System.Drawing.Size(576, 191); this.dataGrid1.TabIndex = 2; this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] { this.dataGridTableStyle1 }); // // datasetClients1 // this.datasetClients1.DataSetName = "DatasetClients"; this.datasetClients1.Locale = new System.Globalization.CultureInfo("en-US"); this.datasetClients1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // dataGridTableStyle1 // this.dataGridTableStyle1.DataGrid = this.dataGrid1; this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] { this.dataGridTextBoxIPAddress, this.dataGridTextBoxLastUpdate }); this.dataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText; this.dataGridTableStyle1.MappingName = "Clients"; this.dataGridTableStyle1.PreferredColumnWidth = 125; this.dataGridTableStyle1.ReadOnly = true; this.dataGridTableStyle1.RowHeadersVisible = false; // // dataGridTextBoxIPAddress // this.dataGridTextBoxIPAddress.Alignment = System.Windows.Forms.HorizontalAlignment.Center; this.dataGridTextBoxIPAddress.Format = ""; this.dataGridTextBoxIPAddress.FormatInfo = null; this.dataGridTextBoxIPAddress.HeaderText = "Klient"; this.dataGridTextBoxIPAddress.MappingName = "IPAddress"; this.dataGridTextBoxIPAddress.NullText = ""; this.dataGridTextBoxIPAddress.ReadOnly = true; this.dataGridTextBoxIPAddress.Width = 125; // // dataGridTextBoxLastUpdate // this.dataGridTextBoxLastUpdate.Alignment = System.Windows.Forms.HorizontalAlignment.Center; this.dataGridTextBoxLastUpdate.Format = ""; this.dataGridTextBoxLastUpdate.FormatInfo = null; this.dataGridTextBoxLastUpdate.HeaderText = "Senast anslutning"; this.dataGridTextBoxLastUpdate.MappingName = "LastUpdate"; this.dataGridTextBoxLastUpdate.NullText = ""; this.dataGridTextBoxLastUpdate.ReadOnly = true; this.dataGridTextBoxLastUpdate.Width = 150; // // btnDispose // this.btnDispose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnDispose.Location = new System.Drawing.Point(496, 287); this.btnDispose.Name = "btnDispose"; this.btnDispose.Size = new System.Drawing.Size(88, 23); this.btnDispose.TabIndex = 3; this.btnDispose.Text = "Avsluta server"; this.btnDispose.Click += new System.EventHandler(this.btnDispose_Click); // // timerClientsUpdate // this.timerClientsUpdate.Interval = 5000; this.timerClientsUpdate.Tick += new System.EventHandler(this.timerClientsUpdate_Tick); // // chkWebServer // this.chkWebServer.Location = new System.Drawing.Point(96, 58); this.chkWebServer.Name = "chkWebServer"; this.chkWebServer.Size = new System.Drawing.Size(152, 24); this.chkWebServer.TabIndex = 6; this.chkWebServer.Text = "Kör som webbserver med"; this.chkWebServer.CheckedChanged += new System.EventHandler(this.chkWebServer_CheckedChanged); // // timerKeepConnection // this.timerKeepConnection.Interval = 60000; this.timerKeepConnection.Tick += new System.EventHandler(this.timerKeepConnection_Tick); // // numCasheSeconds // this.numCasheSeconds.Increment = new decimal(new int[] { 10, 0, 0, 0 }); this.numCasheSeconds.Location = new System.Drawing.Point(248, 58); this.numCasheSeconds.Maximum = new decimal(new int[] { 600, 0, 0, 0 }); this.numCasheSeconds.Minimum = new decimal(new int[] { 10, 0, 0, 0 }); this.numCasheSeconds.Name = "numCasheSeconds"; this.numCasheSeconds.Size = new System.Drawing.Size(56, 20); this.numCasheSeconds.TabIndex = 7; this.numCasheSeconds.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.numCasheSeconds.Value = new decimal(new int[] { 120, 0, 0, 0 }); // // progressBarThreads // this.progressBarThreads.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.progressBarThreads.Location = new System.Drawing.Point(120, 287); this.progressBarThreads.Name = "progressBarThreads"; this.progressBarThreads.Size = new System.Drawing.Size(368, 23); this.progressBarThreads.TabIndex = 9; this.progressBarThreads.Click += new System.EventHandler(this.progressBarThreads_Click); // // timerThreadCount // this.timerThreadCount.Enabled = true; this.timerThreadCount.Tick += new System.EventHandler(this.timerThreadCount_Tick); // // numHttpPort // this.numHttpPort.Location = new System.Drawing.Point(441, 58); this.numHttpPort.Maximum = new decimal(new int[] { 89, 0, 0, 0 }); this.numHttpPort.Minimum = new decimal(new int[] { 80, 0, 0, 0 }); this.numHttpPort.Name = "numHttpPort"; this.numHttpPort.Size = new System.Drawing.Size(56, 20); this.numHttpPort.TabIndex = 11; this.numHttpPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.numHttpPort.Value = new decimal(new int[] { 80, 0, 0, 0 }); // // btnBackup // this.btnBackup.Location = new System.Drawing.Point(8, 58); this.btnBackup.Name = "btnBackup"; this.btnBackup.Size = new System.Drawing.Size(75, 23); this.btnBackup.TabIndex = 12; this.btnBackup.Text = "Backup"; this.btnBackup.UseVisualStyleBackColor = true; this.btnBackup.Click += new System.EventHandler(this.btnBackup_Click); // // label4 // this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label4.Location = new System.Drawing.Point(8, 287); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(100, 23); this.label4.TabIndex = 10; this.label4.Text = "Antal trådar"; // // label3 // this.label3.Location = new System.Drawing.Point(310, 62); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(144, 16); this.label3.TabIndex = 8; this.label3.Text = "sekunders cache på port"; // // txtServerAddress // this.txtServerAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtServerAddress.Location = new System.Drawing.Point(96, 32); this.txtServerAddress.Name = "txtServerAddress"; this.txtServerAddress.ReadOnly = true; this.txtServerAddress.Size = new System.Drawing.Size(488, 20); this.txtServerAddress.TabIndex = 5; // // txtFilename // this.txtFilename.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtFilename.Location = new System.Drawing.Point(96, 8); this.txtFilename.Name = "txtFilename"; this.txtFilename.ReadOnly = true; this.txtFilename.Size = new System.Drawing.Size(488, 20); this.txtFilename.TabIndex = 1; // // label2 // this.label2.Location = new System.Drawing.Point(8, 32); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(80, 23); this.label2.TabIndex = 4; this.label2.Text = "Server adress"; // // label1 // this.label1.Location = new System.Drawing.Point(8, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(48, 23); this.label1.TabIndex = 0; this.label1.Text = "Databas"; // // FMain // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(592, 317); this.Controls.Add(this.btnBackup); this.Controls.Add(this.numHttpPort); this.Controls.Add(this.label4); this.Controls.Add(this.progressBarThreads); this.Controls.Add(this.label3); this.Controls.Add(this.numCasheSeconds); this.Controls.Add(this.chkWebServer); this.Controls.Add(this.txtServerAddress); this.Controls.Add(this.txtFilename); this.Controls.Add(this.label2); this.Controls.Add(this.btnDispose); this.Controls.Add(this.dataGrid1); this.Controls.Add(this.label1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "FMain"; this.Text = "WinShooter Server"; ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.datasetClients1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numCasheSeconds)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numHttpPort)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
//private void datasetdump_Click(object sender, EventArgs e) //{ // Console.WriteLine("Tabelleninhalt aus Datenbank" + "(dataSet):"); // this.Datenausgabe(dataSet1); // DataSet dataSetChanges = dataSet1.GetChanges(); // if(dataSetChanges != null) // { // Console.WriteLine("Änderungen in den Tabellen" + "(datasetChanges):"); // this.Datenausgabe(dataSetChanges); // } //} //private void Datenausgabe(DataSet dataset) //{ // Console.WriteLine("DataSet:" + dataSet1.DataSetName); // foreach(DataTable thistable in dataSet1.Tables) // { // Console.WriteLine("TableName:" + thistable.TableName); // foreach(DataRow thisrow in thistable.Rows) // { // foreach(DataColumn thiscolumn in thistable.Columns) // { // try // { // Console.Write(thisrow[thiscolumn] + "\t"); // } // catch(DeletedRowInaccessibleException drie) // { // Console.Write("Zeile gelöscht"); // break; // } // } // Console.Write("[" + thisrow.RowState + "]\n"); // } // } //} private void buttonBestellungen_Click(object sender, EventArgs e) { //textBoxSQL.Enabled = false; textBoxTable.Enabled = false; dataSet1.Reset(); string tableKunden = "Kunden"; string tableBestellungen = "Bestellungen"; string tableArtikel = "Artikel"; string sqlcmdkunden = "SELECT k.id, p.vorname," + " p.nachname, p.plz, p.ort FROM kunden k," + "personen p WHERE k.personID = p.id " + "ORDER BY p.nachname"; string sqlcmdBestellungen = "SELECT b.id," + "b.kundenID,b.datum,b.verkaeuferID,p.nachname FROM " + "bestellungen b,personen p,angestellte a WHERE b.verkaeuferID=a.id AND a.personID=p.id ORDER BY b.id"; string sqlcmdartikel = "SELECT bp.bestellID," + "bp.artikelID,a.name,a.groesse,a.farbe," + "bp.menge FROM artikel a,bestellpositionen bp " + "WHERE a.id = bp.artikelID"; try { odbcDataAdapter1.SelectCommand = new OdbcCommand(sqlcmdkunden, odbcConnection); odbcDataAdapter1.Fill(dataSet1, tableKunden); //dataGrid.SetDataBinding(dataSet1, tableKunden); odbcDataAdapter1.SelectCommand = new OdbcCommand(sqlcmdBestellungen, odbcConnection); odbcDataAdapter1.Fill(dataSet1, tableBestellungen); //dataGrid.SetDataBinding(dataSet1, tableBestellungen); odbcDataAdapter1.SelectCommand = new OdbcCommand(sqlcmdartikel, odbcConnection); odbcDataAdapter1.Fill(dataSet1, tableArtikel); DataGridTableStyle dgtabstyle = new DataGridTableStyle(); dgtabstyle.MappingName = tableBestellungen; DataGridTextBoxColumn dgtcol1 = new DataGridTextBoxColumn(); dgtcol1.MappingName = "nachname"; dgtcol1.ReadOnly = true; dgtcol1.HeaderText = "Verkäufer"; DataGridTextBoxColumn dgtcol2 = new DataGridTextBoxColumn(); dgtcol2.MappingName = "VerkaeuferID"; dgtcol2.ReadOnly = true; dgtcol2.HeaderText = "VerkäuferID"; dgtabstyle.GridColumnStyles.Add(dgtcol1); dgtabstyle.GridColumnStyles.Add(dgtcol2); dataGrid.TableStyles.Add(dgtabstyle); odbcConnection.Close(); } catch (Exception ex) { toolStripStatusLabel1.Text = "Datenbankfehler!"; MessageBox.Show(ex.GetType() + Environment.NewLine + ex.Message, "Datenbankfehler"); } DataColumn column1 = dataSet1.Tables[tableKunden].Columns["id"]; DataColumn column2 = dataSet1.Tables[tableBestellungen].Columns["kundenID"]; DataRelation relation1 = new DataRelation("Bestellungen zum Kunden", column1, column2 ); DataColumn column3 = dataSet1.Tables[tableBestellungen].Columns["id"]; DataColumn column4 = dataSet1.Tables[tableArtikel].Columns["bestellID"]; DataRelation relation2 = new DataRelation("Artikel zum bestellungen", column3, column4); DataColumn column5 = dataSet1.Tables[tableArtikel].Columns["artikelID"]; DataColumn column6 = dataSet1.Tables[tableArtikel].Columns["bestellID"]; DataRelation relation3 = new DataRelation("Bestellungen zum Artikel", column5, column6); dataSet1.Relations.Add(relation1); dataSet1.Relations.Add(relation2); //dataSet1.Relations.Add(relation3); }
private DataGridTableStyle DataGridStyleDailyLoss(DataTable dt) { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = dt.TableName; DataGridColumnStyle s1 = new DataGridTextBoxColumn(); s1.Width = 70; s1.MappingName = "Location"; s1.HeaderText = "Location"; ts.GridColumnStyles.Add(s1); DataGridColumnStyle s2 = new DataGridTextBoxColumn(); s2.Width = 100; s2.MappingName = "ItemNo"; s2.HeaderText = "Item No"; ts.GridColumnStyles.Add(s2); DataGridColumnStyle s22 = new DataGridTextBoxColumn(); s22.Width = 90; s22.MappingName = "Description"; s22.HeaderText = "Description"; ts.GridColumnStyles.Add(s22); DataGridColumnStyle s3 = new DataGridTextBoxColumn(); s3.Width = 90; s3.MappingName = "Description2"; s3.HeaderText = "Description 2"; ts.GridColumnStyles.Add(s3); DataGridColumnStyle s4 = new DataGridTextBoxColumn(); s4.Width = 100; s4.MappingName = "Quantity"; s4.HeaderText = "Quantity"; ts.GridColumnStyles.Add(s4); DataGridColumnStyle s5 = new DataGridTextBoxColumn(); s5.Width = 100; s5.MappingName = "Date"; s5.HeaderText = "Date"; ts.GridColumnStyles.Add(s5); DataGridColumnStyle s6 = new DataGridTextBoxColumn(); s6.Width = 100; s6.MappingName = "ReferenceNo"; s6.HeaderText = "Reference No"; ts.GridColumnStyles.Add(s6); DataGridColumnStyle s7 = new DataGridTextBoxColumn(); s7.Width = 100; s7.MappingName = "VendorNo"; s7.HeaderText = "VendorNo"; ts.GridColumnStyles.Add(s7); DataGridColumnStyle s8 = new DataGridTextBoxColumn(); s8.Width = 100; s8.MappingName = "ReceiptDate"; s8.HeaderText = "ReceiptDate"; ts.GridColumnStyles.Add(s8); DataGridColumnStyle s9 = new DataGridTextBoxColumn(); s9.Width = 100; s9.MappingName = "CustomerNo"; s9.HeaderText = "Customer No"; ts.GridColumnStyles.Add(s9); return(ts); }
private void UpdateGridStyle() { DataGridTableStyle style = m_grid.TableStyle; if (style == null) { style = new DataGridTableStyle(); m_grid.TableStyles.Add(style); } style.GridColumnStyles.Clear(); //General style.AllowSorting = false; m_grid.CaptionVisible = false; m_grid.FlatMode = true; m_grid.BorderStyle = m_2iList.ShowBorder ? BorderStyle.Fixed3D : BorderStyle.None; //Couleurs de la grille m_grid.BackgroundColor = m_2iList.BackColor; style.BackColor = m_2iList.LineBackColor1; m_grid.BackColor = m_2iList.LineBackColor1; m_grid.AlternatingBackColor = m_2iList.LineBackColor2; style.AlternatingBackColor = m_2iList.LineBackColor2; style.GridLineColor = m_2iList.ColorGrid; style.GridLineStyle = (System.Windows.Forms.DataGridLineStyle)m_2iList.LineStyle; style.ForeColor = m_2iList.ForeColor; //Column header style.ColumnHeadersVisible = m_2iList.HeaderVisible; style.HeaderBackColor = m_2iList.ColorHeaderBack; style.HeaderForeColor = m_2iList.ColorHeaderText; style.HeaderFont = m_2iList.HeaderFont; style.PreferredRowHeight = m_2iList.ItemHeight; style.SelectionBackColor = m_2iList.ColorSelection; style.RowHeaderWidth = 15; m_grid.RowHeaderWidth = 15; GetColorElementDelegate delGetCouleurFond = new GetColorElementDelegate(GetBackColor); GetColorElementDelegate delGetcouleurText = new GetColorElementDelegate(GetTextColor); if (m_grid.DataSource is DataTable) { DataTable table = (DataTable)m_grid.DataSource; foreach (C2iWndListe.CColonne col in m_2iList.Columns) { C2iDataGridColumnStyleAControle colStyle = null; if (col.ActionSurLink == null) { colStyle = new C2iDataGridColumnStyleAControle(m_labelForGrid, "Text"); } else { colStyle = new C2iDataGridColumnStyleAControle(m_linkForGrid, "Text"); } colStyle.MappingName = col.Title; colStyle.HeaderText = col.Title; colStyle.TextAlign = HorizontalAlignment.Center; colStyle.Width = col.Width; colStyle.BackColor = col.BackColor; colStyle.ForeColor = col.TextColor; colStyle.Font = col.Font; colStyle.GetBackColorDelegate = delGetCouleurFond; colStyle.GetTextColorDelegate = delGetcouleurText; style.GridColumnStyles.Add(colStyle); } } object lastSource = m_grid.DataSource; m_grid.DataSource = null; m_grid.DataSource = lastSource; }
private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = ds.Tables[0].TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.ReadOnly = false; ts.RowHeaderWidth = 10; DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn(); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tennhom"; TextCol.HeaderText = "Nhóm"; TextCol.Width = 180; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "mabn"; TextCol.HeaderText = "Mã BN"; TextCol.Width = 60; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "soluutru"; TextCol.HeaderText = "Số lưu trữ"; TextCol.Width = 80; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "hoten"; TextCol.HeaderText = "Họ tên"; TextCol.Width = 120; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tuoi"; TextCol.HeaderText = "Tuổi"; TextCol.Width = 40; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "quanhe"; TextCol.HeaderText = "Quan hệ"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "hotenqh"; TextCol.HeaderText = "Họ tên quan hệ"; TextCol.Width = 120; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenbv"; TextCol.HeaderText = "Nơi giới thiệu"; TextCol.Width = 180; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "sonha"; TextCol.HeaderText = "Số nhà"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "thon"; TextCol.HeaderText = "Thôn đường"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenpxa"; TextCol.HeaderText = "Phường/Xã"; TextCol.Width = 120; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenquan"; TextCol.HeaderText = "Quận/Huyện"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tentt"; TextCol.HeaderText = "Tỉnh/Thành phố"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ngayvk"; TextCol.HeaderText = "Ngày giờ vào"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ngayrk"; TextCol.HeaderText = "Ngày giờ ra"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "chandoan"; TextCol.HeaderText = "Chẩn đoán"; TextCol.Width = 250; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "maicd"; TextCol.HeaderText = "ICD"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ttlucrk"; TextCol.HeaderText = "Tình trạng"; TextCol.Width = 80; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
/// <summary> /// 窗体加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SourceForm_Load(object sender, EventArgs e) { if (source == null) { return; } DataGridTableStyle dts = new DataGridTableStyle(); DataGridTextBoxColumn dtbc; dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "存货编码"; dtbc.MappingName = "cInvCode"; dtbc.Width = 80; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "存货名称"; dtbc.MappingName = "cInvName"; dtbc.Width = 90; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "规格"; dtbc.MappingName = "cInvStd"; dtbc.Width = 90; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "批次"; dtbc.MappingName = "cBatch"; dtbc.Width = 110; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "数量"; dtbc.MappingName = "iQuantity"; dtbc.Width = 70; dtbc.Format = "F2"; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "累计发货数量"; dtbc.MappingName = "iFHQuantity"; dtbc.Width = 70; dtbc.Format = "F2"; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "累计出库数量"; dtbc.MappingName = "fOutQuantity"; dtbc.Width = 70; dtbc.Format = "F2"; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "已扫数量"; dtbc.MappingName = "iScanQuantity"; dtbc.Width = 70; dtbc.Format = "F2"; dts.GridColumnStyles.Add(dtbc); //dtbc = new DataGridTextBoxColumn(); //dtbc.HeaderText = "产地"; //dtbc.MappingName = "cDefine22"; //dtbc.Width = 100; //dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "主计量单位"; dtbc.MappingName = "cinvm_unit"; dtbc.Width = 70; dts.GridColumnStyles.Add(dtbc); dtbc = new DataGridTextBoxColumn(); dtbc.HeaderText = "含税单价"; dtbc.MappingName = "iTaxUnitPrice"; dtbc.Width = 70; dts.GridColumnStyles.Add(dtbc); //dtbc = new DataGridTextBoxColumn(); //dtbc.HeaderText = "客户名称"; //dtbc.MappingName = "cCusName"; //dtbc.Width = 120; //dts.GridColumnStyles.Add(dtbc); //dtbc = new DataGridTextBoxColumn(); //dtbc.HeaderText = "客户简称"; //dtbc.MappingName = "ccusabbname"; //dtbc.Width = 120; //dts.GridColumnStyles.Add(dtbc); dgView.TableStyles.Add(dts); dgView.RowHeadersVisible = true; dts.MappingName = source.GetType().Name; this.dgView.DataSource = source; }
private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = dt.TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.FromArgb(0, 255, 255); ts.SelectionForeColor = Color.PaleGreen; ts.RowHeaderWidth = 3; ts.AllowSorting = false; FormattableBooleanColumn discontinuedCol = new FormattableBooleanColumn(); discontinuedCol.MappingName = "chon"; discontinuedCol.HeaderText = "Chọn"; discontinuedCol.Width = 30; discontinuedCol.AllowNull = false; discontinuedCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); discontinuedCol.BoolValueChanged += new BoolValueChangedEventHandler(BoolValueChanged); ts.GridColumnStyles.Add(discontinuedCol); dataGrid1.TableStyles.Add(ts); FormattableTextBoxColumn TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "mabn"; TextCol.HeaderText = "Mã BN"; TextCol.Width = 60; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "hoten"; TextCol.HeaderText = "Họ tên"; TextCol.Width = 150; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "id"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new FormattableTextBoxColumn(); TextCol.MappingName = "makp"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.ReadOnly = true; TextCol.SetCellFormat += new FormatCellEventHandler(SetCellFormat); ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
public static DataGrid getVSViewGrid(VMVirtualServer vs, DataGrid dg) { DataTable dt = new DataTable("VSView"); ArrayList bmpCPUUsage = new ArrayList(); ArrayList bmpThumbnail = new ArrayList(); //create a datatable with columns dt.Columns.Add(new DataColumn("Thumbnail", typeof(int))); dt.Columns.Add(new DataColumn("VM")); dt.Columns.Add(new DataColumn("CPUUsage", typeof(int))); dt.Columns.Add(new DataColumn("Info")); if (vs.VirtualMachines.Count > 0) { // Get each row VMVirtualMachine vm = null; for (int i = 0; i < vs.VirtualMachines.Count; i++) { DataRow dr = dt.NewRow(); vm = vs.VirtualMachines[i + 1]; bmpCPUUsage.Add(Utility.GenerateCPUUsage(vm, vs, CPUUsageSize.Normal)); bmpThumbnail.Add(Utility.GenerateThumbnail(vm.Display)); dr[0] = i; dr[1] = "\n" + vm.Name + "\n(" + Utility.ConvertVMStateToString(vm.State) + ")"; dr[2] = i; dr[3] = "\n" + "RAM: " + vm.Memory.ToString() + " MB" + "\n" + "Running Time: " + Utility.ConvertUptimeToString(vm.Accountant.UpTime); dt.Rows.Add(dr); } } dt.DefaultView.AllowNew = false; // if ( dt.Rows.Count>0) // { // Define table style DataGridTableStyle tableStyle = new DataGridTableStyle(); tableStyle.MappingName = "VSView"; // Add column styles // Graphic column DataGridImageCell imgtbc; // TextBox Column DataGridTextBoxColumn tbc; // Thumbnail column imgtbc = new DataGridImageCell(); imgtbc.MappingName = "Thumbnail"; imgtbc.HeaderText = "Thumbnail"; imgtbc.Alignment = HorizontalAlignment.Center; imgtbc.theImages = bmpThumbnail; imgtbc.Width = 64; tableStyle.GridColumnStyles.Add(imgtbc); // VM Name column tbc = new DataGridTextBoxColumn(); tbc.MappingName = "VM"; tbc.HeaderText = "VM"; tbc.Alignment = HorizontalAlignment.Center; tbc.TextBox.Multiline = true; tbc.TextBox.WordWrap = true; tbc.TextBox.AcceptsReturn = true; tbc.TextBox.Enabled = false; tbc.TextBox.TextAlign = HorizontalAlignment.Left; tbc.Width = 200; tableStyle.GridColumnStyles.Add(tbc); // CPU Usage column imgtbc = new DataGridImageCell(); imgtbc.MappingName = "CPUUsage"; imgtbc.HeaderText = "CPUUsage"; imgtbc.Alignment = HorizontalAlignment.Center; imgtbc.theImages = bmpCPUUsage; imgtbc.Width = 120; tableStyle.GridColumnStyles.Add(imgtbc); // VM Info column tbc = new DataGridTextBoxColumn(); tbc.MappingName = "Info"; tbc.HeaderText = "Info"; tbc.Alignment = HorizontalAlignment.Center; tbc.TextBox.Multiline = true; tbc.TextBox.WordWrap = true; tbc.TextBox.AcceptsReturn = true; tbc.TextBox.Enabled = false; tbc.TextBox.TextAlign = HorizontalAlignment.Right; // Overwritten by tbc.Alignment tbc.Width = 368; tableStyle.GridColumnStyles.Add(tbc); tableStyle.PreferredRowHeight = 50; tableStyle.AllowSorting = false; dt.DefaultView.AllowNew = false; dg.DataSource = null; dg.TableStyles.Clear(); dg.TableStyles.Add(tableStyle); dg.DataSource = dt; dg.AllowSorting = false; dg.ReadOnly = true; dg.Enabled = true; // } return(dg); }
private void AddGridTableStyle(DataSet v_ds) { try { DataGrid1.TableStyles.Clear(); DataGrid1.AllowSorting = true; DataGridColoredTextBoxColumn TextCol; delegateGetColorRowCol de = new delegateGetColorRowCol(MyGetColorRowCol); DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = v_ds.Tables[0].TableName; ts.AlternatingBackColor = Color.LightYellow; ts.BackColor = Color.White; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = SystemColors.Control; ts.HeaderForeColor = Color.Black; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.RowHeaderWidth = 16; ts.AllowSorting = true; ts.PreferredRowHeight = 20; TextCol = new DataGridColoredTextBoxColumn(de, 0); TextCol.MappingName = "id"; TextCol.HeaderText = "id"; TextCol.ReadOnly = true; TextCol.Alignment = HorizontalAlignment.Left; TextCol.Width = 0; TextCol.NullText = ""; ts.GridColumnStyles.Add(TextCol); DataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 0); TextCol.MappingName = "ma"; TextCol.HeaderText = "Tên report"; TextCol.ReadOnly = true; TextCol.Alignment = HorizontalAlignment.Left; TextCol.Width = 100; TextCol.NullText = ""; ts.GridColumnStyles.Add(TextCol); DataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 0); TextCol.MappingName = "ten"; TextCol.HeaderText = "Diễn giải"; TextCol.ReadOnly = true; TextCol.Alignment = HorizontalAlignment.Left; TextCol.Width = 336; TextCol.NullText = ""; ts.GridColumnStyles.Add(TextCol); DataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 0); TextCol.MappingName = "tenloai"; TextCol.HeaderText = "Loại bảng kê"; TextCol.ReadOnly = true; TextCol.Alignment = HorizontalAlignment.Left; TextCol.Width = 150; TextCol.NullText = ""; ts.GridColumnStyles.Add(TextCol); DataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 0); TextCol.MappingName = "loai"; TextCol.HeaderText = ""; TextCol.NullText = ""; TextCol.ReadOnly = true; TextCol.Alignment = HorizontalAlignment.Center; TextCol.Width = 0; ts.GridColumnStyles.Add(TextCol); DataGrid1.TableStyles.Add(ts); DataGrid1.DataSource = v_ds.Tables[0]; } catch //(Exception ex) { // MessageBox.Show(ex.ToString()); } }
private void InitValues(List <DrillParameter> parameters) { this.tbReportFile.Text = _DrillReport; // Initialize the DataGrid columns dgtbName = new DataGridTextBoxColumn(); dgtbValue = new DataGridTextBoxColumn(); dgtbOmit = new DataGridTextBoxColumn(); this.dgTableStyle.GridColumnStyles.AddRange(new DataGridColumnStyle[] { this.dgtbName, this.dgtbValue, this.dgtbOmit }); // // dgtbFE // dgtbName.HeaderText = "Parameter Name"; dgtbName.MappingName = "ParameterName"; dgtbName.Width = 75; // // dgtbValue // this.dgtbValue.HeaderText = "Value"; this.dgtbValue.MappingName = "Value"; this.dgtbValue.Width = 75; // // dgtbOmit // this.dgtbOmit.HeaderText = "Omit"; this.dgtbOmit.MappingName = "Omit"; this.dgtbOmit.Width = 75; // Initialize the DataTable _DataTable = new DataTable(); _DataTable.Columns.Add(new DataColumn("ParameterName", typeof(string))); _DataTable.Columns.Add(new DataColumn("Value", typeof(string))); _DataTable.Columns.Add(new DataColumn("Omit", typeof(string))); string[] rowValues = new string[3]; if (parameters != null) { foreach (DrillParameter dp in parameters) { rowValues[0] = dp.ParameterName; rowValues[1] = dp.ParameterValue; rowValues[2] = dp.ParameterOmit; _DataTable.Rows.Add(rowValues); } } // Don't allow new rows; do this by creating a DataView over the DataTable // DataView dv = new DataView(_DataTable); // this has bad side effects // dv.AllowNew = false; this.dgParms.DataSource = _DataTable; DataGridTableStyle ts = dgParms.TableStyles[0]; ts.GridColumnStyles[0].Width = 140; ts.GridColumnStyles[0].ReadOnly = true; ts.GridColumnStyles[1].Width = 140; ts.GridColumnStyles[2].Width = 70; }
private void button1_Click(object sender, System.EventArgs e) { this.oleDbConnection1.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\data.mdb;"; this.oleDbConnection1.Open(); DataSet thisDataSet = new DataSet(); string scom; string addcom = ""; scom = "SELECT * FROM table1"; int wccom = 0; if (this.textBox1.Text.Length != 0) { addcom = " where no1=" + this.textBox1.Text; wccom++; } if (this.textBox2.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and no2=" + this.textBox2.Text; } else { addcom = " where no2=" + this.textBox2.Text; wccom++; } } if (this.textBox3.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and no3=" + this.textBox3.Text; } else { addcom = " where no3=" + this.textBox3.Text; wccom++; } } if (this.textBox4.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and no4=" + this.textBox4.Text; } else { addcom = " where no4=" + this.textBox4.Text; wccom++; } } if (this.textBox5.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and no5=" + this.textBox5.Text; } else { addcom = " where no5=" + this.textBox5.Text; wccom++; } } if (this.textBox6.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and no6=" + this.textBox6.Text; } else { addcom = " where no6=" + this.textBox6.Text; wccom++; } } if (this.textBox7.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and no7=" + this.textBox7.Text; } else { addcom = " where no7=" + this.textBox7.Text; wccom++; } } if (this.textBox8.Text.Length != 0) { if (wccom > 0) { addcom = addcom + " and date1='" + this.textBox8.Text + "'"; } else { addcom = " where date1='" + this.textBox8.Text + "'"; wccom++; } } scom = scom + addcom; this.label1.Text = scom; try { //建立适配器 System.Data.OleDb.OleDbDataAdapter studentAdapter = new System.Data.OleDb.OleDbDataAdapter(scom, this.oleDbConnection1); System.Data.OleDb.OleDbCommandBuilder studentBuilder = new System.Data.OleDb.OleDbCommandBuilder(studentAdapter); //填充 studentAdapter.Fill(thisDataSet, "table1"); this.dataGrid1.DataSource = thisDataSet.Tables[0]; //1、新建立一个 DataGridTableStyle DataGridTableStyle dtstyle = new DataGridTableStyle(); //2、绑定数据源 dtstyle.MappingName = thisDataSet.Tables[0].TableName; //3、设定 this.dataGrid1.TableStyles.Clear(); this.dataGrid1.TableStyles.Add(dtstyle); this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[0].Width = 30; this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[1].Width = 30; this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[2].Width = 30; this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[3].Width = 30; this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[4].Width = 30; this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[5].Width = 30; this.dataGrid1.TableStyles[thisDataSet.Tables[0].TableName].GridColumnStyles[6].Width = 30; this.dataSet1 = thisDataSet; } catch {} this.oleDbConnection1.Close(); }
private void GetStockData(bool isAll) { try { using (SqlConnection sqlconn = new SqlConnection("server=192.168.50.68;database=LonKing_MES_JX;uid=sa;pwd=;")) { if (!string.IsNullOrEmpty(kanbanNo.Text) || isAll) { sqlconn.Open(); StringBuilder strbuild = new StringBuilder(); strbuild.Append("select master.fItemCode,master.fItemName,master.fModel,lc.fName, ISNULL(inv.fcount,0) fcount from lkm_exec_kanban_entry lkexek inner join "); strbuild.Append("lkm_kanban lkanban on lkexek.fbasic_billno =lkanban.fbillno INNER join lkm_Materials master on lkanban.fitemid =master.fInterID "); strbuild.Append("inner join LKM_MCCItemEntry lke on master.fItemID =lke.fitemid inner join LKM_MCCPTEntry lmentry on lmentry.fConfigID =lke.fConfigID "); strbuild.Append("inner join lkm_CommonBill lc on lc.fInterID =lmentry.fProTecID left join lkm_blank_inventory inv on inv.fitemid =lkanban.fitemid "); if (isAll) { strbuild.Append("and inv.fproid = lmentry.fProTecID and lmentry.fProTecID != 56 "); } else { strbuild.Append("and inv.fproid = lmentry.fProTecID where lkexek.fbillno ='" + kanbanNo.Text + "' and lmentry.fProTecID != 56 "); } SqlCommand scanStoceCmd = new SqlCommand(strbuild.ToString(), sqlconn); sdp.SelectCommand = scanStoceCmd; dt.Clear(); sdp.Fill(dt); // MessageBox.Show(dt.Rows.Count.ToString()); var dtformatValue = from kanbanNo2 in dt.AsEnumerable() select new KanbanInv { 工序 = kanbanNo2["fName"].ToString(), 数量 = Convert.ToDecimal(kanbanNo2["fcount"]), 料号 = kanbanNo2["fItemCode"].ToString(), 品名 = kanbanNo2["fItemName"].ToString().Split('~')[0], 型号 = kanbanNo2["fModel"].ToString(), }; dataGrid1.TableStyles.Clear(); DataGridTableStyle dts = new DataGridTableStyle(); // 注意:必须加上这一句,否则自定义列格式无法使用 dts.MappingName = "KanbanInv[]"; dataGrid1.TableStyles.Add(dts); dataGrid1.TableStyles[0].GridColumnStyles.Clear(); //========================设置表头栏位=========================== DataGridTableStyle dtsLog = new DataGridTableStyle(); DataGridTextBoxColumn colID = new DataGridTextBoxColumn(); colID.Width = 70; colID.HeaderText = "工序"; colID.MappingName = "工序"; dataGrid1.TableStyles[0].GridColumnStyles.Add(colID); DataGridTextBoxColumn colLog = new DataGridTextBoxColumn(); colLog.Width = 40; colLog.HeaderText = "数量"; colLog.MappingName = "数量"; dataGrid1.TableStyles[0].GridColumnStyles.Add(colLog); DataGridTextBoxColumn colTime = new DataGridTextBoxColumn(); colTime.Width = 85; colTime.HeaderText = "料号"; colTime.MappingName = "料号"; dataGrid1.TableStyles[0].GridColumnStyles.Add(colTime); DataGridTextBoxColumn itemName = new DataGridTextBoxColumn(); itemName.Width = 60; itemName.HeaderText = "品名"; itemName.MappingName = "品名"; dataGrid1.TableStyles[0].GridColumnStyles.Add(itemName); DataGridTextBoxColumn colCatalog = new DataGridTextBoxColumn(); colCatalog.Width = 150; colCatalog.HeaderText = "型号"; colCatalog.MappingName = "型号"; dataGrid1.TableStyles[0].GridColumnStyles.Add(colCatalog); dataGrid1.DataSource = dtformatValue.ToArray(); if (dtformatValue.Count() == 0) { errMessage.Text = "没有找到数据"; } else { errMessage.Text = "查找成功"; } } else { errMessage.Text = "没有找到数据"; dt.Clear(); var dtformatValue = from kanbanNo2 in dt.AsEnumerable() select new { 工序 = kanbanNo2["fName"], 数量 = kanbanNo2["fcount"], 料号 = kanbanNo2["fItemCode"], 品名 = kanbanNo2["fItemName"].ToString().Split('~')[0], 型号 = kanbanNo2["fModel"], }; dataGrid1.DataSource = dtformatValue.ToArray(); // tb.ShowTaskBar(); } } } catch (Exception ex) { errMessage.Text = "发生错误:" + ex.Message; // tb.ShowTaskBar(); } }
private void InitGridDataTitle() { DataGridTableStyle tbs = new DataGridTableStyle(); DataGridTextBoxColumn clmTime = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue1 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue2 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue3 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue4 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue5 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue6 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue7 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue8 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue9 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue10 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue11 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue12 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue13 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue14 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue15 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue16 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue17 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue18 = new DataGridTextBoxColumn(); DataGridTextBoxColumn clmValue19 = new DataGridTextBoxColumn(); if (d_Type) { clmValue18.MappingName = "name"; clmValue18.HeaderText = "站名称"; clmValue19.MappingName = "team"; clmValue19.HeaderText = "所属班组"; } clmTime.MappingName = "time"; clmTime.HeaderText = "时间"; clmValue1.MappingName = "oneGiveTemp"; clmValue1.HeaderText = "一次供水温度"; clmValue2.MappingName = "oneBackTemp"; clmValue2.HeaderText = "一次回水温度"; clmValue3.MappingName = "oneGivePress"; clmValue3.HeaderText = "一次供水压力"; clmValue4.MappingName = "oneBackPress"; clmValue4.HeaderText = "一次回水压力"; clmValue5.MappingName = "twoGiveTemp"; clmValue5.HeaderText = "二次供水温度"; clmValue6.MappingName = "twoBackTemp"; clmValue6.HeaderText = "二次回水温度"; clmValue7.MappingName = "twoGivePress"; clmValue7.HeaderText = "二次供水压力"; clmValue8.MappingName = "twoBackPress"; clmValue8.HeaderText = "二次回水压力"; clmValue9.MappingName = "outsideTemp"; clmValue9.HeaderText = "室外温度"; clmValue10.MappingName = "oneInstant"; clmValue10.HeaderText = "一次瞬时流量"; clmValue11.MappingName = "twoInstant"; clmValue11.HeaderText = "二次瞬时流量"; clmValue12.MappingName = "oneAccum"; clmValue12.HeaderText = "一次累积流量"; clmValue13.MappingName = "twoAccum"; clmValue13.HeaderText = "二次累积流量"; clmValue14.MappingName = "openDegree"; clmValue14.HeaderText = "调节阀开度"; clmValue15.MappingName = "twoPressCha"; clmValue15.HeaderText = "二次供回压差"; clmValue16.MappingName = "WatBoxLevel"; clmValue16.HeaderText = "水箱水位"; clmValue17.MappingName = "twoGiveBaseTemp"; clmValue17.HeaderText = "二次供水基准温度"; tbs.GridColumnStyles.Add(clmTime); tbs.GridColumnStyles[0].Width = 120; tbs.GridColumnStyles.Add(clmValue1); tbs.GridColumnStyles[1].Width = 90; tbs.GridColumnStyles.Add(clmValue2); tbs.GridColumnStyles[2].Width = 90; tbs.GridColumnStyles.Add(clmValue3); tbs.GridColumnStyles[3].Width = 90; tbs.GridColumnStyles.Add(clmValue4); tbs.GridColumnStyles[4].Width = 90; tbs.GridColumnStyles.Add(clmValue5); tbs.GridColumnStyles[5].Width = 90; tbs.GridColumnStyles.Add(clmValue6); tbs.GridColumnStyles[6].Width = 90; tbs.GridColumnStyles.Add(clmValue7); tbs.GridColumnStyles[7].Width = 90; tbs.GridColumnStyles.Add(clmValue8); tbs.GridColumnStyles[8].Width = 90; tbs.GridColumnStyles.Add(clmValue9); tbs.GridColumnStyles[9].Width = 90; tbs.GridColumnStyles.Add(clmValue10); tbs.GridColumnStyles[10].Width = 90; tbs.GridColumnStyles.Add(clmValue11); tbs.GridColumnStyles[11].Width = 90; tbs.GridColumnStyles.Add(clmValue12); tbs.GridColumnStyles[12].Width = 90; tbs.GridColumnStyles.Add(clmValue13); tbs.GridColumnStyles[13].Width = 90; tbs.GridColumnStyles.Add(clmValue14); tbs.GridColumnStyles[14].Width = 90; tbs.GridColumnStyles.Add(clmValue15); tbs.GridColumnStyles[15].Width = 90; tbs.GridColumnStyles.Add(clmValue16); tbs.GridColumnStyles[16].Width = 90; tbs.GridColumnStyles.Add(clmValue17); tbs.GridColumnStyles[17].Width = 105; if (d_Type) { tbs.GridColumnStyles.Add(clmValue18); tbs.GridColumnStyles[18].Width = 90; tbs.GridColumnStyles.Add(clmValue19); tbs.GridColumnStyles[19].Width = 90; } tbs.MappingName = "Table"; m_dataGrid.TableStyles.Add(tbs); }
private void FormatGridWithBothTableAndColumnStyles() { // Continue to set DataGrid properties directly, but only // those that are not covered by DataGridTableStyle properties. grdProducts.BackColor = Color.GhostWhite; grdProducts.BackgroundColor = Color.Lavender; grdProducts.BorderStyle = BorderStyle.None; grdProducts.CaptionBackColor = Color.RoyalBlue; grdProducts.CaptionFont = new Font("Tahoma", (float)10.0, FontStyle.Bold); grdProducts.CaptionForeColor = Color.Bisque; grdProducts.CaptionText = "Northwind Products"; grdProducts.Font = new Font("Tahoma", (float)8.0); grdProducts.ParentRowsBackColor = Color.Lavender; grdProducts.ParentRowsForeColor = Color.MidnightBlue; // Put much of the formatting possible here. DataGridTableStyle grdTableStyle1 = new DataGridTableStyle(); grdTableStyle1.AlternatingBackColor = Color.GhostWhite; grdTableStyle1.BackColor = Color.GhostWhite; grdTableStyle1.ForeColor = Color.MidnightBlue; grdTableStyle1.GridLineColor = Color.RoyalBlue; grdTableStyle1.HeaderBackColor = Color.MidnightBlue; grdTableStyle1.HeaderFont = new Font("Tahoma", (float)8.0, FontStyle.Bold); grdTableStyle1.HeaderForeColor = Color.Lavender; grdTableStyle1.SelectionBackColor = Color.Teal; grdTableStyle1.SelectionForeColor = Color.PaleGreen; // Do not forget to set the MappingName property. // Without this, the DataGridTableStyle properties // and any associated DataGridColumnStyle objects // will have no effect. grdTableStyle1.MappingName = PRODUCT_TABLE_NAME; grdTableStyle1.PreferredColumnWidth = 125; grdTableStyle1.PreferredRowHeight = 15; // Format each column that you want to appear in the DataGrid. // In most cases, the DataGridTextBoxColumn class is appropriate. // However, you can also use the DataGridBoolColumn class. Both // of these extend the MustInherit DataGridColumnStyle class. Notice // that the column style properties available to you are more limited // than those for the table style. For example, you can! change // the color of an individual column. DataGridTextBoxColumn grdColStyle1 = new DataGridTextBoxColumn(); grdColStyle1.HeaderText = "ID"; grdColStyle1.MappingName = "ProductID"; grdColStyle1.Width = 50; DataGridTextBoxColumn grdColStyle2 = new DataGridTextBoxColumn(); grdColStyle2.HeaderText = "Name"; grdColStyle2.MappingName = "ProductName"; DataGridTextBoxColumn grdColStyle3 = new DataGridTextBoxColumn(); grdColStyle3.HeaderText = "Price"; grdColStyle3.MappingName = "UnitPrice"; grdColStyle3.Width = 75; grdColStyle3.ReadOnly = true; DataGridTextBoxColumn grdColStyle4 = new DataGridTextBoxColumn(); grdColStyle4.HeaderText = "# In Stock"; grdColStyle4.MappingName = "UnitsInStock"; grdColStyle4.Width = 75; grdColStyle4.Alignment = HorizontalAlignment.Center; // Add the style objects to the table style's collection of // column styles. Without this the styles do not take effect. grdTableStyle1.GridColumnStyles.AddRange (new DataGridColumnStyle[] { grdColStyle1, grdColStyle2, grdColStyle3, grdColStyle4 }); grdProducts.TableStyles.Add(grdTableStyle1); }
private void InitializeComponent() { this.imgIcon = new System.Windows.Forms.PictureBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dgItems = new System.Windows.Forms.DataGrid(); this.dgStyle = new System.Windows.Forms.DataGridTableStyle(); this.TransactionID = new System.Windows.Forms.DataGridTextBoxColumn(); this.TransactionNo = new System.Windows.Forms.DataGridTextBoxColumn(); this.CustomerID = new System.Windows.Forms.DataGridTextBoxColumn(); this.CustomerName = new System.Windows.Forms.DataGridTextBoxColumn(); this.TransactionDate = new System.Windows.Forms.DataGridTextBoxColumn(); this.SubTotal = new System.Windows.Forms.DataGridTextBoxColumn(); this.Discount = new System.Windows.Forms.DataGridTextBoxColumn(); this.AmountPaid = new System.Windows.Forms.DataGridTextBoxColumn(); this.Credit = new System.Windows.Forms.DataGridTextBoxColumn(); this.CreditPaid = new System.Windows.Forms.DataGridTextBoxColumn(); this.Balance = new System.Windows.Forms.DataGridTextBoxColumn(); this.lblHeader1 = new System.Windows.Forms.Label(); this.lblBalanceName = new System.Windows.Forms.Label(); this.lblBalance = new System.Windows.Forms.Label(); this.lblHeader = new System.Windows.Forms.Label(); this.cmdCancel = new System.Windows.Forms.Button(); this.cmdEnter = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.imgIcon)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgItems)).BeginInit(); this.SuspendLayout(); // // imgIcon // this.imgIcon.BackColor = System.Drawing.Color.Blue; this.imgIcon.Location = new System.Drawing.Point(9, 5); this.imgIcon.Name = "imgIcon"; this.imgIcon.Size = new System.Drawing.Size(49, 49); this.imgIcon.TabIndex = 68; this.imgIcon.TabStop = false; this.imgIcon.Click += new System.EventHandler(this.imgIcon_Click); // // groupBox1 // this.groupBox1.BackColor = System.Drawing.Color.White; this.groupBox1.Controls.Add(this.dgItems); this.groupBox1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox1.ForeColor = System.Drawing.Color.Blue; this.groupBox1.Location = new System.Drawing.Point(9, 81); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(1009, 391); this.groupBox1.TabIndex = 69; this.groupBox1.TabStop = false; this.groupBox1.Text = "Unpaid Transaction Details"; // // dgItems // this.dgItems.AlternatingBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dgItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgItems.BackColor = System.Drawing.Color.White; this.dgItems.BackgroundColor = System.Drawing.Color.White; this.dgItems.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.dgItems.CaptionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dgItems.CaptionForeColor = System.Drawing.Color.Blue; this.dgItems.CaptionVisible = false; this.dgItems.DataMember = ""; this.dgItems.Enabled = false; this.dgItems.FlatMode = true; this.dgItems.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgItems.HeaderBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(81)))), ((int)(((byte)(153))))); this.dgItems.HeaderFont = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgItems.HeaderForeColor = System.Drawing.Color.White; this.dgItems.Location = new System.Drawing.Point(8, 24); this.dgItems.Name = "dgItems"; this.dgItems.ReadOnly = true; this.dgItems.RowHeadersVisible = false; this.dgItems.RowHeaderWidth = 5; this.dgItems.SelectionBackColor = System.Drawing.Color.RoyalBlue; this.dgItems.SelectionForeColor = System.Drawing.Color.White; this.dgItems.Size = new System.Drawing.Size(994, 361); this.dgItems.TabIndex = 55; this.dgItems.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] { this.dgStyle }); this.dgItems.TabStop = false; // // dgStyle // this.dgStyle.AlternatingBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dgStyle.DataGrid = this.dgItems; this.dgStyle.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] { this.TransactionID, this.TransactionNo, this.CustomerID, this.CustomerName, this.TransactionDate, this.SubTotal, this.Discount, this.AmountPaid, this.Credit, this.CreditPaid, this.Balance }); this.dgStyle.HeaderBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(81)))), ((int)(((byte)(153))))); this.dgStyle.HeaderFont = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgStyle.HeaderForeColor = System.Drawing.Color.White; this.dgStyle.MappingName = "tblForPayment"; this.dgStyle.PreferredColumnWidth = 0; this.dgStyle.ReadOnly = true; this.dgStyle.RowHeadersVisible = false; this.dgStyle.SelectionBackColor = System.Drawing.Color.RoyalBlue; this.dgStyle.SelectionForeColor = System.Drawing.Color.White; // // TransactionID // this.TransactionID.Format = ""; this.TransactionID.FormatInfo = null; this.TransactionID.MappingName = "TransactionID"; this.TransactionID.NullText = ""; this.TransactionID.ReadOnly = true; this.TransactionID.Width = 0; // // TransactionNo // this.TransactionNo.Format = ""; this.TransactionNo.FormatInfo = null; this.TransactionNo.HeaderText = "Trans. No"; this.TransactionNo.MappingName = "TransactionNo"; this.TransactionNo.NullText = ""; this.TransactionNo.ReadOnly = true; this.TransactionNo.Width = 120; // // CustomerID // this.CustomerID.Format = ""; this.CustomerID.FormatInfo = null; this.CustomerID.MappingName = "CustomerID"; this.CustomerID.NullText = ""; this.CustomerID.ReadOnly = true; this.CustomerID.Width = 0; // // CustomerName // this.CustomerName.Format = ""; this.CustomerName.FormatInfo = null; this.CustomerName.MappingName = "CustomerName"; this.CustomerName.NullText = ""; this.CustomerName.ReadOnly = true; this.CustomerName.Width = 0; // // TransactionDate // this.TransactionDate.Format = ""; this.TransactionDate.FormatInfo = null; this.TransactionDate.HeaderText = "Trans. Date"; this.TransactionDate.MappingName = "TransactionDate"; this.TransactionDate.NullText = ""; this.TransactionDate.ReadOnly = true; this.TransactionDate.Width = 90; // // SubTotal // this.SubTotal.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.SubTotal.Format = ""; this.SubTotal.FormatInfo = null; this.SubTotal.HeaderText = "SubTotal"; this.SubTotal.MappingName = "SubTotal"; this.SubTotal.NullText = ""; this.SubTotal.ReadOnly = true; this.SubTotal.Width = 0; // // Discount // this.Discount.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.Discount.Format = ""; this.Discount.FormatInfo = null; this.Discount.HeaderText = "Discount"; this.Discount.MappingName = "Discount"; this.Discount.NullText = ""; this.Discount.ReadOnly = true; this.Discount.Width = 0; // // AmountPaid // this.AmountPaid.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.AmountPaid.Format = ""; this.AmountPaid.FormatInfo = null; this.AmountPaid.HeaderText = "Amnt. Paid"; this.AmountPaid.MappingName = "AmountPaid"; this.AmountPaid.NullText = ""; this.AmountPaid.ReadOnly = true; this.AmountPaid.Width = 0; // // Credit // this.Credit.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.Credit.Format = ""; this.Credit.FormatInfo = null; this.Credit.HeaderText = "Credit"; this.Credit.MappingName = "Credit"; this.Credit.NullText = ""; this.Credit.ReadOnly = true; this.Credit.Width = 0; // // CreditPaid // this.CreditPaid.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.CreditPaid.Format = ""; this.CreditPaid.FormatInfo = null; this.CreditPaid.HeaderText = "Amt. Paid"; this.CreditPaid.MappingName = "CreditPaid"; this.CreditPaid.NullText = ""; this.CreditPaid.ReadOnly = true; this.CreditPaid.Width = 0; // // Balance // this.Balance.Alignment = System.Windows.Forms.HorizontalAlignment.Right; this.Balance.Format = ""; this.Balance.FormatInfo = null; this.Balance.HeaderText = "Balance"; this.Balance.MappingName = "Balance"; this.Balance.NullText = ""; this.Balance.ReadOnly = true; this.Balance.Width = 0; // // lblHeader1 // this.lblHeader1.AutoSize = true; this.lblHeader1.BackColor = System.Drawing.Color.Transparent; this.lblHeader1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblHeader1.ForeColor = System.Drawing.Color.White; this.lblHeader1.Location = new System.Drawing.Point(67, 22); this.lblHeader1.Name = "lblHeader1"; this.lblHeader1.Size = new System.Drawing.Size(177, 13); this.lblHeader1.TabIndex = 70; this.lblHeader1.Text = "Current credit transactions of "; // // lblBalanceName // this.lblBalanceName.AutoSize = true; this.lblBalanceName.BackColor = System.Drawing.Color.Transparent; this.lblBalanceName.Font = new System.Drawing.Font("Arial Narrow", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblBalanceName.Location = new System.Drawing.Point(446, 475); this.lblBalanceName.Name = "lblBalanceName"; this.lblBalanceName.Size = new System.Drawing.Size(255, 29); this.lblBalanceName.TabIndex = 86; this.lblBalanceName.Text = "TOTAL CREDIT BALANCE"; // // lblBalance // this.lblBalance.BackColor = System.Drawing.Color.Transparent; this.lblBalance.Font = new System.Drawing.Font("Arial Narrow", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblBalance.ForeColor = System.Drawing.Color.Firebrick; this.lblBalance.Location = new System.Drawing.Point(667, 477); this.lblBalance.Name = "lblBalance"; this.lblBalance.Size = new System.Drawing.Size(351, 25); this.lblBalance.TabIndex = 87; this.lblBalance.Text = "0.00"; this.lblBalance.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // lblHeader // this.lblHeader.AutoSize = true; this.lblHeader.BackColor = System.Drawing.Color.Transparent; this.lblHeader.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblHeader.ForeColor = System.Drawing.Color.Red; this.lblHeader.Location = new System.Drawing.Point(238, 22); this.lblHeader.Name = "lblHeader"; this.lblHeader.Size = new System.Drawing.Size(133, 13); this.lblHeader.TabIndex = 88; this.lblHeader.Text = "RetailPlus Customer ™"; // // cmdCancel // this.cmdCancel.AutoSize = true; this.cmdCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.cmdCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cmdCancel.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cmdCancel.ForeColor = System.Drawing.Color.White; this.cmdCancel.Location = new System.Drawing.Point(765, 618); this.cmdCancel.Name = "cmdCancel"; this.cmdCancel.Size = new System.Drawing.Size(106, 83); this.cmdCancel.TabIndex = 1; this.cmdCancel.Text = "CANCEL"; this.cmdCancel.UseVisualStyleBackColor = true; this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click); // // cmdEnter // this.cmdEnter.AutoSize = true; this.cmdEnter.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.cmdEnter.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.cmdEnter.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cmdEnter.ForeColor = System.Drawing.Color.White; this.cmdEnter.Location = new System.Drawing.Point(877, 618); this.cmdEnter.Name = "cmdEnter"; this.cmdEnter.Size = new System.Drawing.Size(106, 83); this.cmdEnter.TabIndex = 0; this.cmdEnter.Text = "ENTER"; this.cmdEnter.UseVisualStyleBackColor = true; this.cmdEnter.Click += new System.EventHandler(this.cmdEnter_Click); // // CreditsWnd // this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(1022, 766); this.ControlBox = false; this.Controls.Add(this.cmdCancel); this.Controls.Add(this.cmdEnter); this.Controls.Add(this.lblHeader); this.Controls.Add(this.lblBalanceName); this.Controls.Add(this.lblHeader1); this.Controls.Add(this.lblBalance); this.Controls.Add(this.imgIcon); this.Controls.Add(this.groupBox1); this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.KeyPreview = true; this.Name = "CreditsWnd"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.CreditsWnd_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CreditsWnd_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.imgIcon)).EndInit(); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dgItems)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void InitValues() { this.tbReportFile.Text = _Draw.GetElementValue(_Subreport, "ReportName", ""); this.tbNoRows.Text = _Draw.GetElementValue(_Subreport, "NoRows", ""); this.chkMergeTrans.Checked = _Draw.GetElementValue(_Subreport, "MergeTransactions", "false").ToLower() == "true"; // Initialize the DataGrid columns dgtbName = new DataGridTextBoxColumn(); dgtbValue = new DataGridTextBoxColumn(); this.dgTableStyle.GridColumnStyles.AddRange(new DataGridColumnStyle[] { this.dgtbName, this.dgtbValue }); // // dgtbFE // dgtbName.HeaderText = "Parameter Name"; dgtbName.MappingName = "ParameterName"; dgtbName.Width = 75; // Get the parent's dataset name // string dataSetName = _Draw.GetDataSetNameValue(_FilterParent); // // string[] fields = _Draw.GetFields(dataSetName, true); // if (fields != null) // dgtbFE.CB.Items.AddRange(fields); // // dgtbValue // this.dgtbValue.HeaderText = "Value"; this.dgtbValue.MappingName = "Value"; this.dgtbValue.Width = 75; // string[] parms = _Draw.GetReportParameters(true); // if (parms != null) // dgtbFV.CB.Items.AddRange(parms); // Initialize the DataTable _DataTable = new DataTable(); _DataTable.Columns.Add(new DataColumn("ParameterName", typeof(string))); _DataTable.Columns.Add(new DataColumn("Value", typeof(string))); string[] rowValues = new string[2]; XmlNode parameters = _Draw.GetNamedChildNode(_Subreport, "Parameters"); if (parameters != null) { foreach (XmlNode pNode in parameters.ChildNodes) { if (pNode.NodeType != XmlNodeType.Element || pNode.Name != "Parameter") { continue; } rowValues[0] = _Draw.GetElementAttribute(pNode, "Name", ""); rowValues[1] = _Draw.GetElementValue(pNode, "Value", ""); _DataTable.Rows.Add(rowValues); } } // Don't allow users to add their own rows // DataView dv = new DataView(_DataTable); // bad side effect // dv.AllowNew = false; this.dgParms.DataSource = _DataTable; DataGridTableStyle ts = dgParms.TableStyles[0]; ts.GridColumnStyles[0].Width = 140; ts.GridColumnStyles[0].ReadOnly = true; ts.GridColumnStyles[1].Width = 140; }
// <Snippet1> private void GetSelectedIndex(DataGridTableStyle myGridTable) { /* Get the name of the DataGrid of the DataGridTable * passed as an argument. */ Console.WriteLine(myGridTable.DataGrid.CurrentCell.ToString()); }
private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = ds1.Tables[0].TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.ReadOnly = false; ts.RowHeaderWidth = 10; DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ngay"; TextCol.HeaderText = "Ngày"; TextCol.Width = 70; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "may"; TextCol.HeaderText = "Tên máy"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "user"; TextCol.HeaderText = "Người dùng"; TextCol.Width = 200; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "noidung"; TextCol.HeaderText = "Nội dung"; TextCol.Width = 220; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ins"; TextCol.HeaderText = "Thêm"; TextCol.Width = 50; TextCol.Format = "### ### ##0"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "upd"; TextCol.HeaderText = "Thay đổi"; TextCol.Width = 50; TextCol.Format = "### ### ##0"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "del"; TextCol.HeaderText = "Hủy"; TextCol.Width = 50; TextCol.Format = "### ### ##0"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tableid"; TextCol.HeaderText = ""; TextCol.Width = 0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "computerid"; TextCol.HeaderText = ""; TextCol.Width = 0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "userid"; TextCol.HeaderText = ""; TextCol.Width = 0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
private void AddGridTableStyle() { DataGridColoredTextBoxColumn TextCol1; delegateGetColorRowCol de = new delegateGetColorRowCol(MyGetColorRowCol); DataGridTableStyle ts = new DataGridTableStyle(); ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.RowHeaderWidth = 10; ts.MappingName = ds.Tables[0].TableName; ts.AllowSorting = false; TextCol1 = new DataGridColoredTextBoxColumn(de, 0); TextCol1.MappingName = "ma"; TextCol1.HeaderText = "ma"; TextCol1.Width = 0; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 1); TextCol1.MappingName = "stt"; TextCol1.HeaderText = "STT"; TextCol1.Width = 24; TextCol1.ReadOnly = true; TextCol1.Alignment = HorizontalAlignment.Center; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 2); TextCol1.MappingName = "ten"; TextCol1.HeaderText = "Cơ sở, trạm y tế thuộc TTYT huyện"; TextCol1.Width = 190; TextCol1.ReadOnly = true; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 3); TextCol1.MappingName = "C01"; TextCol1.HeaderText = "C01"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 4); TextCol1.MappingName = "C02"; TextCol1.HeaderText = "C02"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 5); TextCol1.MappingName = "C03"; TextCol1.HeaderText = "C03"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 6); TextCol1.MappingName = "C04"; TextCol1.HeaderText = "C04"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 7); TextCol1.MappingName = "C05"; TextCol1.HeaderText = "C05"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 8); TextCol1.MappingName = "C06"; TextCol1.HeaderText = "C06"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 9); TextCol1.MappingName = "C07"; TextCol1.HeaderText = "C07"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 10); TextCol1.MappingName = "C08"; TextCol1.HeaderText = "C08"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 11); TextCol1.MappingName = "C09"; TextCol1.HeaderText = "C09"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 12); TextCol1.MappingName = "C10"; TextCol1.HeaderText = "C10"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 13); TextCol1.MappingName = "C11"; TextCol1.HeaderText = "C11"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 14); TextCol1.MappingName = "C12"; TextCol1.HeaderText = "C12"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 15); TextCol1.MappingName = "C13"; TextCol1.HeaderText = "C13"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 16); TextCol1.MappingName = "C14"; TextCol1.HeaderText = "C14"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 17); TextCol1.MappingName = "C15"; TextCol1.HeaderText = "C15"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 18); TextCol1.MappingName = "C16"; TextCol1.HeaderText = "C16"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 19); TextCol1.MappingName = "C17"; TextCol1.HeaderText = "C17"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 20); TextCol1.MappingName = "C18"; TextCol1.HeaderText = "C18"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 21); TextCol1.MappingName = "C19"; TextCol1.HeaderText = "C19"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 22); TextCol1.MappingName = "C20"; TextCol1.HeaderText = "C20"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 23); TextCol1.MappingName = "C21"; TextCol1.HeaderText = "C21"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 24); TextCol1.MappingName = "C22"; TextCol1.HeaderText = "C22"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 25); TextCol1.MappingName = "C23"; TextCol1.HeaderText = "C23"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); TextCol1 = new DataGridColoredTextBoxColumn(de, 26); TextCol1.MappingName = "C24"; TextCol1.HeaderText = "C24"; TextCol1.Width = 39; TextCol1.Format = "# ### ###"; TextCol1.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol1); dataGrid1.TableStyles.Add(ts); }
// Methods public static DataGridTableStyle[] CreateGridTables(DataGridTableStyle gridTable, object dataSource, string dataMember, BindingContext bindingManager) {}