public static void AddFlash(zeus.HelperClass.zBanner banner, System.Windows.Forms.Form f, EventHandler tar) { Point location = new Point(); Size size = new Size(); string src = banner.src; location.X = int.Parse(banner.location.Split(';')[0]); location.Y = int.Parse(banner.location.Split(';')[1]); size.Width = int.Parse(banner.size.Split(';')[0]); size.Height = int.Parse(banner.size.Split(';')[1]); try { AxShockwaveFlashObjects.AxShockwaveFlash Flash = new AxShockwaveFlashObjects.AxShockwaveFlash(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(main_menu)); ((System.ComponentModel.ISupportInitialize)(Flash)).BeginInit(); f.SuspendLayout(); // // Flash // Flash.Enabled = true; Flash.Location = location; Flash.Name = "Flash"; Flash.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("Flash.OcxState"))); Flash.Size = new Size(size.Width, size.Height); //Flash.SetZoomRect(0, 0, 1280, 184); Flash.TabIndex = 0; f.Controls.Add(Flash); ((System.ComponentModel.ISupportInitialize)(Flash)).EndInit(); f.ResumeLayout(false); Flash.LoadMovie(0, System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + src); Flash.Play(); //Flash.ClientRectangle = new Rectangle(0, 0, 1280, 184); //Flash.ClientSize = size; //Flash.Dock = DockStyle.None; Flash.ScaleMode = 1; Flash.Size = new Size(size.Width, size.Height); //Flash.Pan(100, 100, 0); //Flash.Zoom(50); lFlash.Add(Flash); Ipaybox.Option["can-flash-initialize"] = "true"; } catch { Ipaybox.Option["can-flash-initialize"] = "false"; } }
/// <summary> /// Добавление флеш-баннера на форму /// </summary> /// <param name="flash"></param> /// <param name="bannerList"></param> /// <param name="f"></param> /// <param name="tar"></param> public static void AddBanner(zeus.HelperClass.zBanner flash, ref AxShockwaveFlashObjects.AxShockwaveFlash banner, ref System.Windows.Forms.Form f, PreviewKeyDownEventHandler tar) { string location = flash.location; string size = flash.size; string src = flash.src; int X = int.Parse(location.Split(';')[0]); int Y = int.Parse(location.Split(';')[1]); int width = int.Parse(size.Split(';')[0]); int height = int.Parse(size.Split(';')[1]); AxShockwaveFlashObjects.AxShockwaveFlash fl = new AxShockwaveFlashObjects.AxShockwaveFlash(); fl.Stop(); fl.Size = new Size(width, height); fl.Location = new Point(X, Y); fl.Movie = Ipaybox.StartupPath + @"\" + src; fl.PreviewKeyDown += tar; f.Controls.Add(fl); }
public static void AddBanner(zeus.HelperClass.zBanner btn, System.Windows.Forms.Form f, EventHandler tar) { try { string location = btn.location; string limg = btn.src; string size = btn.size; int X = int.Parse(location.Split(';')[0]); int Y = int.Parse(location.Split(';')[1]); int sizeX = int.Parse(size.Split(';')[0]); int sizeY = int.Parse(size.Split(';')[1]); XmlElement root = (XmlElement)Ipaybox.config.DocumentElement.SelectSingleNode("banners"); Image _gif = null; try { if (root == null) { _gif = Image.FromFile(limg); } else { for (int i = 0; i < root.ChildNodes.Count; i++) { XmlElement row = (XmlElement)root.ChildNodes[i]; if (row.Name == "banner") { string form = row.GetAttribute("form").ToLower(); if (form == "acceptaccount" || form == "all") { string src = row.GetAttribute("src"); _gif = Image.FromFile(src); break; } } } if (_gif == null) { _gif = Image.FromFile(limg); } } } catch { _gif = Image.FromFile(limg); } PictureBox pb = new PictureBox(); pb.Size = new Size(sizeX, sizeY); pb.Location = new Point(X, Y); pb.BackColor = Color.Transparent; pb.Image = _gif; f.Controls.Add(pb); } catch (Exception ex) { Ipaybox.AddToLog(Ipaybox.Logs.Main, "Не удалось загрузить баннер: " + ex.Message); } }