tengu77
asked on
Resizing the bottom panel
I have a user control with one container panel and two panel inside it and the bottom panel contains buttons,
My code look like this..
Me.Panel1 = New System.Windows.Forms.Panel
Me.Panel2 = New System.Windows.Forms.Panel
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Butto n
Me.Button2 = New System.Windows.Forms.Butto n
Me.Button3 = New System.Windows.Forms.Butto n
Me.Panel3 = New System.Windows.Forms.Panel
Me.Panel1.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.AutoSize = True
Me.Panel1.Controls.Add(Me. Panel3)
Me.Panel1.Controls.Add(Me. Panel2)
Me.Panel1.Location = New System.Drawing.Point(0, 3)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(719, 552)
Me.Panel1.TabIndex = 0
'
'Panel2
'
Me.Panel2.AutoSize = True
Me.Panel2.BackColor = System.Drawing.Color.Red
Me.Panel2.Controls.Add(Me. Button3)
Me.Panel2.Controls.Add(Me. Button2)
Me.Panel2.Controls.Add(Me. Button1)
Me.Panel2.Controls.Add(Me. Label5)
Me.Panel2.Controls.Add(Me. Label4)
Me.Panel2.Controls.Add(Me. Label3)
Me.Panel2.Dock = System.Windows.Forms.DockS tyle.Botto m
Me.Panel2.Location = New System.Drawing.Point(0, 511)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(719, 41)
Me.Panel2.TabIndex = 0
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(25, 15)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(39, 13)
Me.Label3.TabIndex = 0
Me.Label3.Text = "Label3"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(83, 15)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(39, 13)
Me.Label4.TabIndex = 1
Me.Label4.Text = "Label4"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(156, 15)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(39, 13)
Me.Label5.TabIndex = 2
Me.Label5.Text = "Label5"
'
'Button1
'
Me.Button1.Anchor = CType((System.Windows.Form s.AnchorSt yles.Top Or System.Windows.Forms.Ancho rStyles.Ri ght), System.Windows.Forms.Ancho rStyles)
Me.Button1.Location = New System.Drawing.Point(419, 15)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleB ackColor = True
'
'Button2
'
Me.Button2.Anchor = CType((System.Windows.Form s.AnchorSt yles.Top Or System.Windows.Forms.Ancho rStyles.Ri ght), System.Windows.Forms.Ancho rStyles)
Me.Button2.Location = New System.Drawing.Point(533, 15)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 4
Me.Button2.Text = "Button2"
Me.Button2.UseVisualStyleB ackColor = True
'
'Button3
'
Me.Button3.Anchor = CType((System.Windows.Form s.AnchorSt yles.Top Or System.Windows.Forms.Ancho rStyles.Ri ght), System.Windows.Forms.Ancho rStyles)
Me.Button3.Location = New System.Drawing.Point(632, 15)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(75, 23)
Me.Button3.TabIndex = 2
Me.Button3.Text = "Button3"
Me.Button3.UseVisualStyleB ackColor = True
'
'Panel3
'
Me.Panel3.AutoSize = True
Me.Panel3.Dock = System.Windows.Forms.DockS tyle.Fill
Me.Panel3.Location = New System.Drawing.Point(0, 0)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(719, 511)
Me.Panel3.TabIndex = 1
'
'UserControl4
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoS caleMode.F ont
Me.AutoSize = True
Me.Controls.Add(Me.Panel1)
Me.Name = "UserControl4"
Me.Size = New System.Drawing.Size(722, 558)
Me.Panel1.ResumeLayout(Fal se)
Me.Panel1.PerformLayout()
Me.Panel2.ResumeLayout(Fal se)
Me.Panel2.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents Button3 As System.Windows.Forms.Butto n
Friend WithEvents Button2 As System.Windows.Forms.Butto n
Friend WithEvents Button1 As System.Windows.Forms.Butto n
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Panel3 As System.Windows.Forms.Panel
but when I resize the form containing only this control, those button sand panels doesn't align correctly,
Thank you
My code look like this..
Me.Panel1 = New System.Windows.Forms.Panel
Me.Panel2 = New System.Windows.Forms.Panel
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Butto
Me.Button2 = New System.Windows.Forms.Butto
Me.Button3 = New System.Windows.Forms.Butto
Me.Panel3 = New System.Windows.Forms.Panel
Me.Panel1.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.AutoSize = True
Me.Panel1.Controls.Add(Me.
Me.Panel1.Controls.Add(Me.
Me.Panel1.Location = New System.Drawing.Point(0, 3)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(719, 552)
Me.Panel1.TabIndex = 0
'
'Panel2
'
Me.Panel2.AutoSize = True
Me.Panel2.BackColor = System.Drawing.Color.Red
Me.Panel2.Controls.Add(Me.
Me.Panel2.Controls.Add(Me.
Me.Panel2.Controls.Add(Me.
Me.Panel2.Controls.Add(Me.
Me.Panel2.Controls.Add(Me.
Me.Panel2.Controls.Add(Me.
Me.Panel2.Dock = System.Windows.Forms.DockS
Me.Panel2.Location = New System.Drawing.Point(0, 511)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(719, 41)
Me.Panel2.TabIndex = 0
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(25, 15)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(39, 13)
Me.Label3.TabIndex = 0
Me.Label3.Text = "Label3"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(83, 15)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(39, 13)
Me.Label4.TabIndex = 1
Me.Label4.Text = "Label4"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(156, 15)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(39, 13)
Me.Label5.TabIndex = 2
Me.Label5.Text = "Label5"
'
'Button1
'
Me.Button1.Anchor = CType((System.Windows.Form
Me.Button1.Location = New System.Drawing.Point(419, 15)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleB
'
'Button2
'
Me.Button2.Anchor = CType((System.Windows.Form
Me.Button2.Location = New System.Drawing.Point(533, 15)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 4
Me.Button2.Text = "Button2"
Me.Button2.UseVisualStyleB
'
'Button3
'
Me.Button3.Anchor = CType((System.Windows.Form
Me.Button3.Location = New System.Drawing.Point(632, 15)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(75, 23)
Me.Button3.TabIndex = 2
Me.Button3.Text = "Button3"
Me.Button3.UseVisualStyleB
'
'Panel3
'
Me.Panel3.AutoSize = True
Me.Panel3.Dock = System.Windows.Forms.DockS
Me.Panel3.Location = New System.Drawing.Point(0, 0)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(719, 511)
Me.Panel3.TabIndex = 1
'
'UserControl4
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!,
Me.AutoScaleMode = System.Windows.Forms.AutoS
Me.AutoSize = True
Me.Controls.Add(Me.Panel1)
Me.Name = "UserControl4"
Me.Size = New System.Drawing.Size(722, 558)
Me.Panel1.ResumeLayout(Fal
Me.Panel1.PerformLayout()
Me.Panel2.ResumeLayout(Fal
Me.Panel2.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents Button3 As System.Windows.Forms.Butto
Friend WithEvents Button2 As System.Windows.Forms.Butto
Friend WithEvents Button1 As System.Windows.Forms.Butto
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Panel3 As System.Windows.Forms.Panel
but when I resize the form containing only this control, those button sand panels doesn't align correctly,
Thank you
ASKER
Even if I say dock property to fill, When I resize,(minimize) these buttons overlap with the labels on the right.... I like to see All the labels as well as button when screen minimized
Please define what you mean by "minimized"...it's a USERCONTROL right?...
ASKER
I did addthis user control to a form and then minimize the form and then I like to resize to even smaller,
A minimized form isn't visible...what is the point of resizing your UserControl if the form is not even visible?
ASKER
I resolved it my self - I setthe form.minimimsize = size so that it cannot be minimized less than certain size.. an dmake sure my buttons are at the right location.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See this link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowfeatures.asp
"A minimized window is a window that has the WS_MINIMIZE style. By default, the system reduces a minimized window to the size of its taskbar button and moves the minimized window to the taskbar."
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowfeatures.asp
"A minimized window is a window that has the WS_MINIMIZE style. By default, the system reduces a minimized window to the size of its taskbar button and moves the minimized window to the taskbar."
ASKER
Very Goood, Thank you..
ASKER
hi Moderator.. I need help in awarding points here..
Thank you
Thank you
Set the Dock() property of Panel1 to Fill so that it changes size with the UserControl...