-1

I have Form1 which contains has background image with error message and with some buttons and shows up when some error happens. I have to make part of the Form1 transparent while the other part will contain an error message and it will be nontransparent. Here's some illustration.

enter image description here

The grey part of the Form1 must be say, 80% transparent. How can I achieve it?

So far I've tried to play with Opacitybut it makes the whole frame transparent. Please help me out of this I really need to make this today, Thanks a lot.

default locale
  • 13,035
  • 13
  • 56
  • 62
GugaMelkadze
  • 157
  • 1
  • 3
  • 11
  • how are you displaying the error message (with what control) – user3036342 Jul 25 '14 at 11:09
  • Thanks for reminding. I add a background image on my `Form1` , the image contains error code. I guess it makes task more complicated. – GugaMelkadze Jul 25 '14 at 11:14
  • You may want to search for `semi-transparent c# form`, once you know that - you can solve your task. The first result is [this](http://stackoverflow.com/a/13036218/1997232). – Sinatr Jul 25 '14 at 11:39
  • You can always workaround by having two forms, One semitransparent (Opacity=0.7f) the other centered above it. Synch the movable outer one with the other, titleless one in its move event – TaW Jul 25 '14 at 12:19
  • You are looking for the `UpdateLayeredWindow` function. It isn't going to be easy to make this work from WinForms. You'll be writing a lot of P/Invoke code, and judging from the way you asked this question, you're in well over your head. Do keep in mind that this kind of transparency rarely serves a useful function. The image you showed is making my eyes hurt. – Cody Gray - on strike Jul 25 '14 at 12:55
  • I showed image to make people understand better what I needed, not to satisfy your eyes ;) – GugaMelkadze Jul 25 '14 at 12:57
  • Related: [Render Translucent/Transparent Overlay](http://stackoverflow.com/questions/24261902/render-translucent-transparent-overlay) and [Splash-screen with alpha channels transparency/opacity in WinForms](http://stackoverflow.com/questions/851738/splash-screen-with-alpha-channels-transparency-opacity-in-winforms) – Cody Gray - on strike Jul 25 '14 at 13:02

1 Answers1

1

set BackColor and TransparencyKey same color

Vazgen Torosyan
  • 1,255
  • 1
  • 12
  • 26
  • Thanks. But this is not what I wanted. It makes the grey part of the form fully transparent. I want to make it transparent 70-80% . In other words I want to set opacity of this part to 70-80% – GugaMelkadze Jul 25 '14 at 11:31