public BordKnop(string VormNaam, string IcoonNaam, Point Locatie, OpstartScherm.ActiefScherm NieuweLocatie, OpstartScherm.Genre NieuwGenre) { nieuwGenre = NieuwGenre; BereidAfbeeldingenVoor(VormNaam, IcoonNaam, Locatie, NieuweLocatie); DraaiIcoon(); RenderAfbeeldingenSet(); }
private void BereidAfbeeldingenVoor(string VormNaam, string IcoonNaam, Point Locatie, OpstartScherm.ActiefScherm NieuweLocatie) { // Picture Box Kader = new PictureBox(); Kader.BackColor = Color.Transparent; // Afbeeldingen Vorm = Image.FromFile(System.IO.Directory.GetCurrentDirectory().Substring(0, System.IO.Directory.GetCurrentDirectory().IndexOf("bin")) + @"Resources\Knop Afbeeldingen\Knop Vormen\" + VormNaam + ".png"); Icoon = Image.FromFile(System.IO.Directory.GetCurrentDirectory().Substring(0, System.IO.Directory.GetCurrentDirectory().IndexOf("bin")) + @"Resources\Knop Afbeeldingen\Knop Iconen\" + IcoonNaam + ".png"); // Locaties Kader.Height = Vorm.Height; Kader.Width = Vorm.Width; Kader.Location = Locatie; Kader.Image = Vorm; MiddelPunt = new Point(Kader.Width / 2 + Locatie.X, Kader.Height / 2 + Locatie.Y); IcoonLocatie = new Point(((Kader.Width - Icoon.Width) / 2), ((Kader.Height - Icoon.Height) / 2)); // Events Kader.Click += new EventHandler(ClickEvent); nieuwelocatie = NieuweLocatie; // Bereken kleur van de Vorm van de knop Temp = (Bitmap)Vorm; AchtergrondKleur = Temp.GetPixel(Vorm.Width / 2, 5); }