I am attempting to make a dual screen screen saver. It was working at the beginning but now it isn't working. Here is the start up function:
Sub Main()
Dim x = 0
For Each screen As Screen In screen.AllScreens
Dim screensaver As ScrSav = New ScrSav(screen.Bounds)
screensaver.Location = screen.Bounds.Location
screensaver.Show()
x += 1
Debug.Print(screen.Bounds.Left & " " & screen.Bounds.Top & " " & screen.Bounds.Width & " " & screen.Bounds.Height & " " & "")
Next
Application.Run()
End Sub
and here is the form code
Public Class ScrSav
Public Sub New()
InitializeComponent()
End Sub
Public Sub New(xBounds As Rectangle)
InitializeComponent()
Me.Bounds = xBounds
Debug.Print(Me.Bounds.Left & " " & Me.Bounds.Top & " " & Me.Bounds.Width & " " & Me.Bounds.Height & " " & "")
Cards.Location = New Point((Me.Width - Cards.Width) / 2, (Me.Height - Cards.Height) / 2)
Header.Location = New Point((Me.Width - Header.Width) / 2, 0)
Cards.Navigate("http://pah.guycothal.com/screensaver.aspx")
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End
End Sub
Private Sub ScrSav_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
End
End Sub
End Class
What am i doing wrong??? I am initializing the 2 screen the way others are. in fact, i have a few places where I have put debugging in place to see what is going on in each of the subs. here is what is it outputting
0 0 1280 800 <--main
0 0 1280 800 <--new
1280 -224 1280 1024 <-main
1280 -224 1280 1024 <-new
I have labeled which sub each is from to make it easier to understand. Also, here is what is on the form itself
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ScrSav
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
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.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ScrSav))
Me.Cards = New System.Windows.Forms.WebBrowser()
Me.Header = New System.Windows.Forms.PictureBox()
CType(Me.Header, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Cards
'
Me.Cards.AllowNavigation = False
Me.Cards.AllowWebBrowserDrop = False
Me.Cards.IsWebBrowserContextMenuEnabled = False
Me.Cards.Location = New System.Drawing.Point(128, 137)
Me.Cards.MaximumSize = New System.Drawing.Size(640, 200)
Me.Cards.MinimumSize = New System.Drawing.Size(640, 200)
Me.Cards.Name = "Cards"
Me.Cards.ScriptErrorsSuppressed = True
Me.Cards.ScrollBarsEnabled = False
Me.Cards.Size = New System.Drawing.Size(640, 200)
Me.Cards.TabIndex = 0
Me.Cards.TabStop = False
Me.Cards.Url = New System.Uri("http://pah.guycothal.com/screensaver.aspx", System.UriKind.Absolute)
Me.Cards.WebBrowserShortcutsEnabled = False
'
'Header
'
Me.Header.Image = CType(resources.GetObject("Header.Image"), System.Drawing.Image)
Me.Header.InitialImage = CType(resources.GetObject("Header.InitialImage"), System.Drawing.Image)
Me.Header.Location = New System.Drawing.Point(0, 0)
Me.Header.MaximumSize = New System.Drawing.Size(2000, 60)
Me.Header.MinimumSize = New System.Drawing.Size(2000, 60)
Me.Header.Name = "Header"
Me.Header.Size = New System.Drawing.Size(2000, 60)
Me.Header.TabIndex = 1
Me.Header.TabStop = False
'
'ScrSav
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Black
Me.ClientSize = New System.Drawing.Size(991, 453)
Me.Controls.Add(Me.Header)
Me.Controls.Add(Me.Cards)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Name = "ScrSav"
Me.ShowInTaskbar = False
Me.Text = "ScrSav"
Me.TopMost = True
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
CType(Me.Header, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Cards As System.Windows.Forms.WebBrowser
Friend WithEvents Header As System.Windows.Forms.PictureBox
End Class