Square mouse pointer in Visual Studio 2008 designe

2019-07-31 17:52发布

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. enter image description here

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...

2条回答
一夜七次
2楼-- · 2019-07-31 18:31

Have you tried,

Cursor = Cursors.Default;

or setting it to some other Cursors value?

查看更多
干净又极端
3楼-- · 2019-07-31 18:36

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

查看更多
登录 后发表回答