예제 #1
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
                foreach (var pair in _images)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["black"]      = gfx.CreateSolidBrush(0, 0, 0);
            _brushes["white"]      = gfx.CreateSolidBrush(255, 255, 255);
            _brushes["red"]        = gfx.CreateSolidBrush(255, 0, 0);
            _brushes["green"]      = gfx.CreateSolidBrush(0, 255, 0);
            _brushes["blue"]       = gfx.CreateSolidBrush(0, 0, 255);
            _brushes["background"] = gfx.CreateSolidBrush(0x00, 0x00, 0x00, 0x00);

            if (e.RecreateResources)
            {
                return;
            }

            _fonts["consolas"] = gfx.CreateFont("Consolas", FONT_SIZE);
        }
예제 #2
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
                foreach (var pair in _images)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["black"]      = gfx.CreateSolidBrush(0, 0, 0);
            _brushes["white"]      = gfx.CreateSolidBrush(255, 255, 255);
            _brushes["red"]        = gfx.CreateSolidBrush(255, 0, 0);
            _brushes["green"]      = gfx.CreateSolidBrush(0, 255, 0);
            _brushes["blue"]       = gfx.CreateSolidBrush(0, 0, 255);
            _brushes["background"] = gfx.CreateSolidBrush(0x33, 0x36, 0x3F);
            _brushes["yellow"]     = gfx.CreateSolidBrush(255, 255, 0);
            _brushes["random"]     = gfx.CreateSolidBrush(0, 0, 0);

            if (e.RecreateResources)
            {
                return;
            }

            _fonts["arial"]    = gfx.CreateFont("Arial", 12);
            _fonts["consolas"] = gfx.CreateFont("Consolas", 14);
            _fonts["calibri"]  = gfx.CreateFont("Calibri", 14);
        }
예제 #3
0
    private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
    {
        var gfx = e.Graphics;

        if (e.RecreateResources)
        {
            foreach (var pair in _brushes)
            {
                pair.Value.Dispose();
            }
        }

        _brushes["black"]    = gfx.CreateSolidBrush(0, 0, 0);
        _brushes["white"]    = gfx.CreateSolidBrush(255, 255, 255);
        _brushes["red"]      = gfx.CreateSolidBrush(255, 0, 98);
        _brushes["green"]    = gfx.CreateSolidBrush(0, 128, 0);
        _brushes["blue"]     = gfx.CreateSolidBrush(30, 144, 255);
        _brushes["bgcolor"]  = gfx.CreateSolidBrush(11, 11, 11, 150);
        _brushes["grid"]     = gfx.CreateSolidBrush(255, 255, 255, 0.2f);
        _brushes["deepPink"] = gfx.CreateSolidBrush(247, 63, 147, 255);

        _brushes["transparency"] = gfx.CreateSolidBrush(0, 0, 0, 0);

        if (e.RecreateResources)
        {
            return;
        }

        _fonts["Microsoft YaHei"] = gfx.CreateFont("Microsoft YaHei", 12);
    }
예제 #4
0
파일: Overlay.cs 프로젝트: GarfID/EmoPad
        private void Window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            _font     = gfx.CreateFont("Century Gothic", 16);
            _white    = gfx.CreateSolidBrush(new Color(255, 255, 255));
            _backGray = gfx.CreateSolidBrush(new Color(74, 74, 74, 170));
        }
예제 #5
0
        private static void window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            redBrush         = gfx.CreateSolidBrush(255, 0, 0);
            transparentBrush = gfx.CreateSolidBrush(0, 0, 0, 0.5f);
            consolasFont     = gfx.CreateFont("Consolas", 14);
        }
예제 #6
0
        private void OnSetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            m_ControllerNotFoundImage = m_Graphics.CreateImage(@"Content\ControllerNotFound.png");

            m_DefaultFont = m_Graphics.CreateFont("Consolas", 14);

            m_Brushes.Green = m_Graphics.CreateSolidBrush(Color.Green);
            m_Brushes.Black = m_Graphics.CreateSolidBrush(new Color(0, 0, 0));
        }
예제 #7
0
        private void Window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            _font = e.Graphics.CreateFont("Arial", 16);

            _redBrush    = e.Graphics.CreateSolidBrush(Color.Red);
            _grayBrush   = e.Graphics.CreateSolidBrush(192, 192, 192);
            _yellowBrush = e.Graphics.CreateSolidBrush(255, 255, 102);
            _whiteBrush  = e.Graphics.CreateSolidBrush(255, 255, 255);
        }
예제 #8
0
파일: Overlays.cs 프로젝트: Foopy969/calc2
        private void Window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var Graphic = e.Graphics;

            Window.FitTo(Memory.m_iProcess.MainWindowHandle);
            Brushes["enemy"]    = Graphic.CreateSolidBrush(255, 128, 128, 0.7f);
            Brushes["teammate"] = Graphic.CreateSolidBrush(128, 255, 128, 0.7f);

            font = Graphic.CreateFont("Arial", 64);

            Window.FitTo(Memory.m_iProcess.MainWindowHandle);
        }
        internal override void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            while (!Loaded)
            {
                Thread.Sleep(1);
            }

            OnGraphicsSetup?.Invoke(sender, e);

            Window.Hide();

            _graphicLoaded = true;
        }
예제 #10
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            _brushes["black"]      = gfx.CreateSolidBrush(0, 0, 0);
            _brushes["white"]      = gfx.CreateSolidBrush(255, 255, 255);
            _brushes["background"] = gfx.CreateSolidBrush(0, 0x27, 0x31, 255.0f * 0.8f);

            // fonts don't need to be recreated since they are owned by the font factory and not the drawing device
            if (e.RecreateResources)
            {
                return;
            }

            _fonts.Add("arial", gfx.CreateFont("Arial", 14));
        }
예제 #11
0
        private void FlatSDK_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            gfx.TextAntiAliasing = true;

            loadColorsFromFile(gfx);

            Console.Write("Creating Timer \n");
            timerEntityItemsLoader           = new System.Timers.Timer(1000);
            timerEntityItemsLoader.Elapsed  += loadEntities;
            timerEntityItemsLoader.AutoReset = true;
            timerEntityItemsLoader.Enabled   = true;
            timerEntityItemsLoader.Stop();
            timerEntityItemsLoader.Start();
        }
예제 #12
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            // creates a simple font with no additional style
            _font = gfx.CreateFont("Arial", 16);

            // colors for brushes will be automatically normalized. 0.0f - 1.0f and 0.0f - 255.0f is accepted!

            _black       = gfx.CreateSolidBrush(0, 0, 0);
            _transparent = gfx.CreateSolidBrush(Color.Transparent);

            _red   = gfx.CreateSolidBrush(Color.Red); // those are the only pre defined Colors
            _green = gfx.CreateSolidBrush(Color.Green);
            _blue  = gfx.CreateSolidBrush(Color.Blue);
        }
예제 #13
0
        private void SetupWindowGraphics(object sender, SetupGraphicsEventArgs e)
        {
            Graphics gfx = e.Graphics;

            this.brushes["green"]   = gfx.CreateSolidBrush(0, 255, 0);
            this.brushes["magenta"] = gfx.CreateSolidBrush(255, 0, 255);
            this.brushes["white"]   = gfx.CreateSolidBrush(255, 255, 255);
            this.brushes["black"]   = gfx.CreateSolidBrush(0, 0, 0);

            if (e.RecreateResources)
            {
                return;
            }

            this.fonts["arial"] = gfx.CreateFont("Arial", 12);
        }
예제 #14
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            // creates a simple font with no additional style
            _font = gfx.CreateFont("Arial", 16);

            // colors for brushes will be automatically normalized. 0.0f - 1.0f and 0.0f - 255.0f is accepted!
            _black = gfx.CreateSolidBrush(0, 0, 0);
            _gray  = gfx.CreateSolidBrush(0x24, 0x29, 0x2E);

            _red   = gfx.CreateSolidBrush(Color.Red); // those are the only pre defined Colors
            _green = gfx.CreateSolidBrush(Color.Green);
            _blue  = gfx.CreateSolidBrush(Color.Blue);

            _image = gfx.CreateImage(Resources.image); // loads the image using our image.bytes file in our resources
        }
예제 #15
0
        private void Window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["透明"] = gfx.CreateSolidBrush(0, 0, 0, 0);
            _brushes["黑色"] = gfx.CreateSolidBrush(0, 0, 0, Alpha);
            _brushes["白色"] = gfx.CreateSolidBrush(255, 255, 255, Alpha);
            _brushes["蓝色"] = gfx.CreateSolidBrush(0, 0, 100, 255);
            _fonts["微软雅黑"] = gfx.CreateFont("微软雅黑", FontSize);
            _images["二维码"] = gfx.CreateImage(Path.Combine(Application.StartupPath, "qrcode.png"));
        }
예제 #16
0
        private void OnSetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            if (e.RecreateResources)
            {
                defaultFont?.Dispose();
                defaultFont = null;

                foreach (var kv in brushes)
                {
                    kv.Value.Dispose();
                }

                brushes.Clear();
            }

            var gfx = e.Graphics;

            defaultFont = gfx.CreateFont("Microsoft Sans Serif", 18, true, false, false);
        }
예제 #17
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["black"]      = gfx.CreateSolidBrush(0, 0, 0);
            _brushes["background"] = gfx.CreateSolidBrush(0x33, 0x36, 0x3F);

            if (e.RecreateResources)
            {
                return;
            }
        }
예제 #18
0
파일: SHubMain.cs 프로젝트: LixYt/StreamHub
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
                foreach (var pair in _images)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["black"]      = gfx.CreateSolidBrush(0, 0, 0);
            _brushes["white"]      = gfx.CreateSolidBrush(255, 255, 255);
            _brushes["red"]        = gfx.CreateSolidBrush(255, 0, 0);
            _brushes["green"]      = gfx.CreateSolidBrush(0, 255, 0);
            _brushes["blue"]       = gfx.CreateSolidBrush(0, 0, 255);
            _brushes["lightBlue"]  = gfx.CreateSolidBrush(0, 255, 255);
            _brushes["background"] = gfx.CreateSolidBrush(0, 0, 0, 0);
            _brushes["grid"]       = gfx.CreateSolidBrush(255, 255, 255, 0.2f);
            _brushes["random"]     = gfx.CreateSolidBrush(0, 0, 0);

            if (e.RecreateResources)
            {
                return;
            }

            SetOverlayFonts();

            //_gridBounds = new Rectangle(20, 60, gfx.Width - 20, gfx.Height - 20);
            _gridGeometry = gfx.CreateGeometry();

            _gridGeometry.Close();
        }
예제 #19
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            // creates a simple font with no additional style
            _font = gfx.CreateFont("Arial", 16);

            // colors for brushes will be automatically normalized. 0.0f - 1.0f and 0.0f - 255.0f is accepted!
            _black = gfx.CreateSolidBrush(0, 0, 0);

            _FRBlue   = gfx.CreateSolidBrush(153, 218, 240);
            _IOPink   = gfx.CreateSolidBrush(195, 110, 139);
            _NXRed    = gfx.CreateSolidBrush(149, 54, 50);
            _DEYellow = gfx.CreateSolidBrush(218, 207, 161);
            _SICyan   = gfx.CreateSolidBrush(17, 117, 79);
            _PZOrange = gfx.CreateSolidBrush(252, 154, 105);

            _red   = gfx.CreateSolidBrush(Color.Red); // those are the only pre defined Colors
            _green = gfx.CreateSolidBrush(Color.Green);
            _blue  = gfx.CreateSolidBrush(Color.Blue);

            //_image = gfx.CreateImage(Resources.logo); // loads the image using our image.bytes file in our resources
        }
예제 #20
0
        private void Window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            red = gfx.CreateSolidBrush(255, 0, 0, overlayAlpha);
        }
예제 #21
0
 private void FlatSDK_SetupGraphics(object sender, SetupGraphicsEventArgs e)
 {
     var gfx = e.Graphics;
 }
예제 #22
0
파일: Overlay.cs 프로젝트: stubobis1/prank
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            Setup(gfx);
        }
예제 #23
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var g = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
                foreach (var pair in _images)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["black"]      = g.CreateSolidBrush(0, 0, 0);
            _brushes["white"]      = g.CreateSolidBrush(255, 255, 255);
            _brushes["red"]        = g.CreateSolidBrush(255, 0, 0);
            _brushes["green"]      = g.CreateSolidBrush(0, 255, 0);
            _brushes["blue"]       = g.CreateSolidBrush(0, 0, 255);
            _brushes["background"] = g.CreateSolidBrush(0x33, 0x36, 0x3F);
            _brushes["grid"]       = g.CreateSolidBrush(255, 255, 255, 0.2f);

            _brushes["transparent"] = g.CreateSolidBrush(0, 0, 0, 0);

            if (e.RecreateResources)
            {
                return;
            }

            _fonts["arial"]    = g.CreateFont("Arial", 12);
            _fonts["consolas"] = g.CreateFont("Consolas", 14);

            //gridBounds = new Rectangle(20, 60, g.Width - 20, g.Height - 20);
            screenWidth  = gridBounds.Width;
            screenHeight = gridBounds.Height;
            int numGridColumns = (int)Math.Ceiling(screenWidth / cellWidth);
            int numGridRows    = (int)Math.Ceiling(screenHeight / cellHeight);

            numberPositionsX = new Point[numGridColumns * numGridRows];
            numberPositionsY = new Point[numGridColumns * numGridRows];
            numberColorsX    = new SolidBrush[numGridColumns * numGridRows];
            numberColorsY    = new SolidBrush[numGridColumns * numGridRows];
            labelsX          = new String[numGridColumns * numGridRows];
            labelsY          = new String[numGridColumns * numGridRows];


            gridNumberFont = g.CreateFont(FontFamilyName, FontSize);

            int rc = 50;
            int gc = 255;
            int bc = 50;
            int rd = 0;
            int gd = 0;
            int bd = 0;

            lineBrush          = g.CreateSolidBrush(rc, gc, bc, StrokeOpacity);
            secondaryLineBrush = g.CreateSolidBrush(rc, gc, bc, SecondaryStrokeOpacity);
            textXBrush         = g.CreateSolidBrush(rc, gc, bc, TextOpacity);
            textYBrush         = g.CreateSolidBrush(gc, rc, gc, TextOpacity);
            textXBrushShadow   = g.CreateSolidBrush(128, 128, 128, TextOpacity2);
            textYBrushShadow   = g.CreateSolidBrush(128, 128, 128, TextOpacity2);
            textCommaBrush     = g.CreateSolidBrush(rc, gc, bc, TextOpacity2);
            backgroundBrush    = g.CreateSolidBrush(1, 1, 1, BackgroundOpacity);

            bigGridGeometry = g.CreateGeometry();
            for (int x = 0; x < numGridColumns; x++)
            {
                float startX = x * cellWidth;
                float startY = 0;
                float endX   = startX;
                float endY   = screenHeight;
                bigGridGeometry.BeginFigure(new Point(startX, startY));
                bigGridGeometry.AddPoint(new Point(endX, endY));
                bigGridGeometry.EndFigure(false);
            }

            for (int y = 0; y < numGridRows; y++)
            {
                float startX = 0;
                float startY = y * cellHeight;
                float endX   = screenWidth;
                float endY   = startY;
                bigGridGeometry.BeginFigure(new Point(startX, startY));
                bigGridGeometry.AddPoint(new Point(endX, endY));
                bigGridGeometry.EndFigure(false);
            }
            bigGridGeometry.Close();

            smallGridGeometry = g.CreateGeometry();
            float digitWidth  = FontSize * 4 / 7f;
            float digitHeight = FontSize;
            float offsetY     = -digitHeight / 2f;

            for (int x = 0; x < numGridColumns; x++)
            {
                for (int y = 0; y < numGridRows; y++)
                {
                    int gridNumber = (y * numGridColumns) + x;
                    labelsX[gridNumber] = "⮞" + (x.ToString());
                    labelsY[gridNumber] = "⮟" + y.ToString();
                    float numberOfDigitsX = labelsX[gridNumber].Length;
                    float numberOfDigitsY = labelsY[gridNumber].Length;
                    float offsetX_X       = -digitWidth * numberOfDigitsX / 2f;
                    float offsetX_Y       = -digitWidth * numberOfDigitsY / 2f;
                    float positionX_X     = x * cellWidth + cellWidth / 2f + offsetX_X;
                    float positionX_Y     = x * cellWidth + cellWidth / 2f + offsetX_Y;
                    float positionY_X     = y * cellHeight + cellHeight / 2f - digitHeight;
                    float positionY_Y     = y * cellHeight + cellHeight / 2f;

                    numberColorsX[gridNumber]    = x % 2 == 0 ? textXBrush : textXBrushShadow;
                    numberColorsY[gridNumber]    = y % 2 == 0 ? textYBrush : textYBrushShadow;
                    numberPositionsX[gridNumber] = new Point(positionX_X, positionY_X);
                    numberPositionsY[gridNumber] = new Point(positionX_Y, positionY_Y);

                    for (int i = 1; i < GridSize; i++)
                    {
                        float startX = x * cellWidth + i * cellWidth / GridSize;
                        float startY = y * cellHeight;
                        float endX   = startX;
                        float endY   = startY + cellHeight;
                        smallGridGeometry.BeginFigure(new Point(startX, startY));
                        smallGridGeometry.AddPoint(new Point(endX, endY));
                        smallGridGeometry.EndFigure();
                    }

                    for (int j = 1; j < GridSize; j++)
                    {
                        float startX = x * cellWidth;
                        float startY = y * cellHeight + j * cellHeight / GridSize;
                        float endX   = startX + cellWidth;
                        float endY   = startY;
                        smallGridGeometry.BeginFigure(new Point(startX, startY));
                        smallGridGeometry.AddPoint(new Point(endX, endY));
                        smallGridGeometry.EndFigure();
                    }
                }
            }
            smallGridGeometry.Close();
        }
예제 #24
0
        private static void Overlay_OnGraphicsSetup(object sender, SetupGraphicsEventArgs e)
        {
            //textbox = new DxTextBox("2", "qwertyuiop[]asdfghjkl;'zxcvbnm,./1234567890") { Margin = new Thickness(650, 10, 0, 0), Width = 550 };
            //textbox1 = new DxTextBox("2", "qwertyuiop[]asdfghjkl;'zxcvbnm,./1234567890".ToUpperInvariant()) { Margin = new Thickness(650, 35, 0, 0), Width = 550 };
            //Controls.Add(textbox);
            //Controls.Add(textbox1);

            //l1 = new DxLabel("1", $"{g.Graphics.MeasureText(textbox.Text.Substring(0, textbox.CaretPos + 1), FontCollection.Get("Control.Font").Font).Width}") { Margin = new Thickness(10, 35, 0, 0), Width = 200 };
            //Controls.Add(l1);

            //tb = new DxTrackBar("3", "DxTrackBar")
            //{
            //    Margin = new Thickness(200,500,0,0),
            //    Min = 0,
            //    Max = 255,
            //    TickRate = 1,
            //    Value = 0,
            //    IsSnapToTick = true
            //};
            //Controls.Add(tb);
            ////l = new DxLabel("1", $"")
            ////{
            ////    Margin = new Thickness(10, 10, 0, 0), Width = 800, Height = 500
            ////};
            ////Controls.Add(l);

            //bmp = new Image(g.Graphics.GetRenderTarget(), "q.png");
            //var q = new DxImage("", bmp){Margin = new Thickness(10,10,0,0), Width = 200, Height = 200};
            //Controls.Add(q);

            var button = new DxButton("button", "Test")
            {
                Margin = new Thickness(10, 10, 0, 0)
            };

            button.Click += btn =>
            {
                //MsgBox();
            };

            Controls.Add(button);

            var image = new DxImage("image", new Image(g.Graphics.GetRenderTarget(), "q.png"))
            {
                Width = 50, Height = 75, Margin = new Thickness(100, 10, 0, 0)
            };

            Controls.Add(image);

            var panel = new DxPanel("panel")
            {
                Width       = 50,
                Height      = 75,
                Margin      = new Thickness(100, 10, 0, 0),
                StrokeBrush = BrushCollection.Get("Control.Stroke").Brush
            };

            Controls.Add(panel);

            var imagebutton = new DxImageButton("imagebutton", new Image(g.Graphics.GetRenderTarget(), "q.png"))
            {
                Width = 50, Height = 75, Margin = new Thickness(200, 10, 0, 0)
            };

            imagebutton.Click += btn =>
            {
                //MsgBox();
            };
            Controls.Add(imagebutton);

            var label = new DxLabel("label", "text")
            {
                Margin = new Thickness(300, 10, 0, 0)
            };

            Controls.Add(label);

            var textbox = new DxTextBox("textbox", "test")
            {
                Width  = 100,
                Margin = new Thickness(100, 150, 0, 0)
            };

            Controls.Add(textbox);

            var toggle = new DxToggle("toggle", "test toggle")
            {
                Width    = 200,
                Margin   = new Thickness(100, 200, 0, 0),
                IsActive = true
            };

            Controls.Add(toggle);

            var trackbar = new DxTrackBar("trackbar", "trackbar test")
            {
                Width        = 200,
                Max          = 250,
                Min          = 0,
                IsSnapToTick = true,
                TickRate     = 1,
                Margin       = new Thickness(100, 250, 0, 0)
            };

            Controls.Add(trackbar);
        }
예제 #25
0
 private static void Overlay_OnGraphicsSetup(object sender, SetupGraphicsEventArgs e)
 {
 }
예제 #26
0
        private void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e)
        {
            var gfx = e.Graphics;

            if (e.RecreateResources)
            {
                foreach (var pair in _brushes)
                {
                    pair.Value.Dispose();
                }
                foreach (var pair in _images)
                {
                    pair.Value.Dispose();
                }
            }

            _brushes["black"]      = gfx.CreateSolidBrush(0, 0, 0);
            _brushes["white"]      = gfx.CreateSolidBrush(255, 255, 255);
            _brushes["red"]        = gfx.CreateSolidBrush(255, 0, 0);
            _brushes["green"]      = gfx.CreateSolidBrush(0, 255, 0);
            _brushes["blue"]       = gfx.CreateSolidBrush(0, 0, 255);
            _brushes["background"] = gfx.CreateSolidBrush(0x33, 0x36, 0x3F);
            _brushes["grid"]       = gfx.CreateSolidBrush(255, 255, 255, 0.2f);
            _brushes["random"]     = gfx.CreateSolidBrush(0, 0, 0);

            if (e.RecreateResources)
            {
                return;
            }

            _fonts["arial"]    = gfx.CreateFont("Arial", 12);
            _fonts["consolas"] = gfx.CreateFont("Consolas", 14);

            _gridBounds   = new Rectangle(20, 60, gfx.Width - 20, gfx.Height - 20);
            _gridGeometry = gfx.CreateGeometry();

            for (float x = _gridBounds.Left; x <= _gridBounds.Right; x += 20)
            {
                var line = new Line(x, _gridBounds.Top, x, _gridBounds.Bottom);
                _gridGeometry.BeginFigure(line);
                _gridGeometry.EndFigure(false);
            }

            for (float y = _gridBounds.Top; y <= _gridBounds.Bottom; y += 20)
            {
                var line = new Line(_gridBounds.Left, y, _gridBounds.Right, y);
                _gridGeometry.BeginFigure(line);
                _gridGeometry.EndFigure(false);
            }

            _gridGeometry.Close();

            _randomFigures = new List <Action <Graphics, float, float> >()
            {
                (g, x, y) => g.DrawRectangle(GetRandomColor(), x + 10, y + 10, x + 110, y + 110, 2.0f),
                (g, x, y) => g.DrawCircle(GetRandomColor(), x + 60, y + 60, 48, 2.0f),
                (g, x, y) => g.DrawRoundedRectangle(GetRandomColor(), x + 10, y + 10, x + 110, y + 110, 8.0f, 2.0f),
                (g, x, y) => g.DrawTriangle(GetRandomColor(), x + 10, y + 110, x + 110, y + 110, x + 60, y + 10, 2.0f),
                (g, x, y) => g.DashedRectangle(GetRandomColor(), x + 10, y + 10, x + 110, y + 110, 2.0f),
                (g, x, y) => g.DashedCircle(GetRandomColor(), x + 60, y + 60, 48, 2.0f),
                (g, x, y) => g.DashedRoundedRectangle(GetRandomColor(), x + 10, y + 10, x + 110, y + 110, 8.0f, 2.0f),
                (g, x, y) => g.DashedTriangle(GetRandomColor(), x + 10, y + 110, x + 110, y + 110, x + 60, y + 10, 2.0f),
                (g, x, y) => g.FillRectangle(GetRandomColor(), x + 10, y + 10, x + 110, y + 110),
                (g, x, y) => g.FillCircle(GetRandomColor(), x + 60, y + 60, 48),
                (g, x, y) => g.FillRoundedRectangle(GetRandomColor(), x + 10, y + 10, x + 110, y + 110, 8.0f),
                (g, x, y) => g.FillTriangle(GetRandomColor(), x + 10, y + 110, x + 110, y + 110, x + 60, y + 10),
            };
        }
예제 #27
0
 internal abstract void _window_SetupGraphics(object sender, SetupGraphicsEventArgs e);
예제 #28
0
 private void SetupGraphics(object sender, SetupGraphicsEventArgs e)
 {
     m_img_wheelup = e.Graphics.CreateImage("Images\\m_wheel_up.png");
     m_img_wheeldn = e.Graphics.CreateImage("Images\\m_wheel_dn.png");
 }