Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. moving ellipse over dataGridView

moving ellipse over dataGridView

Scheduled Pinned Locked Moved C#
graphics
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    t_nedelchev
    wrote on last edited by
    #1

    Hello everybody. I want to make simple animation. I want to make a moving ellispe over dataGridView . Now I'm write this: private void timer1_Tick(object sender, EventArgs e) { X1 += 5; Y1 += 5; Invalidate(); SolidBrush myBrush = new SolidBrush(Color.Green); dataGridView1.Refresh(); Graphics grfx = dataGridView1.CreateGraphics(); grfx.FillEllipse(myBrush, X1, Y1, 15, 15); } I ask is there any other way to make this because every time when I refresh(); dataGridView it blink. Thanks in advance.

    S 1 Reply Last reply
    0
    • T t_nedelchev

      Hello everybody. I want to make simple animation. I want to make a moving ellispe over dataGridView . Now I'm write this: private void timer1_Tick(object sender, EventArgs e) { X1 += 5; Y1 += 5; Invalidate(); SolidBrush myBrush = new SolidBrush(Color.Green); dataGridView1.Refresh(); Graphics grfx = dataGridView1.CreateGraphics(); grfx.FillEllipse(myBrush, X1, Y1, 15, 15); } I ask is there any other way to make this because every time when I refresh(); dataGridView it blink. Thanks in advance.

      S Offline
      S Offline
      sam
      wrote on last edited by
      #2

      modify your code like this private void timer1_Tick(object sender, System.EventArgs e) { Graphics gs = dataGrid1.CreateGraphics(); SolidBrush br = new SolidBrush(Color.Red); gs.FillEllipse(br,X,Y,10,10); dataGrid1.Refresh(); if(X+15<= dataGrid1.Width+20) X=X+2; else X=20; } private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics gs = dataGrid1.CreateGraphics(); SolidBrush br = new SolidBrush(Color.Red); gs.FillEllipse(br,X,Y,10,10); }

      T 1 Reply Last reply
      0
      • S sam

        modify your code like this private void timer1_Tick(object sender, System.EventArgs e) { Graphics gs = dataGrid1.CreateGraphics(); SolidBrush br = new SolidBrush(Color.Red); gs.FillEllipse(br,X,Y,10,10); dataGrid1.Refresh(); if(X+15<= dataGrid1.Width+20) X=X+2; else X=20; } private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics gs = dataGrid1.CreateGraphics(); SolidBrush br = new SolidBrush(Color.Red); gs.FillEllipse(br,X,Y,10,10); }

        T Offline
        T Offline
        t_nedelchev
        wrote on last edited by
        #3

        I try to do this but dataGrid1_Paint(); dosn't work private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics gs = dataGrid1.CreateGraphics(); SolidBrush br = new SolidBrush(Color.Red); gs.FillEllipse(br,X,Y,10,10); }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups