internal void Init(QQTextBox textbox, TDataGridView gridview1) { this.TextBox = textbox; this.gridview1 = gridview1; textbox.Edit.LostFocus += TextBox_LostFocus; textbox.Edit.Click += TextBox_Click; textbox.KeyDown += TextBox_KeyDown; gridview1.RefreshChanged += Gridview1_RefreshChanged; gridview1.DoubleClick += Gridview1_DoubleClick; this.Location = new Point(TextBox.Location.X + 1, TextBox.Location.Y + TextBox.Height - 2); this.Width = TextBox.Width - 2; }
/// <summary> /// 使用树结构 /// </summary> public bool UserTree(bool iExpandAll = false, bool iDoubleExpand = true) { if (gridview1 is TreeGridView) { return(false); } this.Controls.Remove(this.gridview1); var treeView = new TreeGridView(); gridview1 = treeView; if (iExpandAll) { gridview1.RefreshChanged += delegate { treeView.ExpandAll(); } } ; if (iDoubleExpand) { gridview1.RowDoubleClick += delegate { if (treeView.CurrentNode != null && treeView.CurrentNode.Nodes.Count > 0) { if (!treeView.CurrentNode.IsExpanded) { treeView.CurrentNode.Expand(); } else { treeView.CurrentNode.Collapse(); } } } } ; gridview1.Dock = DockStyle.Fill; this.Controls.Add(this.gridview1); this.Controls.SetChildIndex(this.gridview1, 0); IGroup = GroupType.Total; return(true); }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing) { } if (Id != null) { Id.Dispose(); Id = null; } if (gridview1 != null) { gridview1.Dispose(); gridview1 = null; } if (pager1 != null) { pager1.Dispose(); pager1 = null; } base.Dispose(disposing); }
internal virtual void Gridview1_RefreshChanged(TDataGridView gridview1) { RefreshChanged?.Invoke(gridview1); }
/// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.lbBottom = new System.Windows.Forms.Label(); this.pager1 = new Paway.Forms.TPager(); this.lbTop = new System.Windows.Forms.Label(); this.gridview1 = new Paway.Forms.TDataGridView(); this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lbLeft = new System.Windows.Forms.Label(); this.lbRight = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.gridview1)).BeginInit(); this.SuspendLayout(); // // lbBottom // this.lbBottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(204)))), ((int)(((byte)(223))))); this.lbBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.lbBottom.Location = new System.Drawing.Point(0, 202); this.lbBottom.Name = "lbBottom"; this.lbBottom.Size = new System.Drawing.Size(576, 1); this.lbBottom.TabIndex = 103; // // pager1 // this.pager1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(207)))), ((int)(((byte)(221)))), ((int)(((byte)(238))))); this.pager1.Dock = System.Windows.Forms.DockStyle.Bottom; this.pager1.Font = new System.Drawing.Font("微软雅黑", 11F); this.pager1.Location = new System.Drawing.Point(0, 172); this.pager1.Name = "pager1"; this.pager1.Size = new System.Drawing.Size(576, 30); this.pager1.TabIndex = 104; // // lbTop // this.lbTop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(204)))), ((int)(((byte)(223))))); this.lbTop.Dock = System.Windows.Forms.DockStyle.Top; this.lbTop.Location = new System.Drawing.Point(0, 0); this.lbTop.Name = "lbTop"; this.lbTop.Size = new System.Drawing.Size(576, 0); this.lbTop.TabIndex = 108; // // gridview1 // this.gridview1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Id }); this.gridview1.Dock = System.Windows.Forms.DockStyle.Fill; this.gridview1.Location = new System.Drawing.Point(0, 0); this.gridview1.Name = "gridview1"; this.gridview1.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("微软雅黑", 9F); this.gridview1.RowTemplate.DefaultCellStyle.ForeColor = System.Drawing.Color.Black; this.gridview1.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.LightBlue; this.gridview1.RowTemplate.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.Black; this.gridview1.RowTemplate.Height = 32; this.gridview1.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.gridview1.Size = new System.Drawing.Size(576, 172); this.gridview1.TabIndex = 109; // // Id // this.Id.DataPropertyName = "Id"; this.Id.HeaderText = "Id"; this.Id.Name = "Id"; this.Id.ReadOnly = true; // // lbLeft // this.lbLeft.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(204)))), ((int)(((byte)(223))))); this.lbLeft.Dock = System.Windows.Forms.DockStyle.Left; this.lbLeft.Location = new System.Drawing.Point(0, 0); this.lbLeft.Name = "lbLeft"; this.lbLeft.Size = new System.Drawing.Size(1, 172); this.lbLeft.TabIndex = 110; // // lbRight // this.lbRight.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(149)))), ((int)(((byte)(204)))), ((int)(((byte)(223))))); this.lbRight.Dock = System.Windows.Forms.DockStyle.Right; this.lbRight.Location = new System.Drawing.Point(575, 0); this.lbRight.Name = "lbRight"; this.lbRight.Size = new System.Drawing.Size(1, 172); this.lbRight.TabIndex = 111; // // TDataGridViewPager // this.Controls.Add(this.lbRight); this.Controls.Add(this.lbLeft); this.Controls.Add(this.gridview1); this.Controls.Add(this.lbTop); this.Controls.Add(this.pager1); this.Controls.Add(this.lbBottom); this.Name = "TDataGridViewPager"; this.Size = new System.Drawing.Size(576, 203); ((System.ComponentModel.ISupportInitialize)(this.gridview1)).EndInit(); this.ResumeLayout(false); }
internal override void Gridview1_RefreshChanged(TDataGridView gridview1) { gridview1.GetColumn(nameof(IMultiple.Image)).Width = 42; }