Skip to content

Commit

Permalink
add input box to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wolframhaussig committed Feb 24, 2024
1 parent 22aa880 commit c9cf380
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ Has the following additional characteristics:
* Supports providing hints to be shown when the control does not have focus and the value is empty.
* Supports delaying `TextChanged` events

### Interaction.InputBox => StylableInputBox
With the `StylableInputBox`, you can create forms similar to VB.NETs `Interaction.InputBox` but the handling is a bit different as we allow you to style the form
before showing.

Let's create an input box first:
```csharp
StylableInputBox<NumericUpDown> iBox = StylableInputBox<NumericUpDown>.BUILDER
.WithTitle("Numeric Test", MessageBoxIcon.Information)
.WithText("Please enter a random number between -100 and 100")
.WithHelpButton(new Uri("https://github.com/Assorted-Development/winforms-stylable-controls"))
.WithTimeout(TimeSpan.FromSeconds(30), DialogResult.Cancel)
.ForNumericValue(0, -100, 100);
```
This will create an input box for numeric values (currently, we support text and numeric) with a title and a message and two buttons: Okay, Cancel
Now, let's style the form as we want to: `iBox.StylableControls.Text.ForeColor = Color.Red;`
At last, you can show the dialog using `iBox.ShowDialog()`

**Note:** If you change the size on the controls (e.g. increase the font size), please call `UpdateSize()` to update the UI to the new settings. Otherwise, the Ui may look weird.


## Contributions

Expand Down

0 comments on commit c9cf380

Please sign in to comment.