첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ SampleControlDesigner.cs

using System.ComponentModel;
using System.Windows.Forms.Design;

namespace TestProject
{
    /// <summary>
    /// 샘플 컨트롤 디자이너
    /// </summary>
    public class SampleControlDesigner : ParentControlDesigner
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 초기화 하기 - Initialize(component)

        /// <summary>
        /// 초기화 하기
        /// </summary>
        /// <param name="component">컴포넌트</param>
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            SampleControl sampleControl = component as SampleControl;

            if(sampleControl != null)
            {
                base.EnableDesignMode(sampleControl.RootPanel, "RootPanel");
            }
        }

        #endregion
    }
}

 

▶ SampleControl.cs

using System.ComponentModel;
using System.Windows.Forms;

namespace TestProject
{
    /// <summary>
    /// 샘플 컨트롤
    /// </summary>
    [Designer(typeof(SampleControlDesigner))]
    public partial class SampleControl : UserControl
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region Field

        [Category("SampleControl"),Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public Panel RootPanel => this.rootPanel;

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - SampleControl()

        /// <summary>
        /// 생성자
        /// </summary>
        public SampleControl()
        {
            InitializeComponent();
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요