コード例 #1
0
ファイル: MainWindow.cs プロジェクト: mathovonic96/KPL
        private void SetTool()
        {
            //
            // Toolbar
            //
            ToolBar = new Toolbar();
            ToolBar.SetActiveCanvas(DrawingCanvas);
            ToolBar.AddSeparator();
            ToolBar.ItemClicked += new ToolStripItemClickedEventHandler(Toolbar_ItemClicked);

            OutlineColorChooser OColorChooser = new OutlineColorChooser();

            ToolBar.AddTool(OColorChooser);
            ToolBar.AddSeparator();

            FillColorChooser IColorChooser = new FillColorChooser();

            ToolBar.AddTool(IColorChooser);
            ToolBar.AddSeparator();

            this.Controls.Add(ToolBar);
            //
            // Toolbox
            //
            ToolBox = new Toolbox();
            ToolBox.SetActiveCanvas(DrawingCanvas);

            LineTool LineToolStrip = new LineTool();

            LineToolStrip.Click += new EventHandler(Toolbox_ItemClicked);
            LineToolStrip.SubscribeLine(OColorChooser);
            ToolBox.AddTool(LineToolStrip);

            EllipseTool EllipseToolStrip = new EllipseTool();

            EllipseToolStrip.Click += new EventHandler(Toolbox_ItemClicked);
            EllipseToolStrip.SubscribeFill(IColorChooser);
            EllipseToolStrip.SubscribeLine(OColorChooser);
            ToolBox.AddTool(EllipseToolStrip);

            RectangleTool RectangleToolStrip = new RectangleTool();

            RectangleToolStrip.Click += new EventHandler(Toolbox_ItemClicked);
            RectangleToolStrip.SubscribeFill(IColorChooser);
            RectangleToolStrip.SubscribeLine(OColorChooser);
            ToolBox.AddTool(RectangleToolStrip);
            ToolBox.AddSeparator();

            SelectionTool SelectionToolStrip = new SelectionTool();

            SelectionToolStrip.Click += new EventHandler(Toolbox_ItemClicked);
            ToolBox.AddTool(SelectionToolStrip);
            ToolBox.AddSeparator();

            LineFillTool LineFillToolStrip = new LineFillTool();

            LineFillToolStrip.Click += new EventHandler(Toolbox_ItemClicked);
            LineFillToolStrip.SubscribeLine(OColorChooser);
            ToolBox.AddTool(LineFillToolStrip);

            FillTool FillToolStrip = new FillTool();

            FillToolStrip.Click += new EventHandler(Toolbox_ItemClicked);
            FillToolStrip.SubscribeFill(IColorChooser);
            ToolBox.AddTool(FillToolStrip);

            this.Controls.Add(ToolBox);
        }