Home » excel » .net – Why are WinForms controls disabled when the user zooms in Excel?

.net – Why are WinForms controls disabled when the user zooms in Excel?

Posted by: admin May 14, 2020 Leave a comment

Questions:

When I open up an Excel spreadsheet with embedded WinForms controls, zoom in a bit (ctrl + scroll), and try to click on a control (tested with button and listbox), the following message is displayed in a popup:

Windows Forms controls have been disabled because the document has been scaled. When zoom is returned to 100%, controls will reactivate.

What is the reasoning for making controls nonfunctional when zoomed in/out, and is there any way to work around this to keep the controls working?

I’m using .NET 3.5 and Excel 2007.

How to&Answers:

Because zooming uses a temporary image of the form in order to zoom it, and therefore there are no controls. When you return to the normal view, the image is discarded and you’re back to the actual form, which has controls on it.

You can’t work around this using normal Excel zoom functionality, because there’s nothing to work around.

Answer:

There is some kind of workaround.
Instead inserting forms from the VS toolbox, I opened the workbook in excel and insert some ActiveX Controls, they don’t come with that limitation.