Results 1 to 10 of 10

Thread: HELP! cant move a shape on screen :(

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    HELP! cant move a shape on screen :(

    This is just a samlpe that I made to demonstrate my PAIN
    I want a simple shape to move on the screen as the user moves the mouse, but it just flickers. here's my code:

    VB Code:
    1. Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
    2.         Dim drawPath As New GraphicsPath()
    3.         Dim gr As Graphics = Me.CreateGraphics
    4.  
    5.         drawPath.AddEllipse(e.X, e.Y, 100, 150)
    6.         Me.Invalidate()
    7.         gr.FillPath(Brushes.Red, drawPath)
    8.     End Sub

    and here's a screenshot:

    The red ellipse is supposed to move on the screen as you move the mouse. Well, it does, but the screen flickers.I'm trying to refresh the screen by using Me.Invalidate, that causes the flicker. I dont know any other way


    Download the file to see it yourself (next post).
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    The project (same as the code above)
    Attached Files Attached Files
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    maybe this helps you .
    by the way , it's vb6 proj.
    Attached Files Attached Files

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    well this evil uses bitblt, and it's in vb6, naah
    I want to do it with .NET.
    thanks though
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by pirate
    http://www.allapi.net/apilist/BitBlt.shtml

    .NET supported
    hehe, it's different belive me, I know how to draw, I just don't know how to draw it correctly.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    do you ?
    Well , I'm still looking for a way works , for me and yours .needs some time .

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    got 1 but It's not working , try to find out what's bug is that .
    helpful though.
    Attached Files Attached Files

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    well there is a way that works without flickering. I could invalidate the form in MouseMove event and then paint the shape in OnPaint event. This is what most of the people have done in their sample programs on GDI, but the problem is that it get's SO SLOW!!!! there should be a better way anyone?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    These 3 magical lines do the trick for the flicker thingie, but still kinda slow
    VB Code:
    1. setstyle(ControlStyles.UserPaint, True)
    2. setstyle(ControlStyles.AllPaintingInWmPaint, True)
    3. setstyle(ControlStyles.DoubleBuffer, True)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

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