Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to subclass control?
Message
From
21/04/2008 10:05:51
 
 
To
21/04/2008 01:09:32
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01184867
Message ID:
01312064
Views:
25
In that post, you said you can't do it visually, but I noticed that if I choose "Component Class" when adding a new item to my project, I get a deisnger surface that I can drag a base class onto, then I seem to be off and running visually.

I get custom code in the Component.cs file, and generated code in the Component.Designer.cs that seems to handle all my defaults that I set in the properties window. This is certainly more appealing to me (the properties window).

If this is not the purpose of a Component Class template, please help me understand what it it.


Here is the code-behind of the Component.cs file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace lmforms
{
    public partial class Component2 : Component
    {
        public Component2()
        {
            InitializeComponent();
        }

        public Component2(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }
    }
}
And here is the genereted code in the Component.Designer.cs file:
namespace lmforms
{
    partial class Component2
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.mmTextBox1 = new OakLeaf.MM.Main.Windows.Forms.mmTextBox();
            // 
            // mmTextBox1
            // 
            this.mmTextBox1.BindingSourceMember = null;
            this.mmTextBox1.ControlID = new System.Guid("00000000-0000-0000-0000-000000000000");
            this.mmTextBox1.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.mmTextBox1.ForeColor = System.Drawing.Color.Red;
            this.mmTextBox1.Location = new System.Drawing.Point(0, 0);
            this.mmTextBox1.Name = "mmTextBox1";
            this.mmTextBox1.Size = new System.Drawing.Size(100, 22);
            this.mmTextBox1.TabIndex = 0;

        }

        #endregion

        private OakLeaf.MM.Main.Windows.Forms.mmTextBox mmTextBox1;
    }
}
>>Can you also go and read my thread# 1311814?
>
>I already have ... John pointed you to another post of mine with the same suggestions I would make all over again. Did that not help?
>
>~~Bonnie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform