public BTN(Thickness TargetMargin, double VAR_TO_LOAD, double CutPoint_X, double CutPoint_Y, double Cut_Width, double Cut_Height, Grid layoutRoot) { this.l = TargetMargin.Left; this.t = TargetMargin.Top; this.r = TargetMargin.Right; this.b = TargetMargin.Bottom; this.VAR_TO_LOAD = VAR_TO_LOAD; if (BTN_Pic != "") { IsolatedStorageFileStream btnpic = new IsolatedStorageFileStream(BTN_Pic, FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication()); Alpha.CutImage(btnpic, new Size(CutPoint_X, CutPoint_Y), new Size(Cut_Width, Cut_Height), ref this.image); layoutRoot.Children.Add(this.image); this.image.Margin = TargetMargin; this.image.HorizontalAlignment = HorizontalAlignment.Left; } }
public void SetWindow(ref TextBlock txb, ref Image textboximage) { double left, top, right, bottom; left = this.x * GamePage.zoom; top = this.y * GamePage.zoom; right = GamePage.resolution_width - ((this.charspacing + this.charwidth) * charcount) * GamePage.zoom - this.x * GamePage.zoom; bottom = GamePage.resolution_height - ((this.linespacing + this.charheight) * linecount) * GamePage.zoom - this.y * GamePage.zoom; txb.FontSize = charwidth * GamePage.zoom - 1; txb.Margin = new Thickness(left, top, right, bottom); if (color.StartsWith("#")) { } else if (color.StartsWith(":a;") || color.StartsWith(":b;") || color.StartsWith(":c;")) { color = color.Remove(0, 3); BitmapImage textbox = new BitmapImage(); string path = Path.Combine(GamePage.inf.Game.GameFolder, GamePage.inf.Game.DataFolder, color); try { if (color.EndsWith("png")) { textbox.SetSource(new IsolatedStorageFileStream(path, FileMode.Open, isf)); textboximage.Source = textbox; } else if (color.EndsWith("jpg")) { Alpha.AlphaBlend(new IsolatedStorageFileStream(path, FileMode.Open, isf), ref textboximage); } textboximage.HorizontalAlignment = HorizontalAlignment.Left; textboximage.Opacity = 1; textboximage.Margin = new Thickness(textblockx1 * GamePage.zoom, textblocky1 * GamePage.zoom, GamePage.resolution_width - textblockx2, GamePage.resolution_height - textblocky2); } catch { } } }