Inheritance: EventArgs, IDisposable
Exemple #1
2
        protected override void OnPaint(PaintEventArgs e)
        {
            //base.OnPaint(e);
            var myImg = new Bitmap("C:\\Users\\phil.SONOCINE\\Pictures\\MyTest.jpg");

            //byte[] bytes = ImageReading.pixels(myImg);

            this.pictureBox1.Image = ImageReading.pixels(myImg); ;
            //grayscale
            //var gsBytes = new List<byte>();
            //for (int i = 0; i < bytes.Length; i+=3)
            //{
            //    var R = bytes[i];
            //    var G = bytes[i+1];
            //    var B = bytes[i+2];
            //    byte gs = (byte)(0.2989 * R + 0.5870 * G + 0.1140 * B);
            //    gsBytes.Add(gs);
            //}

            //using (var ms = new MemoryStream(bytes))
            //{
            //    try
            //    {
            //        ms.Seek(0, SeekOrigin.Begin);
            //        var bmp = Image.FromStream(ms);
            //        e.Graphics.DrawImage(bmp, 0, 0);
            //    }
            //    catch(Exception ex)
            //    {
            //        Console.WriteLine(ex.Message);
            //    }
            //}
        }
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            //g.DrawLine(pen, new Point(1, 1), new Point(300, 100));
            //g.DrawLine(pen, new Point(100, 1), new Point(300, 100));
            //g.DrawRectangle(pen, new Rectangle(50, 50, 100, 100));
             
            //g.DrawString("Hello! 你好!", font, brush, new PointF(150.0F, 150.0F));
            //g.DrawEllipse(pen, 
            g.FillEllipse(brush, 30, 30, 200, 200);
            g.FillEllipse(brush, 130, 130, 200, 200);
            g.FillEllipse(new SolidBrush(Color.FromArgb(153, 23, 153, 155)), 220, 230, 150, 150);
            g.FillEllipse(new SolidBrush(Color.FromArgb(153, 23, 153, 55)), 200, 30, 150, 150);
            g.FillEllipse(new SolidBrush(Color.FromArgb(153, 93, 53, 55)), 40, 230, 250, 250);
            
            //Image image = Image.FromFile("../../MonaLisa.jpg");
            //g.DrawImage(image, new Point(200, 200));

            // Create a Bitmap object from an image file.
            Bitmap bitmap = new Bitmap("../../MonaLisa.jpg");

            // Get the color of a pixel within myBitmap.
            Color pixelColor = bitmap.GetPixel(50, 50);
            // RGB value : pixelColor.R, pixelColor.G, pixelColor.B

            g.DrawImage(bitmap, new Point(200, 200));
        }
Exemple #3
1
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            using (Graphics g = e.Graphics)
            {
                GraphicsPath path = new GraphicsPath();

                path.AddLine(20, 20, 170, 20);
                path.AddLine(20, 20, 20, 100);
                // рисуем новую фигуру
                path.StartFigure();
                path.AddLine(240, 140, 240, 50);
                path.AddLine(240, 140, 80, 140);
                path.AddRectangle(new Rectangle(30, 30, 200, 100));
                // локальное преобразование траектории
                //Matrix X = new Matrix();
                //X.RotateAt(45, new PointF(60.0f, 100.0f));
                //path.Transform(X);
                // рисуем  path
                Pen redPen = new Pen(Color.Red, 2);
                g.FillPath(new SolidBrush(Color.Bisque), path);
                g.DrawPath(redPen, path);

            }

        }
Exemple #4
1
        void DrawGraphics(Object sender, PaintEventArgs PaintNow)
        {
            Rectangle Dot = new Rectangle(SpriteX, SpriteY, SpriteWidth, SpriteHeight); // Create rectangle (start position, and size X & Y)
            SolidBrush WhiteBrush = new SolidBrush(Color.White); // Create Brush(Color) to paint rectangle

            PaintNow.Graphics.FillRectangle(WhiteBrush, Dot);
        }
        /// <summary>
        /// Rotate an image on a point with a specified angle
        /// </summary>
		/// <param name="pe">The paint area event where the image will be displayed</param>
		/// <param name="img">The image to display</param>
		/// <param name="alpha">The angle of rotation in radian</param>
		/// <param name="ptImg">The location of the left upper corner of the image to display in the paint area in nominal situation</param>
		/// <param name="ptRot">The location of the rotation point in the paint area</param>
		/// <param name="scaleFactor">Multiplication factor on the display image</param>
        protected void RotateImage(PaintEventArgs pe, Image img, Double alpha, Point ptImg, Point ptRot, float scaleFactor)
        {
            double beta = 0; 	// Angle between the Horizontal line and the line (Left upper corner - Rotation point)
            double d = 0;		// Distance between Left upper corner and Rotation point)		
            float deltaX = 0;	// X componant of the corrected translation
            float deltaY = 0;	// Y componant of the corrected translation

			// Compute the correction translation coeff
            if (ptImg != ptRot)
            {
				//
                if (ptRot.X != 0)
                {
                    beta = Math.Atan((double)ptRot.Y / (double)ptRot.X);
                }

                d = Math.Sqrt((ptRot.X * ptRot.X) + (ptRot.Y * ptRot.Y));

                // Computed offset
                deltaX = (float)(d * (Math.Cos(alpha - beta) - Math.Cos(alpha) * Math.Cos(alpha + beta) - Math.Sin(alpha) * Math.Sin(alpha + beta)));
                deltaY = (float)(d * (Math.Sin(beta - alpha) + Math.Sin(alpha) * Math.Cos(alpha + beta) - Math.Cos(alpha) * Math.Sin(alpha + beta)));
            }

            // Rotate image support
            pe.Graphics.RotateTransform((float)(alpha * 180 / Math.PI));

            // Dispay image
            pe.Graphics.DrawImage(img, (ptImg.X + deltaX) * scaleFactor, (ptImg.Y + deltaY) * scaleFactor, img.Width * scaleFactor, img.Height * scaleFactor);

            // Put image support as found
            pe.Graphics.RotateTransform((float)(-alpha * 180 / Math.PI));

        }
 public void SpaceArcadeShooter_Paint(object sender, PaintEventArgs e)
 {
     foreach (var GameObj in GameObject.AllObjects)
     {
         e.Graphics.DrawImage(GameObj.img, new Point(GameObj.X, GameObj.Y));
     }
 }
        protected override void OnPaint(PaintEventArgs pevent)
        {
            var g = pevent.Graphics;
            g.TextRenderingHint = TextRenderingHint.AntiAlias;

            g.Clear(Parent.BackColor);

            //Hover
            Color c = SkinManager.GetFlatButtonHoverBackgroundColor();
            using (Brush b = new SolidBrush(Color.FromArgb((int)(hoverAnimationManager.GetProgress() * c.A), c.RemoveAlpha())))
                g.FillRectangle(b, ClientRectangle);

            //Ripple
            if (animationManager.IsAnimating())
            {
                g.SmoothingMode = SmoothingMode.AntiAlias;
                for (int i = 0; i < animationManager.GetAnimationCount(); i++)
                {
                    var animationValue = animationManager.GetProgress(i);
                    var animationSource = animationManager.GetSource(i);

                    using (Brush rippleBrush = new SolidBrush(Color.FromArgb((int)(101 - (animationValue * 100)), Color.Black)))
                    {
                        var rippleSize = (int)(animationValue * Width * 2);
                        g.FillEllipse(rippleBrush, new Rectangle(animationSource.X - rippleSize / 2, animationSource.Y - rippleSize / 2, rippleSize, rippleSize));
                    }
                }
                g.SmoothingMode = SmoothingMode.None;
            }
			g.DrawString(Text.ToUpper(), SkinManager.ROBOTO_MEDIUM_10, Enabled ? (Primary ? SkinManager.ColorScheme.PrimaryBrush : SkinManager.GetPrimaryTextBrush()) : SkinManager.GetFlatButtonDisabledTextBrush(), ClientRectangle, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
        }
Exemple #8
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (DoodlJumper2.FlyFaza == false)
            {
                Doodle2.Top += 2;
                System.Threading.Thread.Sleep(4);
            }
            if ((Doodle2.Top + 36 == 294) && (DoodlJumper2.FlyFaza == false))
            {
                DoodlJumper2.FlyFaza = true;
            }
            if (DoodlJumper2.FlyFaza == true)
            {
                Doodle2.Top -= 2;
                System.Threading.Thread.Sleep(4);
                hight++;
            }
            if (hight == 45)
            {
                DoodlJumper2.FlyFaza = false;
                hight = 0;
            }
            Graphics g = e.Graphics;
            g.DrawString("Records:", new Font("Segoe Script", 20), Brushes.Magenta, new RectangleF(20, 20, 200, 50));

            Doodle2.Refresh();
        }
        protected override void OnPaint(PaintEventArgs pe)
        {
            // Calling the base class OnPaint
            base.OnPaint(pe);

            // Pre Display computings
            Point ptRotation = new Point(150, 150);
            Point ptimgNeedle = new Point(136,39);

            bmpCadran.MakeTransparent(Color.Yellow);
            bmpNeedle.MakeTransparent(Color.Yellow);

            double alphaNeedle = InterpolPhyToAngle(airSpeed,0,80,180,468);

            float scale = (float)this.Width / bmpCadran.Width;

            // diplay mask
            Pen maskPen = new Pen(this.BackColor, 30 * scale);
            pe.Graphics.DrawRectangle(maskPen, 0, 0, bmpCadran.Width * scale, bmpCadran.Height * scale);

            // display cadran
            pe.Graphics.DrawImage(bmpCadran, 0, 0, (float)(bmpCadran.Width * scale), (float)(bmpCadran.Height * scale));

            // display small needle
            RotateImage(pe, bmpNeedle, alphaNeedle, ptimgNeedle, ptRotation, scale);
        }
 protected override void OnPaint(PaintEventArgs e)
 {
     //e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor),
       //  new PointF(0, 0));
       //e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Black), 2), this.Bounds);
       base.OnPaint(e);
 }
Exemple #11
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            // TODO: 在此处添加自定义绘制代码

            // 调用基类 OnPaint
            base.OnPaint(pe);
        }
Exemple #12
0
        static void DrawGraph(object sender, PaintEventArgs args)
        {
            if (map == null) return;
            var g = args.Graphics;
            var W = pointsPanel.ClientSize.Width - 20;
            var H = pointsPanel.ClientSize.Height - 20;
            g.Clear(Color.White);
            g.TranslateTransform(10, 10);
            var pen=new Pen(Color.FromArgb(100,Color.LightGray));
            foreach (var e in map)
            {
                if (e.MapX != task.NetworkWidth - 1)
                    g.DrawLine(pen, W * e.X, H * e.Y, W * map[e.MapX + 1, e.MapY].X, H * map[e.MapX + 1, e.MapY].Y);
                if (e.MapY != task.NetworkHeight - 1)
                    g.DrawLine(pen, W * e.X, H * e.Y, W * map[e.MapX, e.MapY + 1].X, H * map[e.MapX, e.MapY + 1].Y);
            }

            foreach(var e in map)
            {
                g.FillEllipse(GetBrush(e),
                    e.X*W-3,
                    e.Y*W-3,
                    6,
                    6);

            }
        }
Exemple #13
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            PointF text = new PointF(CMB_coordsystem.Right + 3, 3);

            //Enum.GetValues(typeof(CoordsSystems), CMB_coordsystem.Text);

            if (System == CoordsSystems.GEO.ToString())
            {
                e.Graphics.DrawString(Lat.ToString("0.000000") + " " + Lng.ToString("0.000000") + "   " + Alt.ToString("0.00"), this.Font, new SolidBrush(this.ForeColor), text, StringFormat.GenericDefault);
            }
            else  if (System == CoordsSystems.UTM.ToString())
            {
                UTM utm = (UTM)point;
                //utm.East.ToString("0.00") + " " + utm.North.ToString("0.00")
                e.Graphics.DrawString(utm.ToString() + "   " + Alt.ToString("0.00"), this.Font, new SolidBrush(this.ForeColor), text, StringFormat.GenericDefault);
            }
            else if (System == CoordsSystems.MGRS.ToString())
            {
                MGRS mgrs = (MGRS)point;
                mgrs.Precision = 5;
                e.Graphics.DrawString(mgrs.ToString() + "   " + Alt.ToString("0.00"), this.Font, new SolidBrush(this.ForeColor), text, StringFormat.GenericDefault);
            }
        }
 public override void Paint(PaintEventArgs pe)
 {
     if (((this._item is ToolStripControlHost) && this._item.IsOnDropDown) && (!(this._item is ToolStripComboBox) || !VisualStyleRenderer.IsSupported))
     {
         this._item.Invalidate();
     }
 }
Exemple #15
0
        /// <summary>
        /// Draws the button to the border
        /// </summary>
        /// <param name="sender">The form which contains the button</param>
        /// <param name="e">The PaintEventArgs of the form's Paint-Event</param>
        public override void Draw(object sender, PaintEventArgs e)
        {
            Color darkDarkRed = Color.FromArgb(Color.Red.R - 130, Color.Red.G, Color.Red.B);
            Color darkerDarkRed = Color.FromArgb(Color.Red.R - 150, Color.Red.G, Color.Red.B);

            switch (Hovered)
            {
                case ButtonHoverState.None:
                    e.Graphics.Clear(Color.DarkRed);
                    break;
                case ButtonHoverState.Hovered:
                    e.Graphics.Clear(darkDarkRed);
                    break;
                case ButtonHoverState.Clicked:
                    e.Graphics.Clear(darkerDarkRed);
                    e.Graphics.SetClip(new Rectangle(Location.X + 2, Location.Y + 2, Width - 2, Height - 2));
                    e.Graphics.Clear(darkDarkRed);
                    break;
            }
            e.Graphics.DrawImage(Properties.Resources.Close, new PointF
            {
                X = Location.X + Width / 2 - Properties.Resources.Close.Width / 2 + (Hovered == ButtonHoverState.Clicked ? 2 : 0),
                Y = Location.Y + Height / 2 - Properties.Resources.Close.Height / 2 + (Hovered == ButtonHoverState.Clicked ? 2 : 0)
            });
        }
		private void GridControl_Paint(object sender, PaintEventArgs e)
		{
			if (!_underlineHoverRow || _downHitInfo == null || DropTargetRowHandle < 0) return;
			var grid = (GridControl)sender;
			var view = (GridView)grid.MainView;

			var isBottomLine = DropTargetRowHandle == view.DataRowCount;

			var viewInfo = view.GetViewInfo() as GridViewInfo;
			if (viewInfo == null) return;
			var rowInfo = viewInfo.GetGridRowInfo(isBottomLine ? DropTargetRowHandle - 1 : DropTargetRowHandle);

			if (rowInfo == null) return;

			Point p1, p2;
			if (isBottomLine)
			{
				p1 = new Point(rowInfo.Bounds.Left, rowInfo.Bounds.Bottom - 1);
				p2 = new Point(rowInfo.Bounds.Right, rowInfo.Bounds.Bottom - 1);
			}
			else
			{
				p1 = new Point(rowInfo.Bounds.Left, rowInfo.Bounds.Top - 1);
				p2 = new Point(rowInfo.Bounds.Right, rowInfo.Bounds.Top - 1);
			}

			var pen = new Pen(Color.FromArgb(254, 164, 0), 3);
			e.Graphics.DrawLine(pen, p1, p2);
		}
Exemple #17
0
 private void Form1_Paint_1(object sender, PaintEventArgs e)
 {
     if (grid != null)
         grid.Paint(e.Graphics);
     labelSuccessfulTurns.Text = grid.GameCounter.NumberOfSuccessfulTurns.ToString();
     labelTurns.Text = grid.GameCounter.NumberOfTurns.ToString();
 }
Exemple #18
0
    private static void PaintRectangle(object sender, PaintEventArgs e)
    {
        // Draw the current ellipse
            Point pos = mMask.PointToClient(Control.MousePosition);

            e.Graphics.DrawEllipse(sPen, Math.Min(mPos.X, pos.X), Math.Min(mPos.Y, pos.Y), Math.Abs(mPos.X - pos.X), Math.Abs(mPos.Y - pos.Y));
    }
			/// <summary>
			/// Add custom logic before the <see cref="E:Genetibase.Shared.Windows.NuGenWndLessControl.Paint"/> event will be raised.
			/// </summary>
			/// <param name="e"></param>
			protected override void OnPaint(PaintEventArgs e)
			{
				NuGenPaintParams paintParams = new NuGenPaintParams(e.Graphics);
				paintParams.Bounds = this.Bounds;
				paintParams.State = this.ButtonStateTracker.GetControlState();
				this.Renderer.DrawDropDownButton(paintParams);
			}
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;

            if (this.Checked)
            {
                if (OnColour != Color.Empty)
                {
                    g.FillEllipse(new SolidBrush(OnColour), _circle);
                    g.FillEllipse(_flareBrush, _glint);
                    g.DrawEllipse(_outline, _circle);
                }
            }
            else
            {
                if (OffColour != Color.Empty)
                {
                    g.FillEllipse(new SolidBrush(OffColour), _circle);
                    g.FillEllipse(_flareBrush, _glint);
                    g.DrawEllipse(_outline, _circle);
                }
            }
        }
        protected override void OnPaint(PaintEventArgs paintEvent)
        {
            base.OnPaint(paintEvent);

            // Clear Control
            paintEvent.Graphics.Clear(_buttonColorTop);

            Brush gradientBrush = new LinearGradientBrush(new Rectangle(0, 0, Width - 1, Height - 1), _buttonColorTop, _buttonColorBottom, 90.0F);
            paintEvent.Graphics.FillRectangle(gradientBrush, new Rectangle(0, 0, Width - 1, Height - 1));

            switch (_mouseState)
            {
                case MouseState.None:
                    paintEvent.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.Black)), new Rectangle(0, 0, Width - 1, Height - 1));
                    break;
                case MouseState.Over:
                    paintEvent.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.White)), new Rectangle(0, 0, Width - 1, Height - 1));
                    break;
                case MouseState.Down:
                    paintEvent.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.DarkGray)), new Rectangle(0, 0, Width - 1, Height - 1));
                    break;
            }

            // Draw Border
            paintEvent.Graphics.DrawRectangle(new Pen(_borderColor), new Rectangle(0, 0, Width - 1, Height - 1));

            // Draw Button Text
            paintEvent.Graphics.DrawString(this.Text, _font, new SolidBrush(_textColor), CalculateTextPoint());
        }
Exemple #22
0
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
          // ControlPaint.DrawBorder3D(e.Graphics,0,0,panel1.Width,panel1.Height,Border3DStyle.);
            e.Graphics.DrawLine(new Pen(SystemColors.ActiveBorder,3), 0, panel1.Height, panel1.Width, panel1.Height);

           // ControlPaint.DrawBorder(e.Graphics, new Rectangle(0, panel1.Height-1, panel1.Width, panel1.Height-1), SystemColors.ActiveBorder, ButtonBorderStyle.Dashed);
        }
        protected override void OnPaint(PaintEventArgs pe)
        {
            // TODO: Add custom paint code here

            // Calling the base class OnPaint
            base.OnPaint(pe);
        }
Exemple #24
0
        /// <summary> The Main "Loop" of our program </summary>
        /// <remarks>Since this is Event based, the Form Window is only
        /// updated when something happens: like a mouse being moved.
        /// Otherwise, no resources are being used</remarks>
        void RenderStuff(Object sender, PaintEventArgs PaintNow)
        {
            Rectangle Dot = new Rectangle(SpriteX, SpriteY, 2, 2); // Create rectangle (start position, and size X & Y)
            SolidBrush WhiteBrush = new SolidBrush(Color.White); // Create Brush(Color) to paint rectangle

            PaintNow.Graphics.FillRectangle(WhiteBrush, Dot); // Play Parcheesi!
        }
        private void ModuleUsageVisualizerForm_Paint(object sender, PaintEventArgs e)
        {
            if (selectedRobot != null && selectedRobot.brainHistory != null && selectedRobot.brainHistory.Count > 1)
            {
                double widthPerStep = this.Width / (1.0 * selectedRobot.brainHistory.Count);
                g = e.Graphics;
                int currentMode = selectedRobot.brainHistory[0];
                int modeStartTime = 0;
                Rectangle r;
                for (int i = 0; i < selectedRobot.brainHistory.Count; i++)
                {
                    // Schrum: Draw each contiguous period of the same mode as a single
                    // rectangle. This is needed because individual time slices eventually
                    // drop in width below one pixel, and can't be drawn individuallly.
                    if (currentMode != selectedRobot.brainHistory[i])
                    {
                        r = new Rectangle((int)(modeStartTime * widthPerStep), 0, (int)((i - modeStartTime)*widthPerStep), this.Height);
                        g.FillRectangle(EngineUtilities.modePen(currentMode), r);
                        // Schrum: Adjust to track new mode
                        modeStartTime = i;
                        currentMode = selectedRobot.brainHistory[i];
                    }

                }

                // Schrum: Draw final rectangle for module used up until the current time step
                r = new Rectangle((int)(modeStartTime * widthPerStep), 0, (int)((selectedRobot.brainHistory.Count - modeStartTime)*widthPerStep), this.Height);
                g.FillRectangle(EngineUtilities.modePen(currentMode), r);
            }
        }
        protected override void OnPaint(PaintEventArgs pea)
        {
            base.OnPaint(pea);

            Graphics grfx = pea.Graphics;

            LinearGradientBrush lgbrush = null;
            Font font = new Font(this.Font.FontFamily, this.Font.Size, this.Font.Style);
            SolidBrush brush = new SolidBrush(this.ForeColor);

            int cw = (this.Width - 20)/7;
            int ch = this.Height - 20;

            for(int i = 0 ; i < 7; i++)
            {
                Rectangle temp = new Rectangle(10+(i*cw), 10, cw, ch );

                if(i < 6)
                    lgbrush = new LinearGradientBrush(temp, colors[i], colors[i+1], LinearGradientMode.Horizontal);
                else
                    lgbrush = new LinearGradientBrush(temp, colors[i], colors[0], LinearGradientMode.Horizontal);

                lgbrush.WrapMode = WrapMode.Tile;
                grfx.FillRectangle(lgbrush, 10+(i*cw), 10, cw, ch );
            }

            grfx.DrawString(this.Text, font, brush, this.Width/3, this.Height/2);
        }
Exemple #27
0
 protected override void OnPaint(PaintEventArgs e)
 {
     if (Horizontal)
         e.Graphics.DrawLine(Theme.BackPen, 0, Height / 2, Width, Height / 2);
     else
         e.Graphics.DrawLine(Theme.BackPen, Width / 2, 0, Width / 2, Height);
 }
 private void GetThumbnail(PaintEventArgs e)
 {
     Image.GetThumbnailImageAbort callback =
         new Image.GetThumbnailImageAbort(ThumbnailCallback);
     if (flag == 1)
     {
         for (int j = 0; j < 4; ++j)
         {
             for (int i = 0; i < 4; ++i)
             {
                 Image image = new Bitmap(filePaths[j * 4 + i]);
                 Image pThumbnail = image.GetThumbnailImage(200, 150, callback, new
                    IntPtr());
                 //label1.Text = filePaths[j*2 +i];
                 e.Graphics.DrawImage(
                    pThumbnail,
                    i * 230 + 20,
                    j * 160 + 10,
                    pThumbnail.Width,
                    pThumbnail.Height);
                 image = null;
                 pThumbnail = null;
                 GC.Collect();
             }
         }
     }
 }
 protected override void OnPaint(PaintEventArgs e)
 {
     if (background != null)
         e.Graphics.DrawImage(background, 0, 0);
     else
         base.OnPaint(e);
 }
        /// <summary>
        /// Raises the <see cref="Control.Paint"/> event.
        /// </summary>
        /// <param name="e">A <see cref="PaintEventArgs"/> that contains the event data.</param>
        protected override void OnPaint( PaintEventArgs e )
        {
            Rectangle clientRect = this.ClientRectangle;

              using( Brush brush = new SolidBrush( this.BackColor ) )
              {
            e.Graphics.FillRectangle( brush, clientRect );
              }

              if( !m_backgroundPaintedOnce )
              {
            m_backgroundPaintedOnce = true;
            this.Invalidate();
            return;
              }

              this.UpdateLayout();

              PreviewPageInfo previewPage = this.CurrentPreviewPage;

              if( previewPage != null )
              {
            Debug.Assert( !m_pageRectangle.IsEmpty, "The page rectangle should not be empty when there is a CurrentPreviewPage. It should have been calculated in UpdateLayout()." );

            Rectangle shadowRectangle = m_pageRectangle;
            shadowRectangle.Offset( ShadowThickness, ShadowThickness );

            Rectangle borderRectangle = m_pageRectangle;
            borderRectangle.Width -= 1; // Need to remove 1 pixel from the width and height for DrawRectangle to work
            borderRectangle.Height -= 1;

            // Draw the shadow
            e.Graphics.FillRectangle( Brushes.Black, shadowRectangle );

            // Draw the page
            e.Graphics.FillRectangle( Brushes.White, m_pageRectangle );

            //TODO: Ne pas dessiner si rectangle plus petit que 2x2
            // Draw the page contents
            e.Graphics.DrawImage( previewPage.Image, m_pageRectangle );

            // Draw the page border
            e.Graphics.DrawRectangle( Pens.Black, borderRectangle );
              }
              else
              {
            using( Brush brush = new SolidBrush( this.ForeColor ) )
            {
              using( StringFormat stringFormat = new StringFormat() )
              {
            stringFormat.Alignment = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;

            e.Graphics.DrawString( "No Report", this.Font, brush, clientRect, stringFormat );
              }
            }
              }

              base.OnPaint( e );
        }
 protected override void OnPaintBackground(PaintEventArgs pevent)
 {
     //base.OnPaintBackground(pevent);
 }
Exemple #32
0
 protected override void OnPaint(PaintEventArgs e)  //畫圖
 {
     e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     base.OnPaint(e);
     _model.Draw(e.Graphics);
 }
Exemple #33
0
 private void panel_draw_Paint(object sender, PaintEventArgs e)
 {
     PaintInPanel();
 }
 private void panel1_Paint_1(object sender, PaintEventArgs e)
 {
 }
 private void pnlHalldetails_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #36
0
        private void Form2_Paint(object sender, PaintEventArgs e)//画整体图像
        {
            this.Height = 600;
            this.Width  = 1500;
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            e.Graphics.FillRectangle(Brushes.Azure, e.Graphics.ClipBounds);//背景填充
            /******************显示1号温度目标值**********************/
            gp.AddString("1号暖房目标温度:" + Convert.ToString(Form1.SetT1), this.Font.FontFamily,
                         (int)(FontStyle.Regular), 13, new RectangleF(StartPrint, 0, 400, 50), null);
            /******************显示2号温度目标值**********************/
            gp.AddString("2号暖房目标温度:" + Convert.ToString(Form1.SetT2), this.Font.FontFamily,
                         (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 160, 0, 400, 50), null);
            /******************显示1号温度实际值**********************/
            gp.AddString("1号暖房实际温度:" + Convert.ToString(Form1.T1_Value), this.Font.FontFamily,
                         (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 320, 0, 400, 50), null);
            /******************1号暖房温度报警**********************/
            if (Form1.T1_Value >= 80)//2号暖房上限温度
            {
                gp.AddString("1号暖房温度超标 请及时关闭!!!", this.Font.FontFamily,
                             (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 960, 0, 400, 50), null);
            }
            /******************显示2号温度实际值**********************/
            gp.AddString("2号暖房实际温度:" + Convert.ToString(Form1.T2_Value), this.Font.FontFamily,
                         (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 480, 0, 400, 50), null);
            /******************2号暖房温度报警**********************/
            if (Form1.T1_Value >= 80)//2号暖房上限温度
            {
                gp.AddString("2号暖房温度超标 请及时关闭!!!", this.Font.FontFamily,
                             (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 1200, 0, 400, 50), null);
            }
            /******************显示1号PID输出值**********************/
            gp.AddString("1号PID输出值:" + Convert.ToString(Form1.PID_Value1), this.Font.FontFamily,
                         (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 640, 0, 400, 50), null);
            /******************显示2号PID输出值**********************/
            gp.AddString("2号PID输出值:" + Convert.ToString(Form1.PID_Value2), this.Font.FontFamily,
                         (int)(FontStyle.Regular), 13, new RectangleF(StartPrint + 800, 0, 400, 50), null);
            /***************************Y轴画线*************************/
            for (int i = 0; i <= (this.ClientRectangle.Height - 2 * StartPrint) / Length; i++) //上下两个间距
            {
                e.Graphics.DrawLine(TablePen, StartPrint, StartPrint + i * Length,             //横向画线
                                    this.ClientRectangle.Width, StartPrint + i * Length);
                /******************************************显示Y轴数据***************************************************/
                gp.AddString(Convert.ToString(StepY * ((this.ClientRectangle.Height - 2 * 32) / Length - i) + StartY), this.Font.FontFamily,
                             (int)(FontStyle.Regular), 13, new RectangleF(10, StartPrint + i * Length - 8, 400, 50), null);
            }
            /***************************X轴画线*************************/
            for (int i = 0; i <= (this.ClientRectangle.Width - StartPrint) / Length; i++)
            {
                e.Graphics.DrawLine(TablePen, StartPrint + i * Length, StartPrint,//纵向画线
                                    StartPrint + i * Length, (int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint);

                /******************************************获取时间数据***************************************************/
                int    hour = System.DateTime.Now.Hour; int minute = System.DateTime.Now.Minute; int second = System.DateTime.Now.Second;
                string str = hour + "." + minute + "." + second + ".";
                /******************************************显示X轴数据***************************************************/
                if (i % 5 == 0) //要显示时间
                {
                    gp.AddString(Convert.ToString(i * StepX + StartX) + "s", this.Font.FontFamily,
                                 (int)(FontStyle.Regular), 10, new RectangleF(StartPrint + i * Length - 8, this.ClientRectangle.Height - Length, 400, 50), null);
                }
            }
            e.Graphics.DrawPath(Pens.Pink, gp);//显示X Y 轴数据,可设置其颜色
            /***************************波形画线*************************/
            for (int i = 1; i < DataList1.Count; i++)
            {
                e.Graphics.DrawLine(ListsPen1, StartPrint + (i - StartX - 1) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList1[i - 1] - StartY) * Length / StepY),
                                    StartPrint + (i - StartX) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList1[i] - StartY) * Length / StepY));
                //(实际值-最小值)/(最大值-最小值) = 实际值的高/最大值的高 ====== 传输实数也是可以显示的
            }
            for (int i = 1; i < DataList2.Count; i++)
            {
                e.Graphics.DrawLine(ListsPen2, StartPrint + (i - StartX - 1) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList2[i - 1] - StartY) * Length / StepY),
                                    StartPrint + (i - StartX) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList2[i] - StartY) * Length / StepY));
                //(实际值-最小值)/(最大值-最小值) = 实际值的高/最大值的高 ====== 传输实数也是可以显示的
            }
            for (int i = 1; i < DataList3.Count; i++)
            {
                e.Graphics.DrawLine(ListsPen3, StartPrint + (i - StartX - 1) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList3[i - 1] - StartY) * Length / StepY),
                                    StartPrint + (i - StartX) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList3[i] - StartY) * Length / StepY));
                //(实际值-最小值)/(最大值-最小值) = 实际值的高/最大值的高 ====== 传输实数也是可以显示的
            }
            for (int i = 1; i < DataList4.Count; i++)
            {
                e.Graphics.DrawLine(ListsPen4, StartPrint + (i - StartX - 1) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList4[i - 1] - StartY) * Length / StepY),
                                    StartPrint + (i - StartX) * Length / StepX, (float)((int)((this.ClientRectangle.Height - 2 * StartPrint) / Length) * Length + StartPrint - (DataList4[i] - StartY) * Length / StepY));
                //(实际值-最小值)/(最大值-最小值) = 实际值的高/最大值的高 ====== 传输实数也是可以显示的
            }
        }
Exemple #37
0
 /// <summary>
 ///     Draw border for image
 /// </summary>
 private void pct_Paint(object sender, PaintEventArgs e)
 {
     Utility.DrawBorder(pct, e.Graphics);
 }
Exemple #38
0
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            // Make sure the background isn't erased, to reduce flicker

            //base.OnPaintBackground (pevent);
        }
Exemple #39
0
 public override void DoPaint(PaintEventArgs e)
 {
     Logger.Debug(fmh => fmh("Paint"));
     base.DoPaint(e);
 }
Exemple #40
0
 private void Form1_Paint(object sender, PaintEventArgs e)
 {
     this.Render();
 }
Exemple #41
0
 private void panel1_Paint(object sender, PaintEventArgs e)
 {
     e.Graphics.DrawImage(obrazek, 0, 0, szerokosc, wysokosc);
 }
Exemple #42
0
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
 }
 private void Panel1_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #44
0
 private void Ball_Paint(object sender, PaintEventArgs e)
 {
     DrawImage(e.Graphics);
 }
Exemple #45
0
 private void pnlDashboard_Paint(object sender, PaintEventArgs e)
 {
 }
 private void panel2_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #47
0
 private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #48
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);

            var glyphSize = GlyphSize;

            if (glyphSize < 1)
            {
                return;                 // can't draw it
            }
            var g    = pe.Graphics;
            var font = new Font(Font.FontFamily, glyphSize * Math.Min(g.DpiX, g.DpiY) / 96);
            var sf   = new StringFormat();

            sf.Alignment     = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            if (Rectangles != null)
            {
                foreach (var rectangle in Rectangles)
                {
                    var rect  = rectangle.Item1;
                    var rect2 = new Rectangle(
                        (rect.Left + Grid.Radius) * glyphSize,
                        (rect.Top + Grid.Radius) * glyphSize,
                        rect.Width * glyphSize,
                        rect.Height * glyphSize);

                    g.FillRectangle(new SolidBrush(Color.FromArgb(16, rectangle.Item2)), rect2);
                    g.DrawRectangle(new Pen(rectangle.Item2), rect2);
                }
            }

            for (var x = -Grid.Radius; x <= Grid.Radius; x++)
            {
                for (var y = -Grid.Radius; y <= Grid.Radius; y++)
                {
                    var l  = (x + Grid.Radius) * glyphSize;
                    var r  = (x + Grid.Radius + 1) * glyphSize;
                    var t  = (y + Grid.Radius) * glyphSize;
                    var b  = (y + Grid.Radius + 1) * glyphSize;
                    var cx = l + glyphSize / 2;
                    var cy = t + glyphSize / 2;

                    if (Grid != null)
                    {
                        var item = Grid[x, y];
                        if (item == null)
                        {
                            if (BoringGrid != null && BoringGrid.AreCoordsInBounds(x, y) && BoringGrid[x, y])
                            {
                                g.DrawString(NullGlyph.ToString(), font, new SolidBrush(BoringColor), cx, cy, sf);
                            }
                            else
                            {
                                g.DrawString(NullGlyph.ToString(), font, new SolidBrush(NullColor), cx, cy, sf);
                            }
                        }
                        else
                        {
                            g.DrawString(item.Glyph.ToString(), font, new SolidBrush(item.Color), cx, cy, sf);
                        }
                    }
                }
            }
        }
Exemple #49
0
        protected override void OnPaint(PaintEventArgs e)
        {
            this.UpdateColors();

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            W = Width - 1;
            H = Height - 1;

            GraphicsPath GP   = new GraphicsPath();
            Rectangle    Base = new Rectangle(0, 0, W, H);

            var _with8 = G;

            _with8.SmoothingMode     = SmoothingMode.HighQuality;
            _with8.PixelOffsetMode   = PixelOffsetMode.HighQuality;
            _with8.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            _with8.Clear(BackColor);

            switch (State)
            {
            case MouseState.None:
                if (Rounded)
                {
                    //-- Base
                    GP = Helpers.RoundRec(Base, 6);
                    _with8.FillPath(new SolidBrush(_BaseColor), GP);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, Helpers.CenterSF);
                }
                else
                {
                    //-- Base
                    _with8.FillRectangle(new SolidBrush(_BaseColor), Base);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, Helpers.CenterSF);
                }
                break;

            case MouseState.Over:
                if (Rounded)
                {
                    //-- Base
                    GP = Helpers.RoundRec(Base, 6);
                    _with8.FillPath(new SolidBrush(_BaseColor), GP);
                    _with8.FillPath(new SolidBrush(Color.FromArgb(20, Color.White)), GP);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, Helpers.CenterSF);
                }
                else
                {
                    //-- Base
                    _with8.FillRectangle(new SolidBrush(_BaseColor), Base);
                    _with8.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), Base);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, Helpers.CenterSF);
                }
                break;

            case MouseState.Down:
                if (Rounded)
                {
                    //-- Base
                    GP = Helpers.RoundRec(Base, 6);
                    _with8.FillPath(new SolidBrush(_BaseColor), GP);
                    _with8.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), GP);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, Helpers.CenterSF);
                }
                else
                {
                    //-- Base
                    _with8.FillRectangle(new SolidBrush(_BaseColor), Base);
                    _with8.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.Black)), Base);

                    //-- Text
                    _with8.DrawString(Text, Font, new SolidBrush(_TextColor), Base, Helpers.CenterSF);
                }
                break;
            }

            base.OnPaint(e);
            G.Dispose();
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            e.Graphics.DrawImageUnscaled(B, 0, 0);
            B.Dispose();
        }
Exemple #50
0
    //</snippet3>

    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        //CreatePointsAndSizes(e)
        ShowPropertiesOfSlateBlue(e);
    }
Exemple #51
0
 private void xtraTabPage2_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #52
0
 private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
 {
 }
 private void pnlCheckAvailability_Paint(object sender, PaintEventArgs e)
 {
 }
 protected abstract void OnPaint(PaintEventArgs e);
Exemple #55
0
 private void tbReversal_Paint(object sender, PaintEventArgs e)
 {
 }
 protected override void OnPaint(PaintEventArgs e)
 {
     base.OnPaint(e);
     e.Graphics.DrawString(this.TextToRender, new Font("Tahoma", 5), Brushes.White, new PointF(1, 1));
 }
Exemple #57
0
 private void tbTransaction_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #58
0
        private void PictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            m_Brick.Paint(g);
        }
 private void child1_Paint(object sender, PaintEventArgs e)
 {
 }
Exemple #60
0
        protected override void OnPaint(PaintEventArgs pevent)
        {
            var g = pevent.Graphics;

            g.SmoothingMode     = SmoothingMode.AntiAlias;
            g.TextRenderingHint = TextRenderingHint.AntiAlias;

            // clear the control
            g.Clear(Parent.BackColor);

            var RADIOBUTTON_CENTER = boxOffset + RADIOBUTTON_SIZE_HALF;

            var animationProgress = animationManager.GetProgress();

            int   colorAlpha        = Enabled ? (int)(animationProgress * 255.0) : SkinManager.GetCheckBoxOffDisabledColor().A;
            int   backgroundAlpha   = Enabled ? (int)(SkinManager.GetCheckboxOffColor().A *(1.0 - animationProgress)) : SkinManager.GetCheckBoxOffDisabledColor().A;
            float animationSize     = (float)(animationProgress * 8f);
            float animationSizeHalf = animationSize / 2;

            animationSize = (float)(animationProgress * 9f);

            var brush = new SolidBrush(Color.FromArgb(colorAlpha, Enabled ? SkinManager.ColorScheme.AccentColor : SkinManager.GetCheckBoxOffDisabledColor()));
            var pen   = new Pen(brush.Color);

            // draw ripple animation
            if (Ripple && rippleAnimationManager.IsAnimating())
            {
                for (int i = 0; i < rippleAnimationManager.GetAnimationCount(); i++)
                {
                    var animationValue  = rippleAnimationManager.GetProgress(i);
                    var animationSource = new Point(RADIOBUTTON_CENTER, RADIOBUTTON_CENTER);
                    var rippleBrush     = new SolidBrush(Color.FromArgb((int)((animationValue * 40)), ((bool)rippleAnimationManager.GetData(i)[0]) ? Color.Black : brush.Color));
                    var rippleHeight    = (Height % 2 == 0) ? Height - 3 : Height - 2;
                    var rippleSize      = (rippleAnimationManager.GetDirection(i) == AnimationDirection.InOutIn) ? (int)(rippleHeight * (0.8d + (0.2d * animationValue))) : rippleHeight;
                    using (var path = DrawHelper.CreateRoundRect(animationSource.X - rippleSize / 2, animationSource.Y - rippleSize / 2, rippleSize, rippleSize, rippleSize / 2))
                    {
                        g.FillPath(rippleBrush, path);
                    }

                    rippleBrush.Dispose();
                }
            }

            // draw radiobutton circle
            Color uncheckedColor = DrawHelper.BlendColor(Parent.BackColor, Enabled ? SkinManager.GetCheckboxOffColor() : SkinManager.GetCheckBoxOffDisabledColor(), backgroundAlpha);

            using (var path = DrawHelper.CreateRoundRect(boxOffset, boxOffset, RADIOBUTTON_SIZE, RADIOBUTTON_SIZE, 9f))
            {
                g.FillPath(new SolidBrush(uncheckedColor), path);

                if (Enabled)
                {
                    g.FillPath(brush, path);
                }
            }

            g.FillEllipse(
                new SolidBrush(Parent.BackColor),
                RADIOBUTTON_OUTER_CIRCLE_WIDTH + boxOffset,
                RADIOBUTTON_OUTER_CIRCLE_WIDTH + boxOffset,
                RADIOBUTTON_INNER_CIRCLE_SIZE,
                RADIOBUTTON_INNER_CIRCLE_SIZE);

            if (Checked)
            {
                using (var path = DrawHelper.CreateRoundRect(RADIOBUTTON_CENTER - animationSizeHalf, RADIOBUTTON_CENTER - animationSizeHalf, animationSize, animationSize, 4f))
                {
                    g.FillPath(brush, path);
                }
            }
            SizeF stringSize = g.MeasureString(Text, SkinManager.ROBOTO_MEDIUM_10);

            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            g.DrawString(Text, SkinManager.ROBOTO_MEDIUM_10, Enabled ? SkinManager.GetPrimaryTextBrush() : SkinManager.GetDisabledOrHintBrush(), boxOffset + 22, Height / 2 - stringSize.Height / 2);

            brush.Dispose();
            pen.Dispose();
        }