public ListItem(ListItemStyle ItemStyle, string text) { this.ItemStyle = ItemStyle; Text = text; Height = (int)ItemStyle.Font.MeasureString(Text).Y; Selected = false; }
public void AddItem(string text, ListItemStyle ListItemStyle) { ListItem NewItem = new ListItem(ListItemStyle, text); NewItem.Width = ListStyle.Width - ((int)ListStyle.ItemOffset.X * 2); Vector2 Pos = new Vector2(); Pos.X = Position.X - ListStyle.Origin.X/2 + ListStyle.ItemOffset.X; Pos.Y = Position.Y - ListStyle.Origin.Y/2 + ListStyle.ItemOffset.Y + (ListItems.Count * NewItem.Height); NewItem.Position = Pos; ListItems.Add(NewItem); }