Advertisement
Guest User

Untitled

a guest
Feb 16th, 2013
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vedit 4.30 KB | None | 0 0
  1. 'ERROR: An unhandled exception of type 'System.NullReferenceException' occurred in pog.exe
  2.  
  3. Private Sub ToolStripButton45_Click(sender As Object, e As EventArgs) Handles ToolStripButton45.Click
  4.        tcViewer.TabPages.Add(New ViewerTabPage(tcViewer))
  5.        MsgBox(tcViewer.Controls("picSource0").Name)
  6.     'err here
  7. End Sub
  8.  
  9.  Class ViewerTabPage
  10.         Inherits TabPage
  11.  
  12.         Private pnLeftTop As New Panel
  13.         Private pnRightTop As New Panel
  14.         Private pnBottom As New Panel
  15.  
  16.         Public picSource As New PictureBox
  17.         Private txtZoom As New TextBox
  18.         Private rtSourceContent As New RichTextBox
  19.         Private rtNotesSource As New RichTextBox
  20.  
  21.         Private ToolStripRT As New ToolStrip
  22.         Private ToolStripB As New ToolStrip
  23.         Private tbZoom As New TrackBar
  24.  
  25.  
  26.         Sub New(targettabcontrol As TabControl)
  27.  
  28.             MyBase.New()
  29.  
  30.             Me.SuspendLayout()
  31.  
  32.  
  33.             Me.Controls.Add(pnLeftTop)
  34.             With pnLeftTop
  35.                 .Anchor = AnchorStyles.Left Or AnchorStyles.Top
  36.                 .Location = New Point(31, 3)
  37.                 .BackColor = Color.Blue
  38.                 .Width = (targettabcontrol.Width / 2) - 7 - 30
  39.                 .Height = (targettabcontrol.Height / 10) * 6.5 '65%
  40.                .Name = "XXX"
  41.                '.Visible = False
  42.             End With
  43.  
  44.             Me.Controls.Add(tbZoom)
  45.             With tbZoom
  46.                 .Orientation = Orientation.Vertical
  47.                 .Location = New Point(0, 3)
  48.                 .Height = pnLeftTop.Height
  49.                 .Width = 30
  50.             End With
  51.  
  52.             Me.Controls.Add(pnRightTop)
  53.             With pnRightTop
  54.                 .Anchor = AnchorStyles.Right Or AnchorStyles.Top
  55.                 .Location = New Point(-(targettabcontrol.Width / 2) + 205, 3)
  56.                 .BackColor = Color.Red
  57.                 .Width = (targettabcontrol.Width / 2) - 7 - 33
  58.                 .Height = (targettabcontrol.Height / 10) * 6.5 '65%
  59.                .Name = "YYY"
  60.  
  61.                '.Visible = False
  62.             End With
  63.  
  64.             Me.Controls.Add(ToolStripRT)
  65.             With ToolStripRT
  66.                 .AutoSize = False
  67.                 .LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow
  68.                 .Size = New Point(33, pnRightTop.Height - 1)
  69.                 .BackColor = Color.Aqua
  70.                 .Dock = DockStyle.None
  71.                 .Left = targettabcontrol.Width - 40
  72.                 .Top = 3
  73.             End With
  74.  
  75.             Me.Controls.Add(pnBottom)
  76.             With pnBottom
  77.                 .Anchor = AnchorStyles.Bottom
  78.                 .Location = New Point(-390, -((targettabcontrol.Height / 10) * 3.5) + 130) 'pnLeftTop.Height + 10)
  79.                .BackColor = Color.Green
  80.                .Width = (targettabcontrol.Width) - 10 - 33
  81.                .Height = (targettabcontrol.Height / 10) * 3.5 '65%
  82.                 .Name = "ZZZ"
  83.             End With
  84.  
  85.             Me.Controls.Add(ToolStripB)
  86.             With ToolStripB
  87.                 .AutoSize = False
  88.                 .LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow
  89.                 .Size = New Point(33, pnBottom.Height - 1)
  90.                 .BackColor = Color.Bisque
  91.                 .Dock = DockStyle.None
  92.                 .Top = ToolStripRT.Height + 5
  93.                 .Left = targettabcontrol.Width - 40
  94.             End With
  95.  
  96.  
  97.             pnLeftTop.Controls.Add(picSource)
  98.             With picSource
  99.                 .Name = "picSource" & targettabcontrol.TabPages.Count - 1
  100.                 MsgBox(.Name)
  101.  
  102.                 .BackColor = Color.Yellow
  103.  
  104.                 .Dock = DockStyle.Fill
  105.                 .BackgroundImageLayout = ImageLayout.Zoom
  106.             End With
  107.  
  108.             pnLeftTop.Controls.Add(txtZoom)
  109.             With txtZoom
  110.                 .Visible = False
  111.             End With
  112.  
  113.             pnRightTop.Controls.Add(rtSourceContent)
  114.             With rtSourceContent
  115.                 .BackColor = Color.Purple
  116.                 .Dock = DockStyle.Fill
  117.             End With
  118.  
  119.             pnBottom.Controls.Add(rtNotesSource)
  120.             With rtNotesSource
  121.                 .BackColor = Color.AliceBlue
  122.                 .Dock = DockStyle.Fill
  123.             End With
  124.  
  125.  
  126.             Me.ResumeLayout(False)
  127.         End Sub
  128.     End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement