private void button8_Click(object sender, EventArgs e) { InnerBitmap control = new InnerBitmap(this); control.Location = new Point(panelDesktop.Width / 2, panelDesktop.Height / 2); panelDesktop.Controls.Add(control); }
private void CombineDrawingsWithElements() { //save foreach (Control c in parentTabPage.GetDesktopPanel().Controls) { if (c.GetType() == typeof(Label) || c.GetType() == typeof(InnerHeader)) { continue; } if (c.GetType() == typeof(InnerBitmap)) { InnerBitmap innerBitmap = (InnerBitmap)c; ((PictureBox)innerBitmap.Controls[0]).Image = ImageBlend.MergeWithPanel(parentTabPage.GetDesktopPanel(), new Bitmap(((PictureBox)innerBitmap.Controls[0]).Image), new Point(c.Location.X + parentTabPage.GetDesktopPanel().AutoScrollPosition.X, c.Location.Y + parentTabPage.GetDesktopPanel().AutoScrollPosition.Y)); foreach (Control c2 in parentTabPage.GetDesktopPanel().Controls) { if (c2.GetType() != typeof(Scale)) { continue; } Scale scale = (Scale)c2; if (innerBitmap.elementName == scale.elementName) { continue; } if (scale.Location == innerBitmap.Location) { Image front = null; foreach (Control c3 in scale.Controls) { if (c3.GetType() != typeof(PictureBox)) { continue; } if (c3.Name == "pictureBox1") { front = ((PictureBox)c3).Image; } } Image back = innerBitmap.activeImage; back = ImageBlend.ResizeImage(back, (int)(back.Width * scale.scale), (int)(back.Height * scale.scale)); //ImageBlend.Blend(back, front); scale.ApplyMask(new Bitmap(back)); } } } } parentTabPage.GetDesktopPanel().Refresh(); }
private void VisualizeDrawing(string element) { if (element == "") { return; } string type = GetClearField(element, "type"); switch (type) { case "bitmap": { InnerBitmap bitmap = new InnerBitmap(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 = bitmap.imageName.Split('.')[0]; } bitmap.Apply(x, y, scale, imageName); bitmap.elementName = bitmap.imageName; parentTabPage.GetDesktopPanel().Controls.Add(bitmap); break; } default: break; } }
internal override InnerControl MakeCopy() { if (constant || hidden) { throw new ArgumentOutOfRangeException(); } InnerBitmap control = new InnerBitmap(parentTabPage); control.oldLocation = oldLocation; control.Location = Location; control.Size = Size; control.Visible = Visible; control.scale = scale; control.originSize = originSize; control.activeImage = activeImage; control.imageName = imageName; control.ApplyImage(control.activeImage); return(control); }
internal void Save(string filename) { string standart = "{\nstandart: \n{"; string headerText = parentTabPage.innerHeader.GetText(); if (headerText != "") { standart += "\n\t\theader: \n\t\t{ \n\t\t\ttext: { text: \"" + headerText.Replace("\t", "").Replace("\n", "") + "\"},"; if (!parentTabPage.innerHeader.GetButtonVisibility()) { standart += "\n\t\t\thideButton: false,"; } standart += "\n\t\t},"; } if (parentTabPage.inventoryDrawed) { standart += "\n\t\tinventory: { standart: true},"; } standart += "\n\t\tbackground: "; if (parentTabPage.GetDesktopPanel().BackgroundImage != null) { standart += "{bitmap: \"" + parentTabPage.BackgroundImageName + "\"}"; } else { Color bg_color = parentTabPage.GetDesktopPanel().BackColor; if (bg_color == Color.FromArgb(114, 106, 112)) { standart += "{standart: true}"; } else { standart += "{android.graphics.Color.rgb(" + bg_color.R + ',' + bg_color.G + ',' + bg_color.B + ")}"; } } standart += "\n\t\tminHeight: " + parentTabPage.MaxY() + ","; standart += "\n},\n"; string _params = "params: \n{"; if (!this._params.IsSlotDefault()) { _params += "\n\t\tslot: \"" + this._params.slotImageName.Replace(".png", "") + "\","; } if (!this._params.IsInvSlotDefault()) { _params += "\n\t\tinvSlot: \"" + this._params.invSlotImageName.Replace(".png", "") + "\","; } if (!this._params.IsSelectionDefault()) { _params += "\n\t\tselection: \"" + this._params.selectionImageName.Replace(".png", "") + "\","; } if (!this._params.IsCloseButtonDefault()) { _params += "\n\t\tcloseButton: \"" + this._params.closeButtonImageName.Replace(".png", "") + "\","; } if (!this._params.IsCloseButton2Default()) { _params += "\n\t\tcloseButton: \"" + this._params.closeButton2ImageName.Replace(".png", "") + "\","; } _params += "\n},\n"; string drawing = "drawing: \n["; foreach (Control _c in parentTabPage.GetDesktopPanel().Controls) { if (_c.GetType() != typeof(InnerBitmap)) { continue; } InnerBitmap c = (InnerBitmap)_c; drawing += c.MakeOutput() + ','; } drawing += "\n],\n"; string elements = "elements: \n{"; foreach (Control _c in parentTabPage.GetDesktopPanel().Controls) { if (_c.GetType() == typeof(Label) || _c.GetType() == typeof(InnerHeader) || _c.GetType() == typeof(InnerBitmap)) { continue; } InnerControl c = (InnerControl)_c; if (c.hidden) { continue; } elements += c.MakeOutput() + ','; } elements += "\n}"; File.WriteAllText(filename, standart + _params + drawing + elements); }