R
Rob T
To keep my example simple, let's say I have a windows application form with
a panel in it. For this example, I want to draw a single line in the panel,
which is larger than the size of the panel. Is there a way to get the
scrollbars to show up?
Also....If I were to put a control (like a button) into the panel, the
scrollbars are there...but my line doesn't redraw properly.
How should I be doing this? Thanks.
PS. here's code snip of what I'm trying to do....
Private components As System.ComponentModel.IContainer
Friend WithEvents Panel1 As System.Windows.Forms.Panel
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or
System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.Panel1.AutoScroll = True
Me.Panel1.BackColor = System.Drawing.Color.White
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel1.Location = New System.Drawing.Point(112, 56)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(472, 344)
Me.Panel1.TabIndex = 0
'
'Preview
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(592, 413)
Me.Controls.Add(Me.Panel1)
Me.Name = "Preview"
Me.Text = "Preview"
Me.ResumeLayout(False)
End Sub
Private Sub DrawIt(ByVal g As Graphics)
g.DrawLine(New Pen(Color.Black), 2, 2, 500, 400)
End Sub
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
DrawIt(e.Graphics)
End Sub
a panel in it. For this example, I want to draw a single line in the panel,
which is larger than the size of the panel. Is there a way to get the
scrollbars to show up?
Also....If I were to put a control (like a button) into the panel, the
scrollbars are there...but my line doesn't redraw properly.
How should I be doing this? Thanks.
PS. here's code snip of what I'm trying to do....
Private components As System.ComponentModel.IContainer
Friend WithEvents Panel1 As System.Windows.Forms.Panel
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or
System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.Panel1.AutoScroll = True
Me.Panel1.BackColor = System.Drawing.Color.White
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel1.Location = New System.Drawing.Point(112, 56)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(472, 344)
Me.Panel1.TabIndex = 0
'
'Preview
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(592, 413)
Me.Controls.Add(Me.Panel1)
Me.Name = "Preview"
Me.Text = "Preview"
Me.ResumeLayout(False)
End Sub
Private Sub DrawIt(ByVal g As Graphics)
g.DrawLine(New Pen(Color.Black), 2, 2, 500, 400)
End Sub
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
DrawIt(e.Graphics)
End Sub