Visual Studio designer moving controls and adding grid columns when form is opened

跟風遠走 提交于 2019-12-13 17:30:04

问题


The first time I try to open a particular form many of the controls (those with anchors on the right side and/or the bottom) are shifted and my grids automatically regain all the columns from their datasource which (the columns) I had previously removed.

I have read elsewhere it is recommended to copy the 'good' designer code into the constructor after the InitializeComponent method. This doesn't seem to be a good long term solution, eg what if a user makes future design changes?

Any suggestions/workarounds? Is this a Visual Studio 2008 bug?


回答1:


I found deleting the controls and adding them back in works. Not just cut and paste, but adding the controls back from scratch. This seems to be related to where to designer code is written in the InitialiseComponent method.

This link describes some issues with anchoring and derived forms: http://weblogs.asp.net/rweigelt/archive/2003/09/24/28984.aspx



来源:https://stackoverflow.com/questions/437720/visual-studio-designer-moving-controls-and-adding-grid-columns-when-form-is-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!