Square mouse pointer in Visual Studio 2008 designer

旧时模样 提交于 2019-12-11 05:19:32

问题


A strange issue with Visual Studio 2008. I have a winforms application that contains several forms.

On one of my forms, the mouse pointer has a square shape around the arrow, like in the attached image. I cannot get rid of it, no matter what I tried. The square keeps moving along with the mouse pointer. Seems funny, but it's really frustrating, really, because I cannot use the drag-and-drop functionality at all. This prevents me from working with the designer. Imagine that I cannot grab the edge of any control to resize it. I can move controls, though...

What is particular about this form is that it is derived from another form, like this:

public partial class MyForm : BaseForm

BaseForm is also derived from Form. I'd say nothing too uncommon.

Thanks for any idea.

Later Edit: I found why I got an error when entering into MyForm's designer. BaseForm has an Microsoft.Reporting.WinForms.ReportViewer component. The component was added as a private member. When working with MyForm's designer, VS was automatically generating a new Microsoft.Reporting.WinForms.ReportViewer member for MyForm, so I got 2 members with the same name. One defined in the base class, one in the derived class. I solved this by declaring the base class's member as public and regenerating the derived class, so no need to duplicate things. Anyway, unfortunately, this did not solve my designer issue with the mouse cursor...


回答1:


Chances are that the BaseForm has soe logic in its constructor or other eventhandlers that is supposed to run at runtime but not at DesignTime.

You could use:

if (!this.DesignMode)
{
    // runtime only
}

to block out some logic at design mode




回答2:


Have you tried,

Cursor = Cursors.Default;

or setting it to some other Cursors value?



来源:https://stackoverflow.com/questions/5998092/square-mouse-pointer-in-visual-studio-2008-designer

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