Opacity 0, paint on Form

M

Martin Madreza

hi,

i want to paint on a for wich opacity is 0

is it possible to paint e.g. an rectangel with an black border

or is it impossible to paint on a Form with opacity = 0 and it's the
total false approach?

thanks

Martin Maderza
 
B

Bob Powell [MVP]

In this case you'll want to use the LayeredWindow API. Available via
p/invoke, this will enable you to draw on a form and show only the parts you
want to see. I am going to see if I can find some code to post later.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
S

Stoitcho Goutsev \(100\)

Martin, I don't think you can do that.

As far as I knoe when the opacity is changed the windows start drawing as
layered window. In this case the whole output is redirected to a bitmap and
the the bitmap blended with the desktop with the specified opacity. Which
means that if the windows is fully transparent nothing will be visible.

If you are trying to cut a form to a non rectangulare or whatever shape I'd
suggest to use Form's (Control's actually) Region property to set a new
shape for the form. This way even the application window may have holes in
it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top