I can have them automatically arranged like a FlowLayoutPanel does.
But I can't use one because it will be on top and hide the images in
my pic's.
Well, you can use a FlowLayoutPanel
with a transparent background so it doesn't hide the other controls you have. How to do that? Well, this answer shows you how to make a transparent Panel
. You should be able to easily adjust it to work with a FlowLayoutPanel
using something like this:
Public Class TransparentFLP
Inherits FlowLayoutPanel
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H20 ''#WS_EX_TRANSPARENT
Return cp
End Get
End Property
Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
''#MyBase.OnPaintBackground(e) --> Don't uncomment this orelse
'it will cause the BackColor to be redrawn.
End Sub
End Class
- Add a new
Class
to your project.
- Paste the above code into it.
- Rebuild your project.
- Drop the new control from the top of the toolbox onto your form (instead of using the original
FlowLayoutPanel
).
- You're good to go.
P.S. I'm not sure about the use of your 4 panels, but you might consider using a TableLayoutPanel
instead.
Hope that helps :)