C# Moving Transparent PictureBox -


i'm tryin make picbox2 color transparent when picbox1 pass on picbox2. code

namespace gioco { public partial class form1 : form {     image img;     image tmpsx;     image tmpdx;     image tmpup;     image tmpdw;      public form1()     {         initializecomponent();         panel1.controls.add(picturebox1);         picturebox1.parent = panel1;         img = picturebox1.image;         tmpsx = (image)img.clone();         tmpsx.rotateflip(rotatefliptype.rotatenoneflipx);         tmpdx = (image)img.clone();         tmpdw = (image)img.clone();         tmpdw.rotateflip(rotatefliptype.rotate90flipnone);         tmpup = (image)img.clone();         tmpup.rotateflip(rotatefliptype.rotate270flipnone);      }      private void form1_keydown(object sender, keyeventargs e)     {         if (e.keycode == keys.d)         {             picturebox1.image = tmpdx;             picturebox1.location = new point(picturebox1.location.x + 3, picturebox1.location.y);             picturebox1.sendtoback();         }         else if (e.keycode == keys.a)         {             picturebox1.image = tmpsx;             picturebox1.location = new point(picturebox1.location.x - 3, picturebox1.location.y);             picturebox1.sendtoback();         }         else if (e.keycode == keys.w)         {             picturebox1.image = tmpup;             picturebox1.location = new point(picturebox1.location.x, picturebox1.location.y - 3);             picturebox1.sendtoback();         }         else if (e.keycode == keys.s)         {             picturebox1.image = tmpdw;             picturebox1.location = new point(picturebox1.location.x, picturebox1.location.y + 3);             picturebox1.sendtoback();         }         else if(e.keycode == keys.space)         {             image fire = image.fromfile(@"c:\users\user\documents\visual studio 2015\projects\gioco\gioco\resources\494979.gif");             picturebox picfire = new picturebox();             picfire.image = fire;             picfire.visible = true;             picfire.backcolor = color.transparent;             panel1.controls.add(picfire);             picfire.bringtofront();             picfire.location = new point(picturebox1.location.x + picturebox1.width, picturebox1.location.y + picturebox1.height / 2);             picfire.sizemode = pictureboxsizemode.zoom;            }     } } } 

here screenshot:

enter image description here


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -