Problema con movimiento objeto [URGENTE]
Publicado por Alejandro (1 intervención) el 31/07/2014 05:16:05
Hola, tengo un label en png con fondo transparente y la funcion de keyUP en windows form es que el objeto se mueva en Y - 100 pero cuando lo hace atras se queda congelado el muñeco, se va a la posicion y arrastra el fondo del form: ver imagen

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
private void Form1_KeyUp(object sender, KeyEventArgs e)
{
int x,y, k;
int h;
x = label2.Location.X;
y = label2.Location.Y;
TimeSpan ts = stopWatch.Elapsed;
h = Convert.ToInt32(ts.Milliseconds);
Stopwatch sw = new Stopwatch();
label2.SetBounds(x, 50, 238, 307);
sw.Start();
for (int i = 0; ; i++)
{
if (i % 100000 == 0)
{
sw.Stop();
if (sw.ElapsedMilliseconds == 1000)
{
y = label2.Location.Y + 100;
label2.SetBounds(x, y, 238, 307);
puntos = puntos + 1000;
stopWatch.Reset();
break;
}
else
{
sw.Start();
}
}
stopWatch.Reset();
}
}

Valora esta pregunta


0