渐变色,不使用渐变色 [英] Gradual change in color, without using Gradient

查看:191
本文介绍了渐变色,不使用渐变色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



尝试了很多编码并在网上搜索后,我希望能在这里找到答案。



我的C#/ WPF应用程序需要用户在不同方向上连续绘制线条,以便每条线路连接到前一条线路。现在,我已经实现了一个计时器来每隔几毫秒更改一行的颜色。



到目前为止,代码按预期工作,除了颜色是突然改变。如何使线条像渐变一样改变颜色?



我没有找到有用的渐变,因为我在运行时绘制线条。相反,我需要更改计时器中的单个像素颜色,但是要再次逐渐改变。



有什么建议吗?

解决方案

例如,请参阅:以编程方式生成渐变?在Stack Overflow [ ^ ]。

Hi all,

after trying a lot of coding around and searching in the web, I am hoping to find an answer here.

My C#/WPF application needs the user to draw lines continuously in different directions, such that each line is connected to the previous one. Now, I have implemented a timer to change the color of the lines every few Milli seconds.

So far, the code is working as expected, except that the colors are changing abruptly. How can I make the lines change color as in a gradient?

I didn't find gradients useful, as I am drawing the lines at run time. Instead, I need to change the individual pixel colors within the timer, but again in a gradual manner.

Any suggestions, please?

解决方案

See, for instance: "Generating gradients programmatically?" at Stack Overflow[^].


这篇关于渐变色,不使用渐变色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆