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

后端 未结 3 861
走了就别回头了
走了就别回头了 2020-12-04 18:09

What color must i paint in the client area in order to make glass appear?

i\'ve extended the frame of my form into the client area using:

Dw         


        
相关标签:
3条回答
  • 2020-12-04 18:22
    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?

    0 讨论(0)
  • 2020-12-04 18:45

    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.

    0 讨论(0)
  • 2020-12-04 18:48

    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.

    0 讨论(0)
提交回复
热议问题