c# winfrom 界面设计
1.在用DotnetBar的RibbonControl时,界面最大化时,会把电脑桌面的任务栏遮盖住;
解决办法:在load事件中写入:
this.MaximumSize = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width + 6, Screen.PrimaryScreen.WorkingArea.Height + 6);
2.dataGridView表头字段过多时,自适应宽度:
ColumnHeadersDefaultCellStyle 这个属性默认是TRUE,改成NotSet
3.滑动滚动条,两个dataGridView同步滚动
1 private void Dgv_Scroll(object sender, ScrollEventArgs e) 2 { 3 dgv_total.FirstDisplayedScrollingRowIndex = Dgv.FirstDisplayedScrollingRowIndex; 4 5 dgv_total.HorizontalScrollingOffset = Dgv.HorizontalScrollingOffset; 6 } 7 8 private void dgv_total_Scroll(object sender, ScrollEventArgs e) 9 { 10 Dgv.FirstDisplayedScrollingRowIndex = dgv_total.FirstDisplayedScrollingRowIndex; 11 12 Dgv.HorizontalScrollingOffset = dgv_total.HorizontalScrollingOffset; 13 }