Results 1 to 13 of 13

Thread: [RESOLVED] mouse problems

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2012
    Posts
    56

    Re: mouse problems

    Well, none of the code I downloaded worked, I'm not sure why. But as I was fiddling around, I came across a Rectangle control in the toolbox - which handles transparency perfectly. Now, the redraw of these rectangles isn't as smooth as redrawing the graphics the way I was doing it, but I was able to place controls and use their mousehover/mouseleave/mouseclick events without having to 'track' where the mouse coordinates are. There's probably a way to get the EXACT x & y coordinates for such as system as I was using before, but for this particular program, I'm happy with the rectangles. Not as elegant, but IT WORKS - which is the main thing.

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2012
    Posts
    56

    Re: [RESOLVED] mouse problems

    I just wanted to pass this on, in case anyone else ever has this problem.

    If your picture is 1024x768 and your window is 800x600 and you stretch your picturebox to fit, everything and anything connected with this form is going to go to S*** really, really fast. You must either make your window the size of your picture or vice-versa. When the background image and window size are the same, the e.x and e.y coordinates correstpond on a 1:1 basis. OTHER controls may be sized, but the main, background image - the one that's being redrawn in the example below - is the one that MUST be sized at the same size as the window.

    I decided to go back to this method, as the Rectangles' redraw was very clunky and slow. When I redid this, I thought about the problem I'd been having before I started this thread, and made a test. When the test worked perfectly, on the first compile, I knew I'd come across something of interest.

    My only remaining complaint is to Microsoft: Why the @#$%&! didn't you make the PictureBox controls handle transparency???

    Anyway, Thanks for all your help.

    Code:
        Public Sub DrawBoard()
           _gameGraph.DrawImage(My.Resources.Screen_Player, New Rectangle(0, 0, 1384, 768))
           _gameGraph.DrawImage(My.Resources.Button, New Rectangle(652, 408, 100, 26))
    
            RaiseEvent boardUpdated(_gameField)
        End Sub
    
        Public Event boardUpdated(ByVal bmp1 As Bitmap)
    
        Private Sub gameUpdate(ByVal bit As Bitmap) Handles Me.boardUpdated
            Me.StartPosition = FormStartPosition.CenterScreen
            picGame.Image = bit
            picGame.Refresh()
        End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width