为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

C#怎么解决带透明度画笔的“青蛙卵”现象速度仍然流畅

2017-10-11 4页 doc 15KB 14阅读

用户头像

is_729658

暂无简介

举报
C#怎么解决带透明度画笔的“青蛙卵”现象速度仍然流畅C#怎么解决带透明度画笔的“青蛙卵”现象速度仍然流畅 C#如何解决带透明度画笔的“青蛙卵”现象,速度仍然流畅, 我用GDI+做带有透明度的画笔,实现后出现“青蛙卵”现象,目前有方法解决,但是速度不流畅,会滞后,希望有高人能把青蛙卵解决了 ,同时速度又不受影响的。 下面贴了代码 只是实现带透明度功能。需要解决有透明度时,不会出现青蛙卵,速度也不受影响。 using System; using System.Collections.Generic; using System.ComponentModel; using...
C#怎么解决带透明度画笔的“青蛙卵”现象速度仍然流畅
C#怎么解决带透明度画笔的“青蛙卵”现象速度仍然流畅 C#如何解决带透明度画笔的“青蛙卵”现象,速度仍然流畅, 我用GDI+做带有透明度的画笔,实现后出现“青蛙卵”现象,目前有方法解决,但是速度不流畅,会滞后,希望有高人能把青蛙卵解决了 ,同时速度又不受影响的。 下面贴了代码 只是实现带透明度功能。需要解决有透明度时,不会出现青蛙卵,速度也不受影响。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace Alpha_Pen { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Point startPoint,secondPoint; bool drawMove; Pen pen; Bitmap bit; Graphics g; private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { startPoint = new Point(e.X, e.Y); drawMove = true; } } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (drawMove) { pen = new Pen(Color.FromArgb(128,255,0,0),20); pen.StartCap = LineCap.Round; pen.LineJoin = LineJoin.Round; pen.EndCap = LineCap.Round; secondPoint = new Point(e.X,e.Y); g.DrawLine(pen,startPoint.X,startPoint.Y,secondPoint.X,secondPoint.Y); startPoint = secondPoint; pictureBox1.Invalidate(); } } private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { drawMove = false; } private void pictureBox1_Paint(object sender, PaintEventArgs e) { if (bit != null) { e.Graphics.DrawImage(bit, 0, 0); } } private void Form1_Load(object sender, EventArgs e) { pictureBox1.Width = 1920; pictureBox1.Height = 1080; bit= new Bitmap(pictureBox1.Width, pictureBox1.Height); g = Graphics.FromImage(bit); } } } ------解决-------------------------------------------------------- 楼主~ 你可以在paint事件里实时刷新改成局部刷新,整个全部刷新速度会慢。 你可以根据第一点和第二点两点确定一个矩形,然后在paint中只刷新改矩形区域~
/
本文档为【C#怎么解决带透明度画笔的“青蛙卵”现象速度仍然流畅】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索