c# WinForms: Make part of the Form transparent - c#

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.
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.

set BackColor and TransparencyKey same color

Related

Having problem with PictureBox on Transparent form

i'm coming with you cause i've a problem with a PNG transparency over a transparent Form in C#.
i don't know how this problem is called, but i've take you a screen : https://i.ibb.co/xj37y7M/Capture.png.
For my main for, i've just applied a TransparencyKey with the same color as it own background.
For my picture it doesn't had any background.
Thank a lot for your help !

How to make a clickable, transparent, and borderless form?

I'm trying to place a transparent and borderless child (WinForm) form on top of another child (WinForm) form that is opaque, but I'd like to retain the ability to directly click on the transparent form. There are a few answers on the web regarding making a transparent form that can be clicked through, but I want to make one that I can click on.
I've found this answer, which shows that setting my transparent form's BackColor and TransparencyKey to something specific like Color.Red achieves the desired behavior. However based on this answer, it seems this behavior between certain Colors and TransparencyKey may actually be a long-running bug.
Ideally I don't want to rely on a bug to achieve a desired effect. What would be a more "appropriate" approach for making a clickable, transparent, and borderless (WinForm) form?
Update (Additional Context):
I'm basically creating a screen pixel previewer for color data extraction.
Overlay forms containing captured bitmap(s) of the screen area.
Another form that gives a visual indicator for the pixel area being previewed (small black box in the below snapshot). This form is placed above the bitmap forms. I have this form as transparent (to see through to the below bitmaps), but I still want to be able to click on it for event processing.
Without the TransparencyKey = BackColor = Color.Red trick, clicking within the small black box causes focus to move to the below bitmap form, which then covers up the small box form and the preview window showing the zoomed view. The purpose of the click is to capture the cursor position for additional processing. I can work around this by immediately giving focus back to the small box + preview forms, but that occasionally causes flicker.

Creating a hexagonal login form with a transparent / blurry border

right now I'm working on the new design for our .net software and I'm completely stuck at the login form. What I need is a form that is a hexagon with a transparent blurred border.
The hexagon form isn't the problem (I achieved this via the transparenceKey property), where I'm stuck is the blurred transparent border.
If you have an idea how to achieve this (best would be on Windows 7, 8 and 10, but right now I take anything) I would be glad if you could point me in the right direction. So far I tried the opacity property and the PerPixelAlphaForm from here but couldn't get good results.
I uploaded two pictures to this question: the first shows the conecept of our designer, so this is how it SHOULD look like. The second image shows my work so far (the labels for username and password are missing in that picture, but you get the idea).
Thanks in advance for any help you guys can give me.

How can I create a transparent System.Windows.Forms.Panel on top of two other already existing Panels then draw a line on my transparent panel?

I'm writing a form in C# and have several panels. I need to draw a line between two of the panels. I've found online several ways to go about this, the most promising appears to be to create a third panel, make it transparent, place it on top of my original panels and draw the line here.
I'm not able to get the panel to be transparent, even if I set its BackColor and ForeColor properties to transparent (in code or in design view of VS).
Any ideas on how to make the panel itself transparent (or not Visible) but have the line I draw on it still visible on top of everything else?
Thanks in advance.
No, it's transparent. See this by giving the form's BackgroundImage a value. You'll see it through the transparent panel. Of course, that's not the kind of transparency you want, you want stacking effects to work. There is no direct support for that.
If you want layers to work then don't use controls. Use the Paint event to draw. Now there's no problem, if you want transparency then just don't paint. Draw a line across an image simply by drawing the image first. This is also the rendering model of WPF.
You can actually do this pretty easily as your own UserControl. Here's a code example:
Drawing on top of controls inside a panel (C# WinForms)
This is similar to what you were originally attempting to do, only instead of drawing a line on top of a transparent panel, this code creates an irregularly-shaped user control (which happens to be in the irregular shape of a line).

How do I scrape what a transparent panel shows into a bitmap?

Question:
How do I scrape what a transparent panel shows into a bitmap?
Background:
I need to make a form that sits on top of everything and blurs part of the screen but doesn't stop the user from interacting with it. Odd... I know.
I created a form and added a panel to it. I then set the set background color of the panel to red. Then set the form's TransparentKey property to red and topmost = True.
So now I have a transparent panel. Cool. I can interact with the app below it. Cool. Now I just need to add the blur. I would like to take what is showing on panel1 and blur it then display on panel2 that sits over the top of panel1. Or at least that is the idea.
Important detail:
DrawToBitmap() just shows the red background.
This is running on XP.
Yes, DrawToBitmap(). But not on the transparent panel, on the one that's underneath it. If that 'panel' isn't actually yours then you have to use Graphics.CopyFromScreen().
Not sure what you intend to do with it, but drawing the blurred image in the transparent panel will make it non-transparent and you cannot interact with the underlying window anymore. Also, don't use Red, you'll get unintended transparency if the underlying window contains any red. Color.Fuchsia is a good choice, it is a fuchsed-up color.

Categories