User Control in C++/CLI Forms Designer

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
Im trying to use a User Control that is designed in the application where it is used. I found the following thread on this, but it is not working as I expect it:
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/2f41a425-f1f9-4935-bce5-913daac432f8/ http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/2f41a425-f1f9-4935-bce5-913daac432f8/
I was able to add the control to the Toolbox bar, but sometimes it does not seem to work. I always get "To prevent possible data loss before loading the designer, the following errors must be resolved:" as message although the controls are shown in the Toolbox stripe.<br/><br/>And currently I get the message "Attempt to load an unverifiable executable with fixups (IAT with mor than 2 sections or a TLS section.) Exception from HRESULT: 0x80131019" when I try to add the current application to the Toolbox.<br/><br/>So what is the official way to use a User Control in the Forms Designer, when the control itself is part of the application itself and not in a seperat library?<br/><br/>Btw what I want to do is, I want derive from Panel to change its behaviour.<br/>
<pre>public ref class myPanel : public Panel {
public:
myPanel() : Panel() {
SetStyle(ControlStyles::DoubleBuffer, true);
SetStyle(ControlStyles::UserPaint, true);
SetStyle(ControlStyles::AllPaintingInWmPaint, true);
};
};[/code]
Thus I changed all Panel objects of my form in myPanel objects. The application is running fine, and sometimes I was even able to open the designer and everything looked good. But there must be a reason, why the designer runs into problems with this myPanel replacement (myPanel is listed in the Toolbox stripe!).<br/><br/><br/> 

View the full article
 
Back
Top