Пример #1
0
        protected override void Initialize(DisplayWindowConfiguration conf)
        {
            base.Initialize(conf);

            // Initialize a TextFormat
            TextFormat = new TextFormat(FactoryDWrite, "Calibri", 20)
            {
                TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Center
            };

            RenderTarget2D.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Cleartype;
            TextLayout = new TextLayout(FactoryDWrite, _mousePosition.GetMouseCoordinates(), TextFormat, conf.Width, conf.Height);


            _guiManager.AddButton(10, 80, 200, 50, "White Color", () =>
            {
                _currentLineColor = Color.White;
            }
                                  );
            _guiManager.AddButton(10, 140, 200, 50, "Red Color", () =>
            {
                _currentLineColor = Color.Red;
            }
                                  );
            _guiManager.AddButton(10, 200, 200, 50, "Lines", () =>
            {
                _currentDrawMode = DrawMode.Lines;
            }
                                  );
            _guiManager.AddButton(10, 260, 200, 50, "Rectangles", () =>
            {
                _currentDrawMode = DrawMode.Rectangles;
            }
                                  );
            _guiManager.AddButton(10, 320, 200, 50, "Clear", () =>
            {
                _drawings.Clear();
            }
                                  );
            _guiManager.AddCheckbox(10, 380, 200, 25, "Fill rectangle", () =>
            {
                _fillRect = !_fillRect;
            }
                                    );
        }