Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Using Timer : Change position of Icon Drawn on Panel

  1. #1

    Thread Starter
    Hyperactive Member Coool's Avatar
    Join Date
    Feb 2006
    Location
    System.Coool
    Posts
    333

    Resolved [RESOLVED] [2005] Using Timer : Change position of Icon Drawn on Panel

    Hi guys,

    My core purpose of this post is to make animated search image by combining Computer & Search icons

    I tried ImageReady and Flash to make Animated Gif but the Quality is pure.

    Anyway, My code is as Under ...


    VB Code:
    1. Dim icoComputer as New Icon("E:\Icons\Computer.ico")
    2. Dim icoSearch as New Icon("E:\Icons\Search.ico")
    3. Dim X as Interger = 144
    4. Dim Y as Integer = 44
    5. Private Sub pnlBackGround_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles pnlBackGround.Paint
    6.  
    7.       e.Graphics.DrawIcon(icoComputer, X, Y)
    8.       e.Graphics.DrawIcon(icoSearch, X, Y) ' I want to change this X
    9.  
    10. End Sub

    I know i have to use timer_tick event but how to used e (System.Windows.Forms.PaintEventArgs) in it. I tried to declare object of System.Windows.Forms.PaintEventArgs. But I can't change the position of Search icon.

    Plz help yaar..

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Using Timer : Change position of Icon Drawn on Panel

    The arguments for each event handler are specific to that event. What you need to do is use your Tick event handler to set the values of certain variables that will control where the icons are drawn, then call Refresh or Invalidate on the form to raise the Paint event. In the Paint event handler you then use those variables you set to draw the icons. If you can specify just the area of the form that will be changing then Invalidate will be more efficient than Refresh.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member Coool's Avatar
    Join Date
    Feb 2006
    Location
    System.Coool
    Posts
    333

    Re: [2005] Using Timer : Change position of Icon Drawn on Panel

    Thanks that's workin.
    Last edited by Coool; May 22nd, 2006 at 10:07 PM.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Using Timer : Change position of Icon Drawn on Panel

    Have you tried or are you just assuming that you can't do it? My instructions are fairly simple: set some variables in the Tick event handler, call Refresh or Invalidate, use those variables in the Paint event handler.

    Edit: So I guess that you tried after all.
    Last edited by jmcilhinney; May 22nd, 2006 at 10:10 PM.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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