作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以使用渐变颜色画一条线?
我希望能够绘制一条直线或曲线(如果可能),其中线的一端是蓝色,另一端是红色。
此外,每行可能需要多个渐变,例如颜色从蓝色 -> 绿色 -> 红色。我认为这可能只是由绘制在一起的多条渐变线组成。
最佳答案
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics graphicsObject = e.Graphics;
using (Brush aGradientBrush = new LinearGradientBrush(new Point(0, 0), new Point(50, 0), Color.Blue, Color.Red))
{
using (Pen aGradientPen = new Pen(aGradientBrush))
{
graphicsObject.DrawLine(aGradientPen, new Point(0, 10), new Point(100, 10));
}
}
}
关于c# - 用渐变颜色绘制一条线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/576861/
如何迭代(一行)分割函数给我的每个类? 我试过这个: 编辑(抱歉) $("p").attr("class").split(' ').each (function (i,n){alert(n)}
我有一条垂直线和一条水平线,当我动态调整我的 Canvas 父级时,我想调整它们的大小。 (地标) 我希望水平线始终距 Canvas 的左右边界 25 处,距底部边界 13 处。 垂直线也是如此,距上
我有一个 y 变量,我试图在图形的顶部和底部针对两个相关的 x 轴绘制它(例如 y="立方体中的事物数",x1="立方体的边长", x2="立方体的体积")。我在 numpy 数组中有 y、x1、x2
我想画一条简单的水平线,并在这条线 flex 的地方制作动画。我有这个动画的视频。你能给我一些建议如何开始以及我必须使用哪个 js/css 吗? 都是关于矩形底部的线: http://www.stop
我是一名优秀的程序员,十分优秀!