1

I created a Window Form project on Visual Studio 2022, based on .net 6.0. But when I pull the control into the Form, Visual Studio prompts:

"No object reference set to an instance of an object"

In addition, I am using an external monitor, and I did this on the monitor, but I didn't have this problem when I did it on another monitor. Why?

Soiler
  • 13
  • 2

1 Answers1

0

According to NullReferenceException when dragging control onto Form, it should be because the resolution of your external monitor is not adjusted with the main monitor same scaling.

You can check the scaling of the screen in the display settings and adjust them to be consistent, so that you can drag the controls on another monitor normally

Because Windows Forms Designer doesn't scale. WinForms is pixel based, you can't get scaling. Pixel-based means that controls and elements are defined with a specific width and height measured in pixels and rendered accordingly. They don't scale with resolution scaling, and don't scale easily.

wenbingeng-MSFT
  • 1,546
  • 1
  • 1
  • 8