private void Init () { listboxParts = new Texture2D[4]; listboxParts[0] = BaseGame.ContentMgr.Load<Texture2D>( Path.Combine( Directories.UIContent, "textbox_left" ) ); listboxParts[1] = BaseGame.ContentMgr.Load<Texture2D>( Path.Combine( Directories.UIContent, "textbox_middle" ) ); listboxParts[2] = BaseGame.ContentMgr.Load<Texture2D>( Path.Combine( Directories.UIContent, "textbox_right" ) ); listboxRect = new Rectangle( 0, 0, (width - listboxParts[0].Width) - listboxParts[1].Width, listboxParts[0].Height ); listBoxButton = new Button( "bt_Combo", "combo_button", position + new Vector2( listboxParts[0].Width + listboxParts[1].Width + listboxParts[2].Width, 0f ), Color.White ); listBoxButton.OnMousePress += new EventHandler( listBoxButton_onMousePress ); }
private void Init () { switch (axis) { case Axis.Horizontal: scrollUp = new Button( "btScrollUp", "scroll_left", position, new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, /*style,*/ true ); scrollDown = new Button( "btScrollDown", "scroll_right", position + new Vector2( size.X - scrollUp.size.Y, 0f ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) ); size.Y = scrollUp.size.Y; break; case Axis.Vertical: scrollUp = new Button( "btScrollUp", "scroll_up", position, new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, /*style,*/ true ); scrollDown = new Button( "btScrollDown", "scroll_down", position + new Vector2( 0f, size.Y - scrollUp.size.Y ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//,/* style,*/ true ); size.X = scrollUp.size.X; break; } CreateTexture(); RedrawScroller(); }
public NumericUpDown ( string name, Vector2 position, int width, int min, int max, int value, int increment ) { Type = ControlType.NumericUpDown; this.name = name; this.position = position; this.width = width; this.min = min; this.max = max; this.value = value; this.increment = increment; if (this.increment == 0) this.increment = 1; textbox = new Textbox( "txt_numericUpDown", position, width, value.ToString(), true );//, HUD.TextFont, Form.Style.Default); buttonUp = new Button( "bt_numericUp", "numeric_up", new Vector2( position.X + width, position.Y - 2 ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, Form.Style.Default, true); buttonDown = new Button( "bt_numericDown", "numeric_down", new Vector2( position.X + width, position.Y + buttonUp.size.Y ), new Color( new Vector4( 0.9f, 0.9f, 0.9f, 1f ) ) );//, Form.Style.Default, true); buttonUp.OnMouseRelease += new EventHandler( onButtonUp ); buttonDown.OnMouseRelease += new EventHandler( onButtonDown ); textbox.OnKeyPress += new EventHandler( onKeyPress ); }