private void button7_Click(object sender, EventArgs e) { InnerImage control = new InnerImage(this); control.Location = new Point(panelDesktop.Width / 2, panelDesktop.Height / 2); panelDesktop.Controls.Add(control); }
internal override InnerControl MakeCopy() { if (constant || hidden) { throw new ArgumentOutOfRangeException(); } InnerImage control = new InnerImage(parentTabPage); control.Location = Location; control.Size = Size; control.Visible = Visible; control.scale = scale; control.originSize = originSize; control.oldLocation = oldLocation; control.activeImage = activeImage; control.imageName = imageName; control.overlayImage = overlayImage; control.overlayImageName = overlayImageName; control.overlayScale = overlayScale; control.overlayOriginSize = overlayOriginSize; control.overlayEnabled = overlayEnabled; control.ApplyImage(control.activeImage); return(control); }
private void VisualizeElement(string name, string element) { string type = GetClearField(element, "type"); switch (type) { case "slot": { Slot slot = new Slot(parentTabPage); int x; Expression e = new Expression(GetClearField(element, "x")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out x)) { x = parentTabPage.MaxX() / 2; } x += parentTabPage.GetDesktopPanel().AutoScrollPosition.X; int y; e = new Expression(GetClearField(element, "y")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out y)) { y = parentTabPage.MaxY() / 2; } y += parentTabPage.GetDesktopPanel().AutoScrollPosition.Y; int size; if (!int.TryParse(GetClearField(element, "size").Split('.')[0], out size)) { size = slot.Width; } bool visual; if (!bool.TryParse(GetClearField(element, "visual"), out visual)) { visual = false; } string ImageName = GetClearField(element, "bitmap"); if (ImageName == "") { ImageName = slot.ImageName; } string Clicker = GetField(element, "clicker"); slot.Apply(name, x, y, size, visual, ImageName, Clicker); parentTabPage.GetDesktopPanel().Controls.Add(slot); break; } case "invSlot": { InvSlot slot = new InvSlot(parentTabPage); int x; Expression e = new Expression(GetClearField(element, "x")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out x)) { x = parentTabPage.MaxX() / 2; } x += parentTabPage.GetDesktopPanel().AutoScrollPosition.X; int y; e = new Expression(GetClearField(element, "y")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out y)) { y = parentTabPage.MaxY() / 2; } y += parentTabPage.GetDesktopPanel().AutoScrollPosition.Y; int size; if (!int.TryParse(GetClearField(element, "size").Split('.')[0], out size)) { size = slot.Width; } string ImageName = GetClearField(element, "bitmap"); if (ImageName == "") { ImageName = slot.ImageName.Split('.')[0]; } string Clicker = GetField(element, "clicker"); int index; if (!int.TryParse(GetClearField(element, "y").Split('.')[0], out index)) { index = 0; } slot.Apply(name, x, y, size, ImageName, index); parentTabPage.GetDesktopPanel().Controls.Add(slot); break; } case "button": { InnerButton slot = new InnerButton(parentTabPage); int x; Expression e = new Expression(GetClearField(element, "x")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out x)) { x = parentTabPage.MaxX() / 2; } x += parentTabPage.GetDesktopPanel().AutoScrollPosition.X; int y; e = new Expression(GetClearField(element, "y")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out y)) { y = parentTabPage.MaxY() / 2; } y += parentTabPage.GetDesktopPanel().AutoScrollPosition.Y; float scale; if (!float.TryParse(GetClearField(element, "scale"), NumberStyles.Any, CultureInfo.InvariantCulture, out scale)) { scale = 1; } string activeImageName = GetClearField(element, "bitmap"); if (activeImageName == "") { activeImageName = slot.activeImageName.Split('.')[0]; } string activeImage2 = GetClearField(element, "bitmap2"); if (activeImage2 == "") { activeImage2 = activeImageName; } string Clicker = GetField(element, "clicker"); slot.Apply(name, x, y, scale, activeImage2, activeImageName, Clicker); parentTabPage.GetDesktopPanel().Controls.Add(slot); break; } case "text": { InnerText text = new InnerText(parentTabPage); int x; Expression e = new Expression(GetClearField(element, "x")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out x)) { x = parentTabPage.MaxX() / 2; } x += parentTabPage.GetDesktopPanel().AutoScrollPosition.X; int y; e = new Expression(GetClearField(element, "y")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out y)) { y = parentTabPage.MaxY() / 2; } y += parentTabPage.GetDesktopPanel().AutoScrollPosition.Y; int width; if (!int.TryParse(GetClearField(element, "width").Split('.')[0], out width)) { width = text.Width; } int height; if (!int.TryParse(GetClearField(element, "height").Split('.')[0], out height)) { height = text.Height; } string _text = GetField(element, "text"); text.Apply(name, x, y, width, height, _text); parentTabPage.GetDesktopPanel().Controls.Add(text); break; } case "image": { InnerImage image = new InnerImage(parentTabPage); int x; Expression e = new Expression(GetClearField(element, "x")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out x)) { x = parentTabPage.MaxX() / 2; } x += parentTabPage.GetDesktopPanel().AutoScrollPosition.X; int y; e = new Expression(GetClearField(element, "y")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out y)) { y = parentTabPage.MaxY() / 2; } y += parentTabPage.GetDesktopPanel().AutoScrollPosition.Y; float scale; if (!float.TryParse(GetClearField(element, "scale"), NumberStyles.Any, CultureInfo.InvariantCulture, out scale)) { scale = 1; } string imageName = GetClearField(element, "bitmap"); if (imageName == "") { imageName = image.imageName.Split('.')[0]; } string Clicker = GetField(element, "clicker"); string overlayImageName = GetClearField(element, "overlay"); if (overlayImageName == "") { image.Apply(name, x, y, scale, imageName, Clicker); } else { float overlayScale; if (!float.TryParse(GetClearField(element, "overlayScale"), out overlayScale)) { if (!float.TryParse(GetClearField(element, "overlay_scale"), out overlayScale)) { overlayScale = scale; } } string offset = GetClearField(element, "overlayOffset"); int offsetX; if (!int.TryParse(GetClearField(offset, "x").Split('.')[0], out offsetX)) { offsetX = 0; } int offsetY; if (!int.TryParse(GetClearField(offset, "x").Split('.')[0], out offsetY)) { offsetY = 0; } image.Apply(name, x, y, scale, imageName, overlayImageName, new Point(offsetX, offsetY), overlayScale, Clicker); } parentTabPage.GetDesktopPanel().Controls.Add(image); break; } case "scale": { Scale _scale = new Scale(parentTabPage); int x; Expression e = new Expression(GetClearField(element, "x")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out x)) { x = parentTabPage.MaxX() / 2; } x += parentTabPage.GetDesktopPanel().AutoScrollPosition.X; int y; e = new Expression(GetClearField(element, "y")); if (!int.TryParse(e.Evaluate().ToString().Split(',')[0], out y)) { y = parentTabPage.MaxY() / 2; } y += parentTabPage.GetDesktopPanel().AutoScrollPosition.Y; float scale; string _sc = GetClearField(element, "scale"); if (!float.TryParse(_sc, NumberStyles.Any, CultureInfo.InvariantCulture, out scale)) { scale = 1; } string imageName = GetClearField(element, "bitmap"); if (imageName == "") { imageName = _scale.imageName.Split('.')[0]; } string Clicker = GetField(element, "clicker"); int side; if (!int.TryParse(GetClearField(element, "direction").Split('.')[0], out side)) { side = 0; } bool invert; if (!bool.TryParse(GetClearField(element, "invert").Split('.')[0], out invert)) { invert = false; } string overlayImageName = GetClearField(element, "overlay"); if (overlayImageName == "") { _scale.Apply(name, x, y, scale, imageName, side, invert, Clicker); } else { float overlayScale; if (!float.TryParse(GetClearField(element, "overlayScale"), out overlayScale)) { if (!float.TryParse(GetClearField(element, "overlay_scale"), out overlayScale)) { overlayScale = scale; } } string offset = GetClearField(element, "overlayOffset"); int offsetX; if (!int.TryParse(GetClearField(offset, "x").Split('.')[0], out offsetX)) { offsetX = 0; } int offsetY; if (!int.TryParse(GetClearField(offset, "x").Split('.')[0], out offsetY)) { offsetY = 0; } _scale.Apply(name, x, y, scale, imageName, side, invert, overlayImageName, new Point(offsetX, offsetY), overlayScale, Clicker); } parentTabPage.GetDesktopPanel().Controls.Add(_scale); break; } default: break; } }