Esempio n. 1
0
 private void UpdateDrawState()
 {
     if (_compassBtn.IsMouseUp)
     {
         _construct.ChangeState(DrawState.CIRCLE);
     }
     if (_segmentBtn.IsMouseUp)
     {
         _construct.ChangeState(DrawState.SEGMENT);
     }
     if (_lineBtn.IsMouseUp)
     {
         _construct.ChangeState(DrawState.LINE);
     }
     if (_dotBtn.IsMouseUp)
     {
         _construct.ChangeState(DrawState.DOT);
     }
     if (_vectorBtn.IsMouseUp)
     {
         _construct.ChangeState(DrawState.VECTOR);
     }
     if (_clearBtn.IsMouseUp)
     {
         _construct.Clear();
     }
     if (_deleteBtn.IsMouseUp)
     {
         _construct.DeleteSelected();
     }
     if (_undoBtn.IsMouseUp)
     {
         _construct.Undo();
     }
 }
Esempio n. 2
0
        private void InitGUI()
        {
            shapeStrip = new MenuStrip()
            {
                BackColor = System.Drawing.Color.White,
                Dock      = DockStyle.Left
            };

            AddStripItem(shapeStrip, Icon.circle).Click  += (b, d) => _construct.ChangeState(DrawState.CIRCLE);
            AddStripItem(shapeStrip, Icon.ellipse).Click += (b, d) => _construct.ChangeState(DrawState.ELLIPSE);
            AddStripItem(shapeStrip, Icon.segment).Click += (b, d) => _construct.ChangeState(DrawState.SEGMENT);
            AddStripItem(shapeStrip, Icon.line).Click    += (b, d) => _construct.ChangeState(DrawState.LINE);
            AddStripItem(shapeStrip, Icon.vector).Click  += (b, d) => _construct.ChangeState(DrawState.VECTOR);
            AddStripItem(shapeStrip, Icon.dot).Click     += (b, d) => _construct.ChangeState(DrawState.DOT);

            VScrollBar vscroll = new VScrollBar();

            vscroll.Dock = DockStyle.Right;
            HScrollBar hscroll = new HScrollBar();

            hscroll.Dock = DockStyle.Bottom;

            var construct = GameObject.Find("construct");

            var move = construct.AddComponent <MoveConstructComponent>();

            move.Comp    = construct.GetComponent <ConstructComponent>();
            move.Hscroll = hscroll;
            move.Vscroll = vscroll;

            menu = new MenuStrip()
            {
                BackColor = System.Drawing.Color.White
            };

            var con = new ToolStripMenuItem("작도(&C)");

            con.DropDownItems.Add("평행선(&E)");
            con.DropDownItems.Add("수선(&P)");
            con.DropDownItems.Add("접선(&T)");
            con.DropDownItems.Add("대칭이동(&R)");
            con.DropDownItems.Add("타원(&L)");
            con.DropDownItems[0].Click += (s, e) => _construct.SelectConstruct(ConstructType.ParallelLine);
            con.DropDownItems[1].Click += (s, e) => _construct.SelectConstruct(ConstructType.PerpendicularLine);
            con.DropDownItems[2].Click += (s, e) => _construct.SelectConstruct(ConstructType.Tangent);
            con.DropDownItems[3].Click += (s, e) => _construct.SelectConstruct(ConstructType.Reflection);
            con.DropDownItems[4].Click += (s, e) => _construct.SelectConstruct(ConstructType.Ellipse);
            menu.Items.Add(con);

            var control = Control.FromHandle(Window.Handle);

            control.Controls.Add(shapeStrip);
            control.Controls.Add(menu);
            control.Controls.Add(vscroll);
            control.Controls.Add(hscroll);
        }