Exemple #1
0
        public void TestGumpBitmapAdapter()
        {
            var factory = new GumpFactory(Install, Container);
            var gump    = factory.GetGump <Bitmap>(0);

            Guard.RequireIsNotNull(gump, "Gump 0 was not found.");
        }
        public void TestGumpWriteableBitmapAdapter()
        {
            GumpFactory factory = new GumpFactory(Install, Container);
            ImageSource gump    = factory.GetGump <ImageSource>(0);

            Guard.AssertIsNotNull(gump, "Gump 0 was not found.");
        }
        public void TestGumpBitmapAdapter()
        {
            GumpFactory factory = new GumpFactory(Install, Container);
            Bitmap      gump    = factory.GetGump <Bitmap>(0);

            Guard.AssertIsNotNull(gump, "Gump 0 was not found.");
        }
Exemple #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            int centerX = (Width - 1) / 2;
            int centerY = (Height - 1) / 2;

            if (_gumpFactory != null)
            {
                Bitmap image = _gumpFactory.GetGump <Bitmap>(_scrollBar.Value);

                if (image != null)
                {
                    int widthOver2  = image.Width / 2;
                    int heightOver2 = image.Height / 2;

                    e.Graphics.DrawImage(image, new Rectangle(centerX - widthOver2, centerY - heightOver2, image.Width, image.Height));
                }
            }

            if (_gumpFactory == null)
            {
                TextRenderingHint textRenderingHint = e.Graphics.TextRenderingHint;
                e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

                using (Brush backBrush = new SolidBrush(Color.Red))
                {
                    using (Brush foreBrush = new SolidBrush(Color.Maroon))
                    {
                        using (StringFormat format = new StringFormat())
                        {
                            format.LineAlignment = StringAlignment.Center;
                            format.Alignment     = StringAlignment.Center;

                            e.Graphics.DrawString(
                                "GumpControl.Factory is not set.", Font, backBrush, new RectangleF(0, 0, Width, Height), format);
                            e.Graphics.DrawString(
                                "GumpControl.Factory is not set.", Font, foreBrush, new RectangleF(1, 1, Width, Height), format);
                        }
                    }
                }

                e.Graphics.TextRenderingHint = textRenderingHint;
            }

            using (Brush borderBrush = new SolidBrush(Color.LightSteelBlue))
            {
                using (Pen borderPen = new Pen(borderBrush))
                {
                    e.Graphics.DrawRectangle(borderPen, new Rectangle(0, 0, Width - 1, Height - 1));
                }
            }
        }
        public void TestGumpBitmapAdapter()
        {
            GumpFactory factory = new GumpFactory(Install, Container);
            Bitmap gump = factory.GetGump<Bitmap>(0);

            Guard.AssertIsNotNull(gump, "Gump 0 was not found.");
        }
        public void TestGumpWriteableBitmapAdapter()
        {
            GumpFactory factory = new GumpFactory(Install, Container);
            ImageSource gump = factory.GetGump<ImageSource>(0);

            Guard.AssertIsNotNull(gump, "Gump 0 was not found.");
        }
        public void TestGumpBitmapAdapter()
        {
            var factory = new GumpFactory(Install, Container);
            var gump = factory.GetGump<Bitmap>(0);

            Guard.RequireIsNotNull(gump, "Gump 0 was not found.");
        }