Resizing tabpage

cannorth

Member
Joined
Oct 22, 2010
Messages
15
Programming Experience
10+
Hello,

I have a tab control and I want to increase the size of a tabpage. I can resize the tab control boundaries, but the tabpage doesn't change. How can I resize a tabpage?

Thanks,

cannorth
 
Do you actually mean the controls on the TabPage, rather than the TabPage itself? Can you maybe post a couple of screen shots to illustrate the problem? Please just attach them to your post.
 
Screen shot

Hello,

No, not the controls. The tabpage itself. Attached should be a screen shot in PDF format. Notice the bottom edge of the tabpage is still above the Help button.

cannorth
 

Attachments

  • Doc1.pdf
    90.2 KB · Views: 29
Hi cannorth,
It is still possible to make your own AutoSize function to the TabControl.
For example, if I am dragging some button into my TabControl.

Private Sub button1_MouseDown(sender As Object, e As MouseEventArgs)
	button1.DoDragDrop(button1.Name, DragDropEffects.Copy)
End Sub

Private Sub tabControl1_DragEnter(sender As Object, e As DragEventArgs)
	e.Effect = DragDropEffects.Copy
End Sub

Private Sub tabControl1_DragDrop(sender As Object, e As DragEventArgs)
	Dim button As New Button()
	button.Text = e.Data.GetData(GetType(String)).ToString()

	Dim newPos As Point = PointToClient(New Point(e.X, e.Y))

	button.Left = newPos.X - tabControl1.Left
	button.Top = newPos.Y - tabControl1.Top
	tabControl1.TabPages(0).Controls.Add(button)
	If button.Top + button.Height > tabControl1.TabPages(0).Height Then
		'If the button is going out of the TabControl

		tabControl1.Height = tabControl1.Height + (button.Top + button.Height - tabControl1.TabPages(0).Height)
		tabControl1.TabPages(0).Invalidate()
	End If
End Sub




Hope this helps,
Regards
 
Last edited by a moderator:
Hi cannorth,
It is still possible to make your own AutoSize function to the TabControl.
For example, if I am dragging some button into my TabControl.
Auto-converted your code to VB.Net. This is a VB.Net forum. Post code in VB.Net language for future.
 
Back
Top