使用colorpalatte更改图像或图形的背景颜色 [英] Change the backcolor of an image or graphics by using colorpalatte

查看:115
本文介绍了使用colorpalatte更改图像或图形的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Winforms应用程序中自定义图像。如果它试图在winforms应用程序中包含图像或绘制图像,我需要使用colorpalatte更改图像的颜色。

Is it possible to customize an image in a Winforms application. If it try to include an image or draw an image in winforms application, i need to change the color of the image using colorpalatte.

function change(args: ColorPickerEventArgs): void {
        document.getElementById('preview').style.backgroundColor = args.currentValue.rgba;
    }


在上面的JS代码中,他们检索了图像,并根据currentValue.rgba更改了图像的背景颜色。是否有可能在Winforms中实现相同的行为?

In the above JS code,they have retrieved the image and the background color of the image changes based on currentValue.rgba. Is it possible to achieve the same behavior in Winforms?

推荐答案


如果你的意思是 PictureBox 的背景颜色
面板
,然后在表单中插入 ColorDialog 并使用这样的代码(例如,点击按钮):

If you mean the background colour of PictureBox or Panel, then insert a ColorDialog to your form and use a code like this (on clicking a button, for example):


 


  
如果
ColorDialog1.ShowDialog = DialogResult.OK
然后


 


   
   PictureBox1.BackColor = ColorDialog1.Color

      PictureBox1.BackColor = ColorDialog1.Color


 


  
结束

If


 


也可以在C#中完成。


这篇关于使用colorpalatte更改图像或图形的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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