还是winfrom存局的问题,用户拖拽datagridview,改变了DG的大小,可是DG的滚动条却没有了?
先说说都设置了什么属性
DG放在一个panel中,
panel设置的属性有
autoscroll=true
DG设置的属性中
dock=fill
其它略...
在我执行了对DG的拖拽之后,DG的滚动条居然没有了,横的竖的都没有了。下面是拖拽时的代码
- C# code
private void dgvCarList_MouseMove(object sender, MouseEventArgs e) { if (e.Y > -3 && e.Y < 3) { this.dgvCarList.Cursor = this.btnCurSizeNs.Cursor; } else { if (this.IsdgvMove == true) { this.dgvCarList.Cursor = this.btnCurSizeNs.Cursor; } else { this.dgvCarList.Cursor = this.btuCurZhengChang.Cursor; } } } private void dgvCarList_MouseDown(object sender, MouseEventArgs e) { if (e.Y > -3 && e.Y < 3) { this.IsdgvMove = true; } } private void dgvCarList_MouseUp(object sender, MouseEventArgs e) { if (!this.IsdgvMove) { return; } this.panControl.Size = new Size(this.panControl.Width, this.panControl.Size.Height + e.Y); this.panList.Size = new Size(this.Size.Width, this.Size.Height - e.Y); this.panList.Location = new Point(this.panList.Location.X, this.panList.Location.Y + e.Y); this.IsdgvMove = false; }
[解决办法]