protected void UpdateImage() { // Also set our image value if we can if (imageValue != null) this.Children.Remove(imageValue); imageValue = new DImage(_guiManager, 3, 3, imageName, (int)(Size.X - 6), (int)(Size.Y - 6)); imageValue.Initialize(); this.Children.Add(imageValue); // Shift text over if (imageName != null && textValue.Position.X == 5f) { textValue.Position = new Vector2(imageValue.Position.X + imageValue.Size.X + 5f, textValue.Position.Y); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { float textXOffset = _PADDING; if (imageName != null) { imageValue = new DImage(_guiManager, _PADDING, _PADDING, imageName, (int)(Size.X - (2 * _PADDING)), (int)(Size.Y - (2 * _PADDING))); imageValue.Initialize(); this.Children.Add(imageValue); textXOffset += imageValue.Position.X + imageValue.Size.X; } textValue = new DText(_guiManager); textValue.Text = text; textValue.FontName = "Miramonte"; // Left justified textValue.HorizontalAlignment = DText.DHorizontalAlignment.Left; textValue.VerticalAlignment = DText.DVerticalAlignment.Center; textValue.Size = new Vector2(Size.X, Size.Y); textValue.Initialize(); textValue.Position = new Vector2(textXOffset, _PADDING); this.AddPanel(textValue); dropDownButton = new DToggleButton(_guiManager); dropDownButton.Text = ""; dropDownButton.Size = new Vector2(Size.Y, Size.Y); dropDownButton.Initialize(); dropDownButton.Position = new Vector2(Size.X - Size.Y, 0); this.AddPanel(dropDownButton); dropDownButton.OnToggle += new ToggleButtonEventHandler(dropDownButton_OnToggle); dropDownList = new DListBox(_guiManager); dropDownList.Size = new Vector2(Size.X, DEFAULT_LIST_HEIGHT); dropDownList.Initialize(); dropDownList.Position = new Vector2(0, this.Position.Y + Size.Y); dropDownList.Visible = false; dropDownList.ApplyChildClipping = false; dropDownList.OnItemSelect += new ListBoxChangeEventHandler(dropDownList_OnItemSelect); listShown = false; this.FillColor = Color.White; base.LoadContent(); }