C
Colin McGuire
I apologize for posting yet another scrollbar question. Here is my
code. All I want is for a diagonal line to appear from coordinates
(0,0) to (width,height) in a usercontrol regardless of whether the
user autoscrolls the usercontrol (other things that are on the
usercontrol I want to scroll, but haven't included any here).
Here are the steps to reproduce my problem.
1. Launch Visual Studio and create a new Windows
application with "Form1".
2. Paste the following in (remember to include
your "Windows Form Designer generated code).
3. Run - instructions are in the program that runs.
I am using "Microsoft Development Environment 2003, Version 7.1.3088".
I am using "Microsoft .NET Framework 1.1, Version 1.1.4322"
Thank you for your patience with me.
Colin
Public Class Form1
Inherits System.Windows.Forms.Form
'======================
' Windows Form Designer generated code
' (INCLUDE HERE FOR FORM1 FROM YOUR IDE, NOT POSTED HERE)
'======================
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Protected Overrides Sub OnPaint(ByVal p As PaintEventArgs)
MyBase.OnPaint(p)
p.Graphics.DrawLine(New Pen(Color.Black), _
clientRectangle.Width, _
ClientRectangle.Height, _
0, 0)
End Sub
Private Sub UserControl1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Me.BackColor = Color.Yellow
End Sub
End Class
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim uc As New UserControl1
uc.Location = New Point(0, 0)
uc.Size = New System.Drawing.Size(New Point(100, 100))
uc.BackColor = Color.Yellow
uc.AutoScroll = True
uc.AutoScrollMinSize = New Size(New Point(200, 300))
uc.Visible = True
Me.Controls.Add(uc)
Size = New Size(New Point(300, 300))
Dim lb As New Label
lb.Location = New Point(0, 150)
lb.Size = New Size(290, 80)
lb.Text = "1.Move the scrollbars,the diagonal line isn't" + _
" drawn from(0,0) to (width,height). 2.Minimize" + _
" this form. 3. Restore the form size,now the " + _
"line does go from (0,0) to (width,height). " + _
"Why, why isn't the diagonal line and " + _
"control background cleared as you scroll?"
Me.Controls.Add(lb)
End Sub
End Class
code. All I want is for a diagonal line to appear from coordinates
(0,0) to (width,height) in a usercontrol regardless of whether the
user autoscrolls the usercontrol (other things that are on the
usercontrol I want to scroll, but haven't included any here).
Here are the steps to reproduce my problem.
1. Launch Visual Studio and create a new Windows
application with "Form1".
2. Paste the following in (remember to include
your "Windows Form Designer generated code).
3. Run - instructions are in the program that runs.
I am using "Microsoft Development Environment 2003, Version 7.1.3088".
I am using "Microsoft .NET Framework 1.1, Version 1.1.4322"
Thank you for your patience with me.
Colin
Public Class Form1
Inherits System.Windows.Forms.Form
'======================
' Windows Form Designer generated code
' (INCLUDE HERE FOR FORM1 FROM YOUR IDE, NOT POSTED HERE)
'======================
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Protected Overrides Sub OnPaint(ByVal p As PaintEventArgs)
MyBase.OnPaint(p)
p.Graphics.DrawLine(New Pen(Color.Black), _
clientRectangle.Width, _
ClientRectangle.Height, _
0, 0)
End Sub
Private Sub UserControl1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Me.BackColor = Color.Yellow
End Sub
End Class
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim uc As New UserControl1
uc.Location = New Point(0, 0)
uc.Size = New System.Drawing.Size(New Point(100, 100))
uc.BackColor = Color.Yellow
uc.AutoScroll = True
uc.AutoScrollMinSize = New Size(New Point(200, 300))
uc.Visible = True
Me.Controls.Add(uc)
Size = New Size(New Point(300, 300))
Dim lb As New Label
lb.Location = New Point(0, 150)
lb.Size = New Size(290, 80)
lb.Text = "1.Move the scrollbars,the diagonal line isn't" + _
" drawn from(0,0) to (width,height). 2.Minimize" + _
" this form. 3. Restore the form size,now the " + _
"line does go from (0,0) to (width,height). " + _
"Why, why isn't the diagonal line and " + _
"control background cleared as you scroll?"
Me.Controls.Add(lb)
End Sub
End Class