申请表格不透明度后能否获得真实色彩? [英] Can I Get Real Color After Apply Form Opacity?

查看:97
本文介绍了申请表格不透明度后能否获得真实色彩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Grahpics类(GDI +)绘制矩形.
而且我将表单的不透明度设置为30%.

这是我的代码.

I''m Drawing Rectangle using `Grahpics` Class(GDI+).
And I have set the form''s opacity to 30%.

this is my code.

Graphics gr = e.Graphics;
Pen pen = new Pen(new SolidBrush(Color.FromArgb(255,Color.Red)),1);
gr.Clear(this.BackColor);
gr.DrawRectangle(pen, rect);


但是..笔的不透明度也是30%!

我很想要原始颜色.


but.. Pen Opacity is 30% too!

I''m so want the original color.

how can i do?

推荐答案

使用Windows窗体是不可能的.部分透明的窗体不能具有不透明的控件(或图形). 您可以使用两种形式的方法,一种是完全透明的,而另一种部分透明的表单具有不透明的控件.您还可以使用不透明窗体的Windows透明键隐藏不想要的区域,或仅使用WPF即可.希望对您有帮助
It''s not possible with windows forms. A partially transparent form cannot have opaque controls (or drawings). You could use two form approach, one fully transparent with opaque controls over another partially transparent form. You can also use windows transparency key of opaque form to hide unwanted area Or Use simply use WPF. Hope this helps


这篇关于申请表格不透明度后能否获得真实色彩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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