Skip to content
dzamkov edited this page Feb 7, 2011 · 2 revisions

A Button is a simple control that gives a Click event when clicked. Button's can optionally contain a client control, such as a label. The style of a Button consists of three surfaces, one normal surface shown when the user is not interacting with the button, a active surface for when the user has the mouse over the button but the mouse is not pushed down, and a pushed surface for when the mouse is over the button and the primary mouse button is held down. In order to trigger a click event, the user has to release the primary mouse button while the mouse is over the button.

Examples

Button Test { Button b1 = new Button("I am a button"); Button b2 = new Button( Skin.Default.GetSurface(new SkinArea(64, 96, 16, 16)).WithAlign(Align.Center, Align.Center).CreateControl()); FlowContainer flow = new FlowContainer(10.0, Axis.Vertical); flow.AddChild(b1, 30.0); flow.AddChild(b2, 30.0); Form form = new Form(new SunkenContainer(flow.WithMargin(10.0)).WithBorder(1.0), "Button Test"); form.ClientSize = new Point(180.0, flow.SuggestLength + 22.0);

    // With lc being a layer container for the GUI.
    lc.AddControl(form, new Point(0.0, 0.0));
}

Clone this wiki locally