all groups > dotnet windows forms designtime > july 2005 >
You're in the dotnet windows forms designtime group:
Container control in designtime
dotnet windows forms designtime:
Hi there, I am stuck in that, so I need your help. I designed a user control, which is mainly a GroupBox (GB). When I drag a control in the GB, the new control (NC) seems to be behind the GB. When I move my GB, the NC appears until I stop moving the GB. At runtime, the NC does not show up. What I wanted to do is a usercontrol behaving like a normal group box, i.e. when I drop a control on it, I want it to become a group box child. I can see in the generated source something like GB.Controls.Add(NC), but I guess, this is not that easy. Any suggestions? Many thanks,
You could change the designer for your custom UserControl. First add a reference to the System.Design.dll assembly and then set the designer as shown below. using System.ComponentModel; using System.Windows.Forms.Design; [Designer(typeof(ParentControlDesigner))] public class MyUserControl : System.Windows.Forms.UserControl { ... } Alternatively, you could derive your control from another control like the Panel control. -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message news:60E2A968-6F8E-4BCE-A856-7316E2E3AB1A@microsoft.com... > Hi there, > > I am stuck in that, so I need your help. I designed a user control, which is > mainly a GroupBox (GB). When I drag a control in the GB, the new control (NC) > seems to be behind the GB. When I move my GB, the NC appears until I stop > moving the GB. At runtime, the NC does not show up. What I wanted to do is a > usercontrol behaving like a normal group box, i.e. when I drop a control on > it, I want it to become a group box child. I can see in the generated source > something like GB.Controls.Add(NC), but I guess, this is not that easy. Any > suggestions? > > Many thanks, > > Monarghel
Tim, I followed your tips, but I still have the sames problems. To be more accurate, my usercontrol inherits from an abstract class which is itself derivated from usercontrol class. I added some properties to it, nothing much. UserControl --> MpeParameter (the abstract one) --> MpeGroupBox. I applied the new designer on MpeGroupBox, because several other classes will be derived from MpeParameter . I am using Visual Studio 2005 beta 2, could be a bug? Thanks, Monarghel. [quoted text, click to view] "Tim Wilson" wrote: > You could change the designer for your custom UserControl. First add a > reference to the System.Design.dll assembly and then set the designer as > shown below. > > using System.ComponentModel; > using System.Windows.Forms.Design; > > [Designer(typeof(ParentControlDesigner))] > public class MyUserControl : System.Windows.Forms.UserControl > { > ... > } > > Alternatively, you could derive your control from another control like the > Panel control. > > -- > Tim Wilson > ..Net Compact Framework MVP
Have you rebuilt your custom UserControl to see if the changes are properly reflected in any instances that may be on a form, in the designer, that you may be using? Try a rebuild of the UserControl(s). -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message news:5FF681F0-9A41-4465-8C8C-3052099AEF3E@microsoft.com... > Tim, > > I followed your tips, but I still have the sames problems. To be more > accurate, my usercontrol inherits from an abstract class which is itself > derivated from usercontrol class. I added some properties to it, nothing much. > > UserControl --> MpeParameter (the abstract one) --> MpeGroupBox. I applied > the new designer on MpeGroupBox, because several other classes will be > derived from MpeParameter . > > I am using Visual Studio 2005 beta 2, could be a bug? > > Thanks, > > Monarghel. > > > "Tim Wilson" wrote: > > > You could change the designer for your custom UserControl. First add a > > reference to the System.Design.dll assembly and then set the designer as > > shown below. > > > > using System.ComponentModel; > > using System.Windows.Forms.Design; > > > > [Designer(typeof(ParentControlDesigner))] > > public class MyUserControl : System.Windows.Forms.UserControl > > { > > ... > > } > > > > Alternatively, you could derive your control from another control like the > > Panel control. > > > > -- > > Tim Wilson > > ..Net Compact Framework MVP >
Well, my custom control was rebuilt, same problems. Do have I to override some methods? I am sorry to bother you with that, but this is crucial for my project. Thanks, Christophe. [quoted text, click to view] "Tim Wilson" wrote: > Have you rebuilt your custom UserControl to see if the changes are properly > reflected in any instances that may be on a form, in the designer, that you > may be using? Try a rebuild of the UserControl(s). > > -- > Tim Wilson > ..Net Compact Framework MVP > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > news:5FF681F0-9A41-4465-8C8C-3052099AEF3E@microsoft.com... > > Tim, > > > > I followed your tips, but I still have the sames problems. To be more > > accurate, my usercontrol inherits from an abstract class which is itself > > derivated from usercontrol class. I added some properties to it, nothing > much. > > > > UserControl --> MpeParameter (the abstract one) --> MpeGroupBox. I applied > > the new designer on MpeGroupBox, because several other classes will be > > derived from MpeParameter . > > > > I am using Visual Studio 2005 beta 2, could be a bug? > > > > Thanks, > > > > Monarghel. > > > > > > "Tim Wilson" wrote: > > > > > You could change the designer for your custom UserControl. First add a > > > reference to the System.Design.dll assembly and then set the designer as > > > shown below. > > > > > > using System.ComponentModel; > > > using System.Windows.Forms.Design; > > > > > > [Designer(typeof(ParentControlDesigner))] > > > public class MyUserControl : System.Windows.Forms.UserControl > > > { > > > ... > > > } > > > > > > Alternatively, you could derive your control from another control like > the > > > Panel control. > > > > > > -- > > > Tim Wilson > > > ..Net Compact Framework MVP > > > >
I am trying to reach you, but I do not have any valid email address, and I am not able to attach any file using the web interface. Could you send me an address at ckamieniarz@hotmail.com? Thanks. [quoted text, click to view] "Tim Wilson" wrote: > It all seems to work fine for me, against the 1.1 and 2.0 (beta) framework. > Maybe there's something in your project or source that is causing this. Can > you post the complete source code for the MpeParameter and MpeGroupBox > classes? > > -- > Tim Wilson > ..Net Compact Framework MVP > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > news:D8D5B0F5-AF48-46E2-9D93-6808AA504ED7@microsoft.com... > > Well, my custom control was rebuilt, same problems. Do have I to override > > some methods? I am sorry to bother you with that, but this is crucial for > my > > project. > > > > Thanks, > > > > Christophe. > > > > "Tim Wilson" wrote: > > > > > Have you rebuilt your custom UserControl to see if the changes are > properly > > > reflected in any instances that may be on a form, in the designer, that > you > > > may be using? Try a rebuild of the UserControl(s). > > > > > > -- > > > Tim Wilson > > > ..Net Compact Framework MVP > > > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > > news:5FF681F0-9A41-4465-8C8C-3052099AEF3E@microsoft.com... > > > > Tim, > > > > > > > > I followed your tips, but I still have the sames problems. To be more > > > > accurate, my usercontrol inherits from an abstract class which is > itself > > > > derivated from usercontrol class. I added some properties to it, > nothing > > > much. > > > > > > > > UserControl --> MpeParameter (the abstract one) --> MpeGroupBox. I > applied > > > > the new designer on MpeGroupBox, because several other classes will be > > > > derived from MpeParameter . > > > > > > > > I am using Visual Studio 2005 beta 2, could be a bug? > > > > > > > > Thanks, > > > > > > > > Monarghel. > > > > > > > > > > > > "Tim Wilson" wrote: > > > > > > > > > You could change the designer for your custom UserControl. First add > a > > > > > reference to the System.Design.dll assembly and then set the > designer as > > > > > shown below. > > > > > > > > > > using System.ComponentModel; > > > > > using System.Windows.Forms.Design; > > > > > > > > > > [Designer(typeof(ParentControlDesigner))] > > > > > public class MyUserControl : System.Windows.Forms.UserControl > > > > > { > > > > > ... > > > > > } > > > > > > > > > > Alternatively, you could derive your control from another control > like > > > the > > > > > Panel control. > > > > > > > > > > -- > > > > > Tim Wilson > > > > > ..Net Compact Framework MVP > > > > > > > > > > > > > > >
It all seems to work fine for me, against the 1.1 and 2.0 (beta) framework. Maybe there's something in your project or source that is causing this. Can you post the complete source code for the MpeParameter and MpeGroupBox classes? -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message news:D8D5B0F5-AF48-46E2-9D93-6808AA504ED7@microsoft.com... > Well, my custom control was rebuilt, same problems. Do have I to override > some methods? I am sorry to bother you with that, but this is crucial for my > project. > > Thanks, > > Christophe. > > "Tim Wilson" wrote: > > > Have you rebuilt your custom UserControl to see if the changes are properly > > reflected in any instances that may be on a form, in the designer, that you > > may be using? Try a rebuild of the UserControl(s). > > > > -- > > Tim Wilson > > ..Net Compact Framework MVP > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > news:5FF681F0-9A41-4465-8C8C-3052099AEF3E@microsoft.com... > > > Tim, > > > > > > I followed your tips, but I still have the sames problems. To be more > > > accurate, my usercontrol inherits from an abstract class which is itself > > > derivated from usercontrol class. I added some properties to it, nothing > > much. > > > > > > UserControl --> MpeParameter (the abstract one) --> MpeGroupBox. I applied > > > the new designer on MpeGroupBox, because several other classes will be > > > derived from MpeParameter . > > > > > > I am using Visual Studio 2005 beta 2, could be a bug? > > > > > > Thanks, > > > > > > Monarghel. > > > > > > > > > "Tim Wilson" wrote: > > > > > > > You could change the designer for your custom UserControl. First add a > > > > reference to the System.Design.dll assembly and then set the designer as > > > > shown below. > > > > > > > > using System.ComponentModel; > > > > using System.Windows.Forms.Design; > > > > > > > > [Designer(typeof(ParentControlDesigner))] > > > > public class MyUserControl : System.Windows.Forms.UserControl > > > > { > > > > ... > > > > } > > > > > > > > Alternatively, you could derive your control from another control like > > the > > > > Panel control. > > > > > > > > -- > > > > Tim Wilson > > > > ..Net Compact Framework MVP > > > > > > > > >
Well, that is not that secret: So, the MpeParameter Class: using System; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; public delegate void MpeChangedEventHandler(object sender, EventArgs e); namespace Speedware.MpeControls { public abstract class MpeParameter : UserControl { public MpeParameter() { this.mpeIsOptional = true; this.mpeByValue = true; this.mpeGenerate = true; this.mpeInput = true; this.mpeFieldName = "WS-"; this.mpeValue = 0; this.mpeFieldType = MpeEnumFieldTypes.I16; this.mpeClass = this.GetType().Name; } public enum MpeEnumFieldTypes { CA, I16, U16, U32 } public enum MpeEnumBitsetTypes { MpeBitsetCheckBox, MpeBitsetUpDown, MpeBitsetComboBox } public event MpeChangedEventHandler MpeGenerateChanged; protected virtual void OnMpeGenerateChanged(EventArgs e) { if (MpeGenerateChanged != null) MpeGenerateChanged(this, e); } [Category("MPE")] public bool MpeGenerate { get { return this.mpeGenerate; } set { this.mpeGenerate = value; this.OnMpeGenerateChanged(EventArgs.Empty); } } [Category("MPE")] public virtual int MpeValue { get { return this.mpeValue; } set { this.mpeValue = value; } } [Category("MPE")] public bool MpeByValue { get { return this.mpeByValue; } set { this.mpeByValue = value; } } [Category("MPE")] public bool MpeIsOptional { get { return this.mpeIsOptional; } set { this.mpeIsOptional = value; } } [Category("MPE")] public string MpeFieldName { get { return this.mpeFieldName; } set { this.mpeFieldName = value; } } [Category("MPE")] public bool MpeInput { get { return this.mpeInput; } set { this.mpeInput = value; } } [Category("MPE")] public virtual MpeEnumFieldTypes MpeFieldType { get { return this.mpeFieldType; } set { this.mpeFieldType = value; } } private bool mpeIsOptional; private bool mpeByValue; private bool mpeGenerate; private bool mpeInput; private string mpeFieldName; private string mpeClass; private int mpeValue; protected MpeEnumFieldTypes mpeFieldType; private void InitializeComponent() { this.SuspendLayout(); // // MpeParameter // this.Name = "MpeParameter"; this.Size = new System.Drawing.Size(322, 258); this.ResumeLayout(false); } } } -------------------------------------------- And the MpeGroupBox, which is a GroupBox + a CheckBox: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Windows.Forms.Design; namespace Speedware.MpeControls { [Designer(typeof(ParentControlDesigner))] public partial class MpeGroupBox : MpeParameter { public MpeGroupBox() { InitializeComponent(); } ....... } } I am new in this kind of tools and languages, I am coming from MPE + COBOL environment, I guess my problem is trivial. Thanks, Christophe. [quoted text, click to view] "Tim Wilson" wrote: > The reason why I like keeping the discussion in the newsgroup is so that > anyone that is following this can continue to do so, and anyone in the > future that may "google" and get this thread can also have access to the > source. Is there a lot of content or is it private code? If there's not > thousands of lines of code then just cut and paste the source into the > message when you reply. But if you want to keep the source private then just > reply and let me know and we can take this offline. > > -- > Tim Wilson > ..Net Compact Framework MVP
The reason why I like keeping the discussion in the newsgroup is so that anyone that is following this can continue to do so, and anyone in the future that may "google" and get this thread can also have access to the source. Is there a lot of content or is it private code? If there's not thousands of lines of code then just cut and paste the source into the message when you reply. But if you want to keep the source private then just reply and let me know and we can take this offline. -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message news:53DC4277-3594-4B43-A0CB-C6557EC3AE82@microsoft.com... > I am trying to reach you, but I do not have any valid email address, and I am > not able to attach any file using the web interface. Could you send me an > address at ckamieniarz@hotmail.com? > > Thanks. > > "Tim Wilson" wrote: > > > It all seems to work fine for me, against the 1.1 and 2.0 (beta) framework. > > Maybe there's something in your project or source that is causing this. Can > > you post the complete source code for the MpeParameter and MpeGroupBox > > classes? > > > > -- > > Tim Wilson > > ..Net Compact Framework MVP > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > news:D8D5B0F5-AF48-46E2-9D93-6808AA504ED7@microsoft.com... > > > Well, my custom control was rebuilt, same problems. Do have I to override > > > some methods? I am sorry to bother you with that, but this is crucial for > > my > > > project. > > > > > > Thanks, > > > > > > Christophe. > > > > > > "Tim Wilson" wrote: > > > > > > > Have you rebuilt your custom UserControl to see if the changes are > > properly > > > > reflected in any instances that may be on a form, in the designer, that > > you > > > > may be using? Try a rebuild of the UserControl(s). > > > > > > > > -- > > > > Tim Wilson > > > > ..Net Compact Framework MVP > > > > > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > > > news:5FF681F0-9A41-4465-8C8C-3052099AEF3E@microsoft.com... > > > > > Tim, > > > > > > > > > > I followed your tips, but I still have the sames problems. To be more > > > > > accurate, my usercontrol inherits from an abstract class which is > > itself > > > > > derivated from usercontrol class. I added some properties to it, > > nothing > > > > much. > > > > > > > > > > UserControl --> MpeParameter (the abstract one) --> MpeGroupBox. I > > applied > > > > > the new designer on MpeGroupBox, because several other classes will be > > > > > derived from MpeParameter . > > > > > > > > > > I am using Visual Studio 2005 beta 2, could be a bug? > > > > > > > > > > Thanks, > > > > > > > > > > Monarghel. > > > > > > > > > > > > > > > "Tim Wilson" wrote: > > > > > > > > > > > You could change the designer for your custom UserControl. First add > > a > > > > > > reference to the System.Design.dll assembly and then set the > > designer as > > > > > > shown below. > > > > > > > > > > > > using System.ComponentModel; > > > > > > using System.Windows.Forms.Design; > > > > > > > > > > > > [Designer(typeof(ParentControlDesigner))] > > > > > > public class MyUserControl : System.Windows.Forms.UserControl > > > > > > { > > > > > > ... > > > > > > } > > > > > > > > > > > > Alternatively, you could derive your control from another control > > like > > > > the > > > > > > Panel control. > > > > > > > > > > > > -- > > > > > > Tim Wilson > > > > > > ..Net Compact Framework MVP > > > > > > > > > > > > > > > > > > > > > > >
I feel like being stupid, I can not reproduce yours steps. Could you send me your solution at ckamieniarz@hotmail.com? Thanks [quoted text, click to view] "Tim Wilson" wrote: > I added the code for the UserControl to a new project that is contained > within the same solution as the windows forms application project that is to > consume it. The steps that I followed are below... > > (1) Add a new "Windows Control Library" project to the solution that > contains the windows forms application. > (2) Cut and paste the "MpeParameter" code into the UserControl1.cs file, > then delete the associated UserControl1.Designer.cs file as it is not > necessary in this case. > (3) Add a new "User Control" to the "Windows Control Library" project that > was created earlier. Make the appropriate changes to the namespace and class > name in the UserControl2.Designer.cs file so that they line up with the > pasted code. > (4) Add a reference to the System.Design.dll to the "Windows Control > Library" project. > (5) Build the "Windows Control Library" project. > (6) Go to the windows forms applicaton project and display one of the forms > that requires the custom UserControl. > (7) In the ToolBox there should be a special section at the top that > contains the MpeGroupBox control. Drag and drop that control onto the form. > > The control instance should be able to act as a parent to other controls. > You can easily tell this, in the designer, by adding a control and moving it > slightly outside the visible area as the added control should be clipped. > > -- > Tim Wilson > ..Net Compact Framework MVP > >
Tim, The solution you sent me works as expected. So, it seems that the secret is to build the control in a separate control library, the purpose being to get rid of the <Control>.Designer.cs generated code. Thank you for your patience and for sharing your knowledge with lost-C#-beginner like me. You made my day :-) Christophe. [quoted text, click to view] "Tim Wilson" wrote: > Ok. I've sent the solution, zipped, to your hotmail account. Respond back to > this newsgroup thread and let me know how it goes. > > -- > Tim Wilson > ..Net Compact Framework MVP > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > news:46890700-2499-4CE9-BD67-40295AAB0A79@microsoft.com... > > I feel like being stupid, I can not reproduce yours steps. Could you send > me > > your solution at ckamieniarz@hotmail.com? > > > > Thanks > > > > "Tim Wilson" wrote: > > > > > I added the code for the UserControl to a new project that is contained > > > within the same solution as the windows forms application project that > is to > > > consume it. The steps that I followed are below... > > > > > > (1) Add a new "Windows Control Library" project to the solution that > > > contains the windows forms application. > > > (2) Cut and paste the "MpeParameter" code into the UserControl1.cs file, > > > then delete the associated UserControl1.Designer.cs file as it is not > > > necessary in this case. > > > (3) Add a new "User Control" to the "Windows Control Library" project > that > > > was created earlier. Make the appropriate changes to the namespace and > class > > > name in the UserControl2.Designer.cs file so that they line up with the > > > pasted code. > > > (4) Add a reference to the System.Design.dll to the "Windows Control > > > Library" project. > > > (5) Build the "Windows Control Library" project. > > > (6) Go to the windows forms applicaton project and display one of the > forms > > > that requires the custom UserControl. > > > (7) In the ToolBox there should be a special section at the top that > > > contains the MpeGroupBox control. Drag and drop that control onto the > form. > > > > > > The control instance should be able to act as a parent to other > controls. > > > You can easily tell this, in the designer, by adding a control and > moving it > > > slightly outside the visible area as the added control should be > clipped. > > > > > > -- > > > Tim Wilson > > > ..Net Compact Framework MVP > > > > > > > > > > >
I added the code for the UserControl to a new project that is contained within the same solution as the windows forms application project that is to consume it. The steps that I followed are below... (1) Add a new "Windows Control Library" project to the solution that contains the windows forms application. (2) Cut and paste the "MpeParameter" code into the UserControl1.cs file, then delete the associated UserControl1.Designer.cs file as it is not necessary in this case. (3) Add a new "User Control" to the "Windows Control Library" project that was created earlier. Make the appropriate changes to the namespace and class name in the UserControl2.Designer.cs file so that they line up with the pasted code. (4) Add a reference to the System.Design.dll to the "Windows Control Library" project. (5) Build the "Windows Control Library" project. (6) Go to the windows forms applicaton project and display one of the forms that requires the custom UserControl. (7) In the ToolBox there should be a special section at the top that contains the MpeGroupBox control. Drag and drop that control onto the form. The control instance should be able to act as a parent to other controls. You can easily tell this, in the designer, by adding a control and moving it slightly outside the visible area as the added control should be clipped. -- Tim Wilson ..Net Compact Framework MVP
Ok. I've sent the solution, zipped, to your hotmail account. Respond back to this newsgroup thread and let me know how it goes. -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message news:46890700-2499-4CE9-BD67-40295AAB0A79@microsoft.com... > I feel like being stupid, I can not reproduce yours steps. Could you send me > your solution at ckamieniarz@hotmail.com? > > Thanks > > "Tim Wilson" wrote: > > > I added the code for the UserControl to a new project that is contained > > within the same solution as the windows forms application project that is to > > consume it. The steps that I followed are below... > > > > (1) Add a new "Windows Control Library" project to the solution that > > contains the windows forms application. > > (2) Cut and paste the "MpeParameter" code into the UserControl1.cs file, > > then delete the associated UserControl1.Designer.cs file as it is not > > necessary in this case. > > (3) Add a new "User Control" to the "Windows Control Library" project that > > was created earlier. Make the appropriate changes to the namespace and class > > name in the UserControl2.Designer.cs file so that they line up with the > > pasted code. > > (4) Add a reference to the System.Design.dll to the "Windows Control > > Library" project. > > (5) Build the "Windows Control Library" project. > > (6) Go to the windows forms applicaton project and display one of the forms > > that requires the custom UserControl. > > (7) In the ToolBox there should be a special section at the top that > > contains the MpeGroupBox control. Drag and drop that control onto the form. > > > > The control instance should be able to act as a parent to other controls. > > You can easily tell this, in the designer, by adding a control and moving it > > slightly outside the visible area as the added control should be clipped. > > > > -- > > Tim Wilson > > ..Net Compact Framework MVP > > > > > >
You can probably keep the <Control>.Designer.cs file. The only reason that I said to remove it is because you had all the appropriate information in the class already. So, in relation to the abstract base class, there was no need for the designer-code-behind file. -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message news:5BE1DC28-8E2D-4B61-B48C-3CADFDDAE7CB@microsoft.com... > Tim, > > The solution you sent me works as expected. So, it seems that the secret is > to build the control in a separate control library, the purpose being to get > rid of the <Control>.Designer.cs generated code. > > Thank you for your patience and for sharing your knowledge with > lost-C#-beginner like me. > > You made my day :-) > > Christophe. > > > "Tim Wilson" wrote: > > > Ok. I've sent the solution, zipped, to your hotmail account. Respond back to > > this newsgroup thread and let me know how it goes. > > > > -- > > Tim Wilson > > ..Net Compact Framework MVP > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > news:46890700-2499-4CE9-BD67-40295AAB0A79@microsoft.com... > > > I feel like being stupid, I can not reproduce yours steps. Could you send > > me > > > your solution at ckamieniarz@hotmail.com? > > > > > > Thanks > > > > > > "Tim Wilson" wrote: > > > > > > > I added the code for the UserControl to a new project that is contained > > > > within the same solution as the windows forms application project that > > is to > > > > consume it. The steps that I followed are below... > > > > > > > > (1) Add a new "Windows Control Library" project to the solution that > > > > contains the windows forms application. > > > > (2) Cut and paste the "MpeParameter" code into the UserControl1.cs file, > > > > then delete the associated UserControl1.Designer.cs file as it is not > > > > necessary in this case. > > > > (3) Add a new "User Control" to the "Windows Control Library" project > > that > > > > was created earlier. Make the appropriate changes to the namespace and > > class > > > > name in the UserControl2.Designer.cs file so that they line up with the > > > > pasted code. > > > > (4) Add a reference to the System.Design.dll to the "Windows Control > > > > Library" project. > > > > (5) Build the "Windows Control Library" project. > > > > (6) Go to the windows forms applicaton project and display one of the > > forms > > > > that requires the custom UserControl. > > > > (7) In the ToolBox there should be a special section at the top that > > > > contains the MpeGroupBox control. Drag and drop that control onto the > > form. > > > > > > > > The control instance should be able to act as a parent to other > > controls. > > > > You can easily tell this, in the designer, by adding a control and > > moving it > > > > slightly outside the visible area as the added control should be > > clipped. > > > > > > > > -- > > > > Tim Wilson > > > > ..Net Compact Framework MVP > > > > > > > > > > > > > > > > > >
Could you please e-mail that zip file to sgl@core.com? I'm having the same problem :( I do not think this is a secret in any way since the original author had posted his code... Thank you. [quoted text, click to view] "Tim Wilson" wrote: > You can probably keep the <Control>.Designer.cs file. The only reason that I > said to remove it is because you had all the appropriate information in the > class already. So, in relation to the abstract base class, there was no need > for the designer-code-behind file. > > -- > Tim Wilson > ..Net Compact Framework MVP > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > news:5BE1DC28-8E2D-4B61-B48C-3CADFDDAE7CB@microsoft.com... > > Tim, > > > > The solution you sent me works as expected. So, it seems that the secret > is > > to build the control in a separate control library, the purpose being to > get > > rid of the <Control>.Designer.cs generated code. > > > > Thank you for your patience and for sharing your knowledge with > > lost-C#-beginner like me. > > > > You made my day :-) > > > > Christophe. > > > > > > "Tim Wilson" wrote: > > > > > Ok. I've sent the solution, zipped, to your hotmail account. Respond > back to > > > this newsgroup thread and let me know how it goes. > > > > > > -- > > > Tim Wilson > > > ..Net Compact Framework MVP > > > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > > news:46890700-2499-4CE9-BD67-40295AAB0A79@microsoft.com... > > > > I feel like being stupid, I can not reproduce yours steps. Could you > send > > > me > > > > your solution at ckamieniarz@hotmail.com? > > > > > > > > Thanks > > > > > > > > "Tim Wilson" wrote: > > > > > > > > > I added the code for the UserControl to a new project that is > contained > > > > > within the same solution as the windows forms application project > that > > > is to > > > > > consume it. The steps that I followed are below... > > > > > > > > > > (1) Add a new "Windows Control Library" project to the solution that > > > > > contains the windows forms application. > > > > > (2) Cut and paste the "MpeParameter" code into the UserControl1.cs > file, > > > > > then delete the associated UserControl1.Designer.cs file as it is > not > > > > > necessary in this case. > > > > > (3) Add a new "User Control" to the "Windows Control Library" > project > > > that > > > > > was created earlier. Make the appropriate changes to the namespace > and > > > class > > > > > name in the UserControl2.Designer.cs file so that they line up with > the > > > > > pasted code. > > > > > (4) Add a reference to the System.Design.dll to the "Windows Control > > > > > Library" project. > > > > > (5) Build the "Windows Control Library" project. > > > > > (6) Go to the windows forms applicaton project and display one of > the > > > forms > > > > > that requires the custom UserControl. > > > > > (7) In the ToolBox there should be a special section at the top that > > > > > contains the MpeGroupBox control. Drag and drop that control onto > the > > > form. > > > > > > > > > > The control instance should be able to act as a parent to other > > > controls. > > > > > You can easily tell this, in the designer, by adding a control and > > > moving it > > > > > slightly outside the visible area as the added control should be > > > clipped. > > > > > > > > > > -- > > > > > Tim Wilson > > > > > ..Net Compact Framework MVP > > > > > > > > > > > > > > > > > > > > > > > > > >
Ok. I've sent an example to your email account. Basically I built the example like this... (1) Create a new "Windows Application" project (this should also create a new solution). (2) Add a new "Windows Control Library" project to the solution. (3) Change properties, or add controls if necessary, for the new custom UserControl using the designer and add any code necessary to the "UserControl1.cs" file. (4) Right-click on the "WindowsControlLibrary1" project in the solution explorer and select "Build" on the context menu that appears. (5) Open the form, in designer mode, that was created with the "Windows Application" project. (6) Got to the ToolBox, navigate to the top, and you should see a "WindowsControlLibrary1 Components" section containing the custom UserControl. (7) Drag and drop the custom UserControl onto the form. -- Tim Wilson ..Net Compact Framework MVP [quoted text, click to view] "Eugene" <Eugene@discussions.microsoft.com> wrote in message news:6C0446DD-004F-481E-B3F9-20C81F0337CF@microsoft.com... > Could you please e-mail that zip file to sgl@core.com? > > I'm having the same problem :( > > I do not think this is a secret in any way since the original author had > posted his code... > > Thank you. > > "Tim Wilson" wrote: > > > You can probably keep the <Control>.Designer.cs file. The only reason that I > > said to remove it is because you had all the appropriate information in the > > class already. So, in relation to the abstract base class, there was no need > > for the designer-code-behind file. > > > > -- > > Tim Wilson > > ..Net Compact Framework MVP > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > news:5BE1DC28-8E2D-4B61-B48C-3CADFDDAE7CB@microsoft.com... > > > Tim, > > > > > > The solution you sent me works as expected. So, it seems that the secret > > is > > > to build the control in a separate control library, the purpose being to > > get > > > rid of the <Control>.Designer.cs generated code. > > > > > > Thank you for your patience and for sharing your knowledge with > > > lost-C#-beginner like me. > > > > > > You made my day :-) > > > > > > Christophe. > > > > > > > > > "Tim Wilson" wrote: > > > > > > > Ok. I've sent the solution, zipped, to your hotmail account. Respond > > back to > > > > this newsgroup thread and let me know how it goes. > > > > > > > > -- > > > > Tim Wilson > > > > ..Net Compact Framework MVP > > > > > > > > "Monarghel" <Monarghel@discussions.microsoft.com> wrote in message > > > > news:46890700-2499-4CE9-BD67-40295AAB0A79@microsoft.com... > > > > > I feel like being stupid, I can not reproduce yours steps. Could you > > send > > > > me > > > > > your solution at ckamieniarz@hotmail.com? > > > > > > > > > > Thanks > > > > > > > > > > "Tim Wilson" wrote: > > > > > > > > > > > I added the code for the UserControl to a new project that is > > contained > > > > > > within the same solution as the windows forms application project > > that > > > > is to > > > > > > consume it. The steps that I followed are below... > > > > > > > > > > > > (1) Add a new "Windows Control Library" project to the solution that > > > > > > contains the windows forms application. > > > > > > (2) Cut and paste the "MpeParameter" code into the UserControl1.cs > > file, > > > > > > then delete the associated UserControl1.Designer.cs file as it is > > not > > > > > > necessary in this case. > > > > > > (3) Add a new "User Control" to the "Windows Control Library" > > project > > > > that > > > > > > was created earlier. Make the appropriate changes to the namespace > > and > > > > class > > > > > > name in the UserControl2.Designer.cs file so that they line up with > > the > > > > > > pasted code. > > > > > > (4) Add a reference to the System.Design.dll to the "Windows Control > > > > > > Library" project. > > > > > > (5) Build the "Windows Control Library" project. > > > > > > (6) Go to the windows forms applicaton project and display one of > > the > > > > forms > > > > > > that requires the custom UserControl. > > > > > > (7) In the ToolBox there should be a special section at the top that > > > > > > contains the MpeGroupBox control. Drag and drop that control onto > > the > > > > form. > > > > > > > > > > > > The control instance should be able to act as a parent to other > > > > controls. > > > > > > You can easily tell this, in the designer, by adding a control and > > > > moving it > > > > > > slightly outside the visible area as the added control should be > > > > clipped. > > > > > > > > > > > > -- > > > > > > Tim Wilson > > > > > > ..Net Compact Framework MVP > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Don't see what you're looking for? Try a search.
|
|
|