private void timer1_Tick(object sender, EventArgs e)
        {
            double dx, dy;

            if (movingLeft)
            {
                dx = -100;
            }
            else
            {
                dx = 100;
            }

            if (movingUp)
            {
                dy = 100;
            }
            else
            {
                dy = -100;
            }

            position.X = position.X + dx;
            position.Y = position.Y + dy;

            if (position.X < this.mapBox1.Map.Envelope.MinX)
            {
                movingLeft = false;
            }
            else if (position.X > this.mapBox1.Map.Envelope.MaxX)
            {
                movingLeft = true;
            }

            if (position.Y < this.mapBox1.Map.Envelope.MinY)
            {
                movingUp = true;
            }
            else if (position.Y > this.mapBox1.Map.Envelope.MaxY)
            {
                movingUp = false;
            }

            VariableLayerCollection.TouchTimer();
            //this.mapBox1.Refresh();
        }
示例#2
0
 /// <summary>
 /// Move the object
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void m_timer_Tick(object sender, EventArgs e)
 {
     VariableLayerCollection.TouchTimer();
     //RefreshMap();
 }