问题描述:

I have a Project in Visual Studio which includes some UserControl files. I created some custom toolboxes (we'll call it the scroll bar) that I manually put into the UserControl code, where most of the code is compiler generated. So if I change the layout of the UserControl using the Designer, the code behind gets changed and my scroll bar does not show up anymore. I've found a way to address this via here.

But now the problem I am having is I want to relate a Windows checkbox to my scroll bar such that if the checkBox is unchecked, I want to hide the scroll bar. If it is checked, I want it to show up.

Is there a way to accomplish this without manipulating the compiler generated code? I am able to do this by changing the code but as I've noted, if I change the UserControl from the designer, I lose all my custom changed code.

网友答案:

A partial class might be what you are looking for.

相关阅读:
Top