예제 #1
0
        public SchetsWin()
        {
            InitializeComponent();
            ISchetsTool[] mTools = { new PenTool()
                                     ,                   new LijnTool()
                                     ,                   new RechthoekTool()
                                     ,                   new VolRechthoekTool()
                                     ,                   new EllipseTool()
                                     ,                   new FillEllipse()
                                     ,                   new TekstTool()
                                     ,                   new GumTool(),
                                     new MoveUpTool(),
                                     new MoveDownTool(),
                                     new DragTool() };

            this.ClientSize = new Size(800, 625);
            currentTool     = mTools[0];

            schetsControl            = new SchetsControl();
            schetsControl.Location   = new Point(64 + 10, 10);
            schetsControl.MouseDown +=
                (o, mea) =>
            {
                vast = true;
                currentTool.MouseDown(schetsControl, mea.Location);
            };
            schetsControl.MouseMove +=
                (o, mea) =>
            {
                if (vast)
                {
                    currentTool.MouseDrag(schetsControl, mea.Location);
                }
            };
            schetsControl.MouseUp +=
                (o, mea) =>
            {
                if (vast)
                {
                    currentTool.MouseUp(schetsControl, mea.Location);
                }
                vast = false;
            };
            schetsControl.KeyPress +=
                (o, kpea) =>
            {
                currentTool.Letter(schetsControl, kpea.KeyChar);
            };
            this.Controls.Add(schetsControl);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.makeFileMenu();
            this.makeToolMenu(mTools);
            this.makeActionMenu();
            this.makeToolButtons(mTools);
            this.makeActionButtons();
            this.Resize += this.sizeChange;
            this.sizeChange(null, null);
            FormClosing += SchetsWin_FormClosing;
            schetsControl.Schets.AcknowledgeChanges();
        }