Exemple #1
0
        /// <summary>
        /// Sticky의 위치를 전환한다.
        /// </summary>
        /// <param name="paper">The paper.</param>
        /// <param name="defualtSticky">if set to <c>true</c> [defualt sticky].</param>
        public void ChangeSticky(Paper paper, bool defualtSticky = false)
        {
            //Sticky 결정
            Sticky sticky = this.CurrentSticky;

            if (defualtSticky)
            {
                switch (paper)
                {
                case Paper.p80x80:
                case Paper.p56x80:
                case Paper.p104x80:
                    sticky = Sticky.Top;

                    break;

                case Paper.p80x104:
                case Paper.p80x56:
                    sticky = Sticky.Left;
                    break;
                }
            }
            else
            {
                sticky = (Sticky)(((int)sticky + 1) % Enum.GetNames(typeof(Sticky)).Length);

                while (!StickyCtrl.IsAllowSticky(paper, sticky))
                {
                    sticky = (Sticky)(((int)sticky + 1) % Enum.GetNames(typeof(Sticky)).Length);
                }
            }
            //Sticky 반영
            this.ChangeSticky(paper, sticky);
        }
        public LayersCtrl()
        {
            InitializeComponent();

            // Enable double duffering to stop flickering.

            /*
             * this.SetStyle(ControlStyles.DoubleBuffer, true);
             * this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
             * this.SetStyle(ControlStyles.UserPaint, true);
             * this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
             * this.SetStyle(ControlStyles.Opaque, false);
             * this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
             * this.SetStyle(ControlStyles.ResizeRedraw, true);
             */
            this.isTransparent = false;
            this.CtrlList      = new LinkedList <Control>();

            this.Controls.Add(this.Layer_Template);
            this.Controls.SetChildIndex(this.Layer_Template, 3);
            CtrlList.AddLast(this.Layer_Template);
            this.Layer_Template.SizeMode = PictureBoxSizeMode.StretchImage;

            this.Controls.Add(this.Layer_Sticky);
            this.Controls.SetChildIndex(this.Layer_Sticky, 2);
            CtrlList.AddLast(this.Layer_Sticky);

            this.Controls.Add(this.Layer_TextField);
            this.Controls.SetChildIndex(this.Layer_TextField, 1);
            CtrlList.AddLast(this.Layer_TextField);

            this.Controls.Add(this.Layer_Screenshot);
            this.Controls.SetChildIndex(this.Layer_Screenshot, 0);
            CtrlList.AddLast(this.Layer_Screenshot);

            ControlManager.ControlMoverOrResizer.WorkType = ControlManager.ControlMoverOrResizer.MoveOrResize.MoveAndResize;

            this.Layer_Sticky.ChangeSticky(Paper.p80x80, Sticky.Top);

            this.ActiveControl = this.Layer_TextField;
            this.Layer_TextField.SelectionStart = this.Layer_TextField.Text.Length;
            this.Layer_TextField.Focus();

            this.StickyCtrl = this.Layer_Sticky;
        }