Transparent control or user control in vb.net - vb.net

I am trying to make a transparent control with child controls that are visible and opaque.
I have added a panel control to the main form via code in the form load event. In this I am adding five buttons as child controls like: panel.controls.add(). To all of these, I have set backcolor=color.transparent.
When I run this program, the button background shows the background of the next button in the panel. If I open a child form, then I can see labels on the child form as the background of the panel.
I want to make container panel control completely transparent, so I can see the main form through it. How can this be achieved?
When the form loads, you can see neighbor buttons behind the actual buttons
"Perform Check" is a label on a child form which I opened right before taking this picture.
: "Check Cases and Combinations" is a button on a child form which I opened right before I took this picture.
How can I make it truly transparent? Why doesn't the background of the panel control refresh with the main form background? The panel sort of "keeps" whatever happens on the main form and shows it as a background.

I found out there some issues with setting controls that are transparent and on top of other controls in the main form. They take the background of the container form, whether or not there is any control in between. I used WPF form instead of the panel and it worked perfectly.

Related

MDIContainer Grey Background (VB.NET)

My application has a main form which is the parent of ALL MDIChild forms. It has its own cool little background.
I want to have 4 buttons on the Main Form that load a different form in the MDI Container. My form is transparent so all the little designs ive made for my picture box buttons overlap the main form nicely UNTIL Visual Studio paints that stupid background grey when you set the IsMDIContainer property to true. The buttons now have greyspots (as they are transparent and its like it bleeds through the background image and into the greyspot of the MDI Container).
I've googled this for hours and no one has answer. I want the buttons to be transparent to the Main Forms BG Image and NOT the grey MDIContainer BG.
Using VS2019, VB.NET The image above shows Form1 with the background and an overlayed Form 5 with all the controls. I wanted the 2 cloud looking buttons at the bottom (which are supposed to be on the Parent Form 1) to not have that grey box around them but to be transparent to the Form1 background image.
First, you could use this code under your mdi parent load event:
For Each ctl As Control In Me.Controls
If TypeOf ctl Is MdiClient Then
ctl.BackColor = Me.BackColor
End If
Next ctl
but it will work only if you set a plain color (e.g. only red or orange or any other color) as backcolor to this mdi parent form, but doesn't work with images.
you must know that mdi parent forms are designed to show only the child forms, so if you want a background image for your form just use a regular form then add a panel or multiple panels to it instead of your mdi child forms which will do the same job plus enabling controls transparency.
for your information, mdi child forms is a very old technique which is rarely used today.

Mdi Child Form Location Changes after minimizing

I had an vb.net desktop application which uses MDIForm.In that application all the child formes are in maximized state.When i am open any form and minimized,then that child form gets minimized and no problem for for the first time.Then i have to maximize and minimize the same form then there is an automatic vertical scroll appears on MDI Form.And also the location of child form goes downwards.Similar Problem happends for other forms also.
see the attached image
enter image description here

Is control location relative to visible area of form when form has scroll bar?

I have a VB.NET form that dynamically creates a set of controls. If there are too many controls to view on the form, the form will show a scroll bar. (It is an autoscroll form.)
The user can scroll down and click a button which causes the form to change dramatically. It destroys all controls and draws new ones based on user input.
I've noticed that if the user is scrolled to the bottom of the form and click the button, when I destroy and create new controls they aren't located where I want them. It seems to put them relative to the visible portion of the form rather than the top of the top.
Example:
checkbox1.top = 50
checkbox1.left = 15
If the scrollbar is all the way at the bottom, the checkbox should be placed above the visible part of the form. Instead, it is drawn 50 pixels from the top of what I can see.
Please help. How do I make it place the control at an absolute location, rather than being relative to the current position of the scrollbar?
You have to compensate for the scroll position of the container control.
If a panel, then it would look like this:
checkbox1.Top = Panel1.AutoScrollPosition.Y + 50
Alternatively, you could just use a FlowLayoutPanel control, which would handle the placement of the controls for you.

VB.NET MDI Children Focus only on Title Bar Click

One would imagine that clicking anywhere within the MDI Child form (or on any control) will focus that form. But in my application I can only focus a MDI child by clicking on its titlebar, which is an abnormal behavior on the part of the user. My forms are filled with either controls or panels so I don't have the luxury of just "clicking on the form." But clicking anywhere within it should focus it.
I haven't been able to find a solution to this problem although it seems others are having it as well.
I figured it out. If you are setting the child form mdiParent property after you are calling Form.Show then it messes up the focus of all the child forms.
When I set mdiParent property of the form first and then call .Show(), everything works perfectly as expected.

Draw a line above a docked control

I have a borderless form that I'm "docking" onto the top edge of my screen. Inside of the form, I'm placing a single toolstrip control, which docks across the entire form -> (picture the taskbar to get an idea of what I'm talking about).
Because the borderless form has no edge to it, I wanted to draw a black line along the bottom edg` of the form to differentiate the form from the windows or desktop behind it.
The problem that I'm facing is that`the toolstrip will not move "behind" the line when it's docked, no matter how I order the control layers.
I've tried programatically sending the control to back to no avail either.
Any ideas on how to get the line to show above the docked toolstrip?
Dock another control to the top that displays like a black line (e.g. a Label with a black background and a height of 1). Insert your ToolStrip after you have docked the Label. It will dock just below the Label.