|
-
Oct 24th, 2007, 01:50 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [02/03] Incorrect form location at first .Show()
In my project I have Form1, the main form, and Form2. Form2 is a info-bubble like panel which holds a PictureBox. I need to show Form2 at certain times, but its location is determined by the location of the mouse.
It is working fine, except the first time Form2 always shows somewhere near the uppper left corner of the screen. Only after the first time Form2 is shown will it popup in the correct place. This example uses .Show and .Hide, I have also tried replacing those with .Visible = False and .Visible = True, respectively.
In Form1:
Code:
Dim mypicbox as New Form2
Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
Me.mypicbox.Location = New System.Drawing.Point(Me.Cursor.Position.X, Me.Cursor.Position.Y)
Me.mypicbox.Show()
End Sub
And then I hide it with other code, but the problem is the first time Form2.Show() is called, it doesn't show in the correct location. Everytime after that it does.
I was able to solve this problem by showing and hiding Form2 on Form1 load, but that makes Form2 flicker, and it looks unprofessional.
Does anyone have a solution?
Thanks
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|