当前位置: 首页>>代码示例>>C#>>正文


C# PaintEventArgs类代码示例

本文整理汇总了C#中PaintEventArgs的典型用法代码示例。如果您正苦于以下问题:C# PaintEventArgs类的具体用法?C# PaintEventArgs怎么用?C# PaintEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PaintEventArgs类属于命名空间,在下文中一共展示了PaintEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Form1_Paint

        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);

            }

        }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:25,代码来源:Form1.cs

示例2: RotateImage

        /// <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));

        }
开发者ID:suas-anadolu,项目名称:groundstation,代码行数:42,代码来源:InstrumentControl.cs

示例3: Form1_Paint

        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));
        }
开发者ID:allen1759,项目名称:NTNU103-2_Metaheuristics_Final_Test,代码行数:26,代码来源:Form1.cs

示例4: OnPaint

        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);
            //    }
            //}
        }
开发者ID:pdoh00,项目名称:Sandbox,代码行数:33,代码来源:Form1.cs

示例5: DrawGraphics

        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);
        }
开发者ID:JeremiahZhang,项目名称:AKA,代码行数:7,代码来源:Program.cs

示例6: Paint

 public override void Paint(PaintEventArgs pe)
 {
     if (((this._item is ToolStripControlHost) && this._item.IsOnDropDown) && (!(this._item is ToolStripComboBox) || !VisualStyleRenderer.IsSupported))
     {
         this._item.Invalidate();
     }
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:7,代码来源:ToolStripItemGlyph.cs

示例7: Form1_Paint_1

 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();
 }
开发者ID:TStudioZ,项目名称:Olympics-2013,代码行数:7,代码来源:Form1.cs

示例8: GridControl_Paint

		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);
		}
开发者ID:w01f,项目名称:VolgaTeam.Dashboard,代码行数:29,代码来源:GridDragDropHelper.cs

示例9: OnPaint

			/// <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);
			}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:NuGenDirectorySelector.DropDownButton.cs

示例10: OnPaint

 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);
 }
开发者ID:JackWangCUMT,项目名称:KUI,代码行数:7,代码来源:FlatForeSeperator.cs

示例11: OnPaint

        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);
            }
        }
开发者ID:neolu,项目名称:MissionPlanner,代码行数:25,代码来源:Coords.cs

示例12: panel1_Paint

        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);
        }
开发者ID:leocheang422,项目名称:win-sshfs,代码行数:7,代码来源:AboutForm.cs

示例13: OnPaint

        protected override void OnPaint(PaintEventArgs pe)
        {
            // TODO: Add custom paint code here

            // Calling the base class OnPaint
            base.OnPaint(pe);
        }
开发者ID:fernandolucasrodriguez,项目名称:qit,代码行数:7,代码来源:FontEditor.cs

示例14: RenderStuff

        /// <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!
        }
开发者ID:JeremiahZhang,项目名称:AKA,代码行数:11,代码来源:MouseMove.cs

示例15: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     if (background != null)
         e.Graphics.DrawImage(background, 0, 0);
     else
         base.OnPaint(e);
 }
开发者ID:north0808,项目名称:haina,代码行数:7,代码来源:SelectPictureDialog.cs


注:本文中的PaintEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。