Support Statement: Making a control into a class
Question
How do you suppress the creation of designer code for a component? We are going to use Component One's new grid version and their resizer light component. When I mapped the resizer, it looks good except it generates designer code that is not supported.
I assume this is because these are standard for a control…
this.vbsResize1.Location = new System.Drawing.Point(0, 32); this.vbsResize1.Name = "vbsResize1"; this.vbsResize1.Size = new System.Drawing.Size(0, 0);
Â
and it adds a line to the control arrays
this.picDataSource.Controls.AddRange(new System.Windows.Forms.Control[] { this.txtNumber, this._txtWhse_0, this.adoWhseGRID, this.vbsResize1 });
Answer
Find the definition of the control in your IDFs. The original control type is in the form definition
Begin Resizer.vbsResize vbsResize1
The definition of this type is in the IDF resizer.ocx.xml
<DescriptionFile> <library id="Resizer.ocx" ... <coclass id="vbsResize" uuid="777CE4BD-E17B-453D-AC5F-46C6C22CF378" creatable="off" migStatus="ActiveX" migName="AxResizer.AxvbsResize"> ...
We will modify this IDF to make this component be treated like a plain class.
1) Copy the IDF to your target folder (proj\iusr) so your custom copy will take precedence over the standard one.
2) Add a Refactor block to the bottom of the file
... </library> <Refactor id="[Resizer.ocx]"> <!-- turn off adding to control collections --> <Migrate id="vbsResize" nPram="0" migPattern="vbsResize" role="define"/> Â <!-- replace default property initialization with an empty migClass --> <migClass id="NetControl.vbsResize" migName="vbsResize" parent="vbsResize"> </migClass> </Refactor> </DescriptionFile>