6 Replies - 991 Views - Last Post: 02 October 2011 - 09:13 AM Rate Topic: -----

#1 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 968
  • Joined: 09-May 09

click event not showing new form

Posted 28 September 2011 - 01:21 PM

This is kind of odd for me to explain. Ill try. . . .

i have 7 picture boxex in 3 rows

xxxxxxx
xxxxxxx
xxxxxxx

the event works correctly for the x's but not for the 0's

xxxxxxx
x00000x
xxxxxxx

On click of a picture box a new form is displayed centre screen (across the 0's), i also have a leave event that will hide the form once the cusor leaves the picture box.

it seems that when the new form is displayed on top of the cusor the leave event is executed and there is a quick flicker of the form.

im baffled by this because it works fine for all of the other picture boxes

any ideas would be great
Kevin

Is This A Good Question/Topic? 0
  • +

Replies To: click event not showing new form

#2 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,505
  • Joined: 16-March 11

Re: click event not showing new form

Posted 28 September 2011 - 01:41 PM

Could you please show us your code?
Was This Post Helpful? 0
  • +
  • -

#3 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 968
  • Joined: 09-May 09

Re: click event not showing new form

Posted 28 September 2011 - 01:57 PM

click event

Private Sub PictureBox9_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox9.MouseClick
        fullScreenPeek.Show()

        'make the picture path'
        Dim posterPath = String.Concat(Form1.directorylist.Item(8 + Form1.intMultiPL), "\frontCover.jpg")
        fullScreenPeek.loadInfo(posterPath, TextBox9.Text)
    End Sub

 'search for poster 
        Dim fFile As New FileInfo(posterPath)

        ' no poster then load default else load image
        If Not fFile.Exists Then
            PictureBox1.Image = My.Resources.noPosterImage

        Else
            'display image in correct picture box
            PictureBox1.Image = Image.FromFile(posterPath)
            movieNameLabel.Text = movieName
        End If

        'fetch info & star rating
        getData(posterPath)
    End Sub
    Private Sub getData(ByVal xmlFilePathTemp)

        Dim temp = xmlFilePathTemp.Replace("!", "")
        Dim xtemp = xmlFilePathTemp.replace("-", " ")
        Dim xmlFilePath = xtemp.Replace("frontCover.jpg", "movieData.xml")

        Try
            'Trim string to leave just the movie name
            Dim movieName As String() = Nothing
            movieName = xmlFilePath.Split("\")

            'find length of the array, download data 
            Dim max = movieName.Length

            'New document
            Dim doc As XDocument

            'load file into document
            doc = Xdocument.Load(xmlFilePath)


            'Query XML file movie data 
            Dim movieData = From d In doc.Descendants("movie")
                            Select Name = d.Element("name").Value

           
            Dim alternativeName = From d In doc.Descendants("movie")
                            Select altName = d.Element("alternative_name").Value

      


            Dim total = movieData.Count
            Dim i As Integer = 0
            While i <= total


                Dim name = movieData(i).ToString

                Dim temp1 = name.Replace(":", "")
                Dim temp2 = temp1.Replace("!", "")
                Dim temp3 = temp2.Replace("-", " ")

                Dim otherName = alternativeName(0).ToString

                Dim atemp1 = otherName.Replace(":", "")
                Dim atemp2 = atemp1.Replace("!", "")
                Dim atemp3 = atemp2.Replace("-", " ")


                If (temp3.ToLower) = movieName(max - 2).ToLower.ToString Or atemp3.ToLower = movieName(max - 2).ToLower.ToString Then

                    Dim position = i

                    'Query XML file movie data 
                    Dim movieDetails = From d In doc.Descendants("movie")
                                    Select movieInformation = d.Element("overview").Value, _
                                        imdbRating = d.Element("rating").Value

                    'display movie info
                    descriptionTextBox.Text = movieDetails(0).movieInformation.ToString

                    Dim ratingValue As Integer

                    Dim tempValue As String = movieDetails(0).imdbRating.ToString

                    'get value and assing to stars
                    ratingValue = CInt(tempValue / 2)
                    RatingStar1.RatingValue = ratingValue



                    i = i + 1

                End If
                i = i + 1

            End While




        Catch ex As Exception

        End Try

    End Sub



& the leave event
    Private Sub PictureBox9_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox9.MouseLeave
        fullScreenPeek.Close()
    End Sub



if i could post a pic i would, but ive used all my space :(

kevin
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,462
  • Joined: 29-May 08

Re: click event not showing new form

Posted 28 September 2011 - 02:06 PM

You could always use a Image Storage site. Like ImageShack.
Was This Post Helpful? 0
  • +
  • -

#5 Ionut  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 385
  • View blog
  • Posts: 1,057
  • Joined: 17-July 10

Re: click event not showing new form

Posted 28 September 2011 - 02:12 PM

This behaviour happens because, when you show the form, the 0 pictures lose the focus, and mouse leave event fires. I would look at the mouse position and, when the mouse cursor leaves the picture area(use Top, Left properties for simplicity), close the form.
Was This Post Helpful? 0
  • +
  • -

#6 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 968
  • Joined: 09-May 09

Re: click event not showing new form

Posted 02 October 2011 - 08:55 AM

i dont really know what you mean. I understand the focus is lost when the for is displayed. I want to keep the form in the middle of the screen.

how do i use top and left properities?

Ive tried setting a new point for the form, but its messy and id like to kkep it simple

think ill try and move the position of the cursor to the middle of the screen and execute a leve event for the form.

kevin
Was This Post Helpful? 0
  • +
  • -

#7 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 968
  • Joined: 09-May 09

Re: click event not showing new form

Posted 02 October 2011 - 09:13 AM

Solved

i get the position of a picturebox control inside the form im displaying in the middle of the screen. i then move the mouse to that point.

no longer execute the mouse leave event in each picture control. No i execute the form leave event for the form im displaying in the middle of the screen.

thanks for the help guys

 Dim screenPosition As Point = fullScreenPeek.PictureBox1.PointToScreen(Point.Empty)
        Cursor.Position = New Point(screenPosition)


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1