Windows Aero: What color to paint to make “glass” appear?

让人想犯罪 __ 提交于 2019-11-27 18:09:37
Color fillColor = Color.FromArgb(0, 0, 0, 0); //(a, r, g, b)
e.Graphics.FillRectangle(new SolidBrush(fillColor), e.ClipRectangle);

This is actually rather amusing. It means that you are drawing something completely transparent - so this changes absolutely nothing! :-)

Guess: if black (0,0,0) should mean "glass", how about drawing (1,1,1) to get (almost) black?

One of the blog posts that you linked to above has a discussion about this. The native solution was to use SetLayeredWindowAttributes to switch the color key away from black.

Try setting the TransparencyKey of the form to Color.FromArgb(1,1,1) (or some other suitable value of your choosing) then setting the backcolor of the form (or the part you want to be glass) to that same value.

That's how I got it to work without it making all of my black text transparent/glass.

I couldn't ever figure out how to paint the "glowy" text on the glass though. It always had a black rectangle behind it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!