I'm creating a custom control panel to replace the top border control panel/box. I start with a panel that docks at top of form, and add 3 pictureboxes, with light and dark colors, for when mouse enters. (optional 4th for docking options) My problem is the red_pb ("Form Closing" picturebox) I can't seem to conjure up ANY code that will allow me to control a future parent form. This will also be a problem in the SizeMode-Normal/SizeMode-Maximized (yellow_pb), as well as the Minimize Form control (green_pb). The entire reason for the existance of the custom panel is to control the parent form's geometrics. (And to give my own creations a noticable identifier. :-) )

I have an event handler: Private Sub red_pbClick(sender As Object, e As EventArgs) to handle the click event.

I have tried :
ParentForm - nope...
Parent.Form - nope...
Form1 - nope...
Form = Form1 - nope...

I have no idea how to control a form that does not yet exist.

Any Ideas?

P.S. I did use AddHandler/AddressOf in the Public Sub New() - That part is a go.
For those who don't know of me, I am a hobbyist. I have no formal training, just books, and experimentation...

Recommended Answers

All 5 Replies

Do you mean a Child form?
Why would one create a Parent form from the first form on the screen and controlling it from the first form. I see use in
that.
If you want to give a personal touch to your forms, it is better to design a logo or somthing like that.

Use Form.ActiveForm

'close button
Form.ActiveForm.Close()
'maximize button
Form.ActiveForm.WindowState = FormWindowState.Maximized
'minimize button
Form.ActiveForm.WindowState = FormWindowState.Minimized

oussama 1 That's exactly what I was looking for! Thank you very much! :-)

Now I need to find out how to mark your answer as Correct for my needs...

ddanbe - Thanx for your input, but I don't think you fully understood what I meant. My bad, I'm not really good at explaining things. I have a lot of trouble there.

I want my personal projects to be eye catchers to people instantly, while at the same time, have a 4th light (docking light) as an option. This will dock the form to the right side, or top of screen, at which time a 5 px "slider" control panel remains exposed at all times. When the mouse cursor enters the "Slider control", the form slides out to a preset size, which is resizable, if necessary. When docked, the form becomes Topmost = True. It will slide back into the side or top, when the cursor leaves the form.(except for the 5 px panel, which remains visible as long as the program runs from a docked state.)

Clicking the blue light again will "undock" the form, and it returns to it's previous state, size and position - no longer TopMost.

Forms that do not dock, will not have the forth light, only the three default lights. "DockLight" is a Boolean in the Properties window, for that purpose.

oussama 1 That's exactly what I was looking for! Thank you very much! :-)

Now I need to find out how to mark your answer as Correct for my needs...

oussama 1 That's exactly what I was looking for! Thank you very much! :-)

Now I need to find out how to mark your answer as Correct for my needs...

ddanbe - I don't think you understood my intentions, or wishes for this form project. Sorry, it's my bad. I'm not good at explaining myself.

There is a lot more to this idea than just the asthetics. I want the form to have an optional 4th light for docking top or right. It will look just like the other 3 lights, except for its color. (It's DarkBlue / Light blue - when mouse enters) "BlueLight" is a boolean in the Properties window, for the optional blue light. Then there is also "DockArea" for Right, or Top. This must be selected at design time, at least for now...

The 4th light docks also makes it topmost when docked. It slides in and out when mouse enters the 5px slider control. When docked "In", only the slider control shows.

Windows 8.1 doesn't have "Aero" or rounded corners on forms, but mine will have both. (I liked Windows 7 for that ! :-) )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.