protected internal override void Draw(ref Rect area, IGUIRenderer renderer) { renderer.DrawRect(ref area, Control.Color); for (int i = 0; i < Control.items.Count; i++) { Rect rect = new Rect(area.X, -Control.scrollbar.Value + area.Y + i * Control.Font.Size, area.W, Control.Font.Size); Rect tmp; if (renderer.SetSubRectDrawableArea(ref area, ref rect, out tmp)) { Color c = (i == Control.selectedIndex ? Control.SelectedColor : (i % 2 == 0 ? Control.Color : Control.StripeColor)); renderer.DrawRect(ref rect, c); renderer.DrawString(Control.Font, Control.items[i].ToString(), ref rect, Control.TextColor, TextAlignment.Left); } } if (Control.items.Count * Control.Font.Size > Control.size.Y) { Rect scrollRect = new Rect(area.X + Control.scrollbar.X, area.Y, Control.scrollbar.Width, area.H); if (renderer.SetSubRectDrawableArea(ref area, ref scrollRect, out scrollRect)) { Control.scrollbar.Draw(ref scrollRect, renderer); } } }
protected internal override void Draw(ref Rect area, IGUIRenderer renderer) { renderer.DrawRect(ref area, Control.BackgroundColor); Rect _contentRect = new Rect(area.X + Control.padding.X, area.Y + Control.padding.Y, area.W - Control.padding.X - Control.padding.W, area.H - Control.padding.H); if (renderer.SetSubRectDrawableArea(ref area, ref _contentRect, out _contentRect)) { if (Control.editText.Length > 0) { renderer.DrawString(Control.Font, Control.Text, ref _contentRect, Control.TextColor, TextAlignment.Left); } else { renderer.DrawString(Control.Font, Control.Hint, ref _contentRect, Control.HintColor, TextAlignment.Left); } } }
private void Draw(ref Rect area, IGUIRenderer renderer, Color c) { renderer.DrawRect(ref area, c); Rect textRect = new Rect(area.X + this.padding.X, area.Y + area.H - this.Font.Size, area.W - this.padding.W - this.padding.X, this.Font.Size); renderer.DrawString(this.Font, this.Text, ref textRect, this.TextColor, TextAlignment.Left); if (this.Icon != null) { Rect rect = new Rect(area.X + (this.size.X / 4), area.Y + (this.size.Y / 4), this.size.X / 2, this.size.Y / 2); renderer.DrawFrame(this.Icon, ref rect, this.IconColor); } }
protected internal override void Draw(ref Rect drawableArea, IGUIRenderer batch) { batch.DrawRect(ref drawableArea, this.BackgroundColor); batch.DrawString(this.Font, this.Text, ref drawableArea, this.TextColor, this.Alignment); }