public static ItemModE CreateItemModE() { ItemModE mod = new ItemModE(); Canvas can = new Canvas(); mod.can = can; Image img = new Image(); can.Children.Add(img); mod.img = img; BitmapImage bi = new BitmapImage(); img.Source = bi; TextBlock tb = new TextBlock(); tb.FontSize = 18; tb.Foreground = title_brush; tb.Height = 50; can.Children.Add(tb); mod.title = tb; //tb = new TextBlock(); //tb.Foreground = font_brush; tb.TextWrapping = TextWrapping.Wrap; //ca.Children.Add(tb); //mod.content = tb; Button b = new Button(); b.Background = trans_brush; can.Children.Add(b); mod.button = b; return(mod); }
public static void ClearItemMod(ItemModE im) { im.can.Children.Clear(); GC.SuppressFinalize(im.button); GC.SuppressFinalize(im.img); GC.SuppressFinalize(im.title); //if (im.ico != null) // GC.SuppressFinalize(im.ico); if (im.content != null) { GC.SuppressFinalize(im.content); } GC.SuppressFinalize(im.can); }
public static ItemModE CreateItemMod() { for (int i = 0; i < max; i++) { if (!item_buff[i].reg) { item_buff[i].reg = true; item_buff[i].can.Visibility = Visibility.Visible; return(item_buff[i]); } } ItemModE mod = CreateItemModE(); mod.reg = true; mod.index = max; item_buff[max] = mod; max++; return(mod); }
void ResizeArea(ref Area ar) { double sw = its.sw; double sh = its.sh; double dx = 0; double dy = 30; int l = ar.context.Count; for (int i = 0; i < l; i++) { if (dx + sw > its.w) { dx = 0; dy += sh; } ItemModE im = ar.items[i]; im.can.Margin = new Thickness(dx, dy, 0, 0); im.img.Width = its.iw; im.img.Height = its.ih; im.title.Width = its.iw; im.title.Margin = new Thickness(0, its.oy_t, 0, 0); im.button.Width = its.iw; im.button.Height = sh; dx += sw; } dy += sh; ar.can.Width = its.w; if (ar.expand) { ar.can.Height = dy; } else { ar.can.Height = 30; } ar.height = dy; }