• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PaintEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnPaint

        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);
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:28,代码来源:RainbowButton3.cs


示例17: ModuleUsageVisualizerForm_Paint

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


示例18: GetThumbnail

 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();
             }
         }
     }
 }
开发者ID:kunalgrover05,项目名称:Windows-Photo-viewer,代码行数:27,代码来源:Form1.cs


示例19: Draw

        /// <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)
            });
        }
开发者ID:manuth,项目名称:EnhanceForm,代码行数:30,代码来源:CloseButton.cs


示例20: OnPaint

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Pair类代码示例发布时间:2022-05-24
下一篇:
C# Paint类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap