StringBuilderExtensionsWordWrap(StringBuilder, Int32, Font) Method
Wraps words of the source StringBuilder to the
beginning of the next line when necessary to fit the specified pixel width.
Namespace: DevCase.Extensions.StringBuilderExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static StringBuilder WordWrap(
this StringBuilder sb,
int maxWidth,
Font font
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function WordWrap (
sb As StringBuilder,
maxWidth As Integer,
font As Font
) As StringBuilder
Dim sb As StringBuilder
Dim maxWidth As Integer
Dim font As Font
Dim returnValue As StringBuilder
returnValue = sb.WordWrap(maxWidth,
font)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static StringBuilder^ WordWrap(
StringBuilder^ sb,
int maxWidth,
Font^ font
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member WordWrap :
sb : StringBuilder *
maxWidth : int *
font : Font -> StringBuilder
No code example is currently available or this language may not be supported.
- sb StringBuilder
-
The source StringBuilder.
- maxWidth Int32
-
The maximum width, in pixels.
- font Font
-
The text font.
StringBuilder
The resulting string.
In Visual Basic and C#, you can call this method as an instance method on any object of type
StringBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim tb As New TextBox With {
.Multiline = True,
.ScrollBars = ScrollBars.Both,
.WordWrap = False,
.Size = New Drawing.Size(width:=250, height:=200)
}
Dim text As New StringBuilder
text.Append("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
Dim wordWrappedText As StringBuilder = text.WordWrap(tb.Width, tb.Font)
Me.Controls.Add(tb)
tb.Text = wordWrappedText.ToString()
Console.WriteLine(wordWrappedText.ToString())
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.