VB.NET : Me.Width= Screen.Allscreen(0).Bound.Width give wrong result.
Hi All,
Code:
Private Sub Form1_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Me.Resize
On Error Resume Next
If Me.WindowState = 1 Then Exit Sub ' if minimized do not set width and height
If Me.WindowState = 2 Then Exit Sub ' if maximized do not set width and height
If testScaling = 0 Then
testScaling = 1
End If
Me.Width = (Screen.AllScreens(0).Bounds.Width / testScaling)
Me.Height = (Screen.AllScreens(0).Bounds.Height / testScaling)
End Sub
in this Me.Height give wright result but Me.Width give multiple of two monitor width so application streched in both monitor.
under form_load
we have written
Code:
Dim myScreens() As Screen = Screen.AllScreens
Dim tempitem As Screen
For Each tempitem In myScreens
If tempitem.Primary = True Then
mainscreen = tempitem
End If
Next
Me.Width = myScreens(0).Bounds.Width
Me.height= myScreen(0).Bounds.Height
could you please help me to solve this issue.
I maked my application as screen saver in window. Once window satrt it start my screen saver and in that case my application look strech because of Me.Width taking double of original value.
Kindly help me to resolve this issue. I tried several way but it is not working
Re: VB.NET : Me.Width= Screen.Allscreen(0).Bound.Width give wrong result.
My screen resolution is width=1920, Height=1080
But it showing Me.width=3840 and Me.Height= 1080
Re: VB.NET : Me.Width= Screen.Allscreen(0).Bound.Width give wrong result.
I tested this Code and it was working. can You Show Your Full Code?
Re: VB.NET : Me.Width= Screen.Allscreen(0).Bound.Width give wrong result.
Thanks you so much ,i did mistake,it is working fine