Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Groupbox not drawing Lines

Status
Not open for further replies.

VBdan

Programmer
Aug 29, 2003
2
US
I am rewriting my program after upgrading from VB6 to .net. (too much work.)
The problem I have is with the GroupBox lines when I resize. I have stripped the program way down
and added some buttons to increase and decrease the size of the GroupBox. There is nothing in the box (yet).
When I run the program it drops parts of the lines and at a random rate.
Can anyone help? Thank you (in advance). Here is the code...



Public Class form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()
initialize = True

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Command99 As System.Windows.Forms.Button
Friend WithEvents frame1 As System.Windows.Forms.GroupBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Command99 = New System.Windows.Forms.Button
Me.frame1 = New System.Windows.Forms.GroupBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Command99
'
Me.Command99.Location = New System.Drawing.Point(632, 56)
Me.Command99.Name = &quot;Command99&quot;
Me.Command99.Size = New System.Drawing.Size(128, 40)
Me.Command99.TabIndex = 5
Me.Command99.Text = &quot;Stop&quot;
'
'frame1
'
Me.frame1.Location = New System.Drawing.Point(17, 17)
Me.frame1.Name = &quot;frame1&quot;
Me.frame1.Size = New System.Drawing.Size(330, 330)
Me.frame1.TabIndex = 7
Me.frame1.TabStop = False
Me.frame1.Text = &quot;Vendors&quot;
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(432, 152)
Me.Button1.Name = &quot;Button1&quot;
Me.Button1.Size = New System.Drawing.Size(56, 56)
Me.Button1.TabIndex = 8
Me.Button1.Text = &quot;+10&quot;
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(432, 216)
Me.Button2.Name = &quot;Button2&quot;
Me.Button2.Size = New System.Drawing.Size(56, 48)
Me.Button2.TabIndex = 9
Me.Button2.Text = &quot;-10&quot;
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(432, 272)
Me.Button3.Name = &quot;Button3&quot;
Me.Button3.Size = New System.Drawing.Size(56, 48)
Me.Button3.TabIndex = 10
Me.Button3.Text = &quot;+1&quot;
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(432, 328)
Me.Button4.Name = &quot;Button4&quot;
Me.Button4.Size = New System.Drawing.Size(56, 48)
Me.Button4.TabIndex = 11
Me.Button4.Text = &quot;-1&quot;
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(440, 120)
Me.TextBox1.Name = &quot;TextBox1&quot;
Me.TextBox1.Size = New System.Drawing.Size(208, 20)
Me.TextBox1.TabIndex = 12
Me.TextBox1.Text = &quot;TextBox1&quot;
'
'form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(712, 605)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.frame1)
Me.Controls.Add(Me.Command99)
Me.Name = &quot;form1&quot;
Me.Text = &quot;Form1&quot;
Me.ResumeLayout(False)

End Sub

#End Region
Private Sub Command99_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command99.Click
End
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
tmp3 = tmp3 + 10
tmp4 = tmp4 + 10
frame1.Size = New Size(tmp3, tmp4)
System.Windows.Forms.Application.DoEvents()
frame1.Refresh()
System.Windows.Forms.Application.DoEvents()
TextBox1.Text = &quot; &quot; & tmp3 & &quot; , &quot; & tmp4
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
tmp3 = tmp3 - 10
tmp4 = tmp4 - 10
frame1.Size = New Size(tmp3, tmp4)
System.Windows.Forms.Application.DoEvents()
frame1.Refresh()
System.Windows.Forms.Application.DoEvents()
TextBox1.Text = &quot; &quot; & tmp3 & &quot; , &quot; & tmp4
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
tmp3 = tmp3 + 1
tmp4 = tmp4 + 1
frame1.Size = New Size(tmp3, tmp4)
System.Windows.Forms.Application.DoEvents()
frame1.Refresh()
System.Windows.Forms.Application.DoEvents()
TextBox1.Text = &quot; &quot; & tmp3 & &quot; , &quot; & tmp4
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
tmp3 = tmp3 - 1
tmp4 = tmp4 - 1
frame1.Size = New Size(tmp3, tmp4)
System.Windows.Forms.Application.DoEvents()
frame1.Refresh()
System.Windows.Forms.Application.DoEvents()
TextBox1.Text = &quot; &quot; & tmp3 & &quot; , &quot; & tmp4
End Sub

Private Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
frame1.Size = New Size(400, 400)
End Sub
End Class




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top