StringExtensionsWordWrap(String, Int32, Font) Method
Wraps words of the source String to the
beginning of the next line when necessary to fit the specified pixel width.
Namespace: DevCase.Extensions.StringExtensionsAssembly: 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 string WordWrap(
this string sender,
int maxWidth,
Font font
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function WordWrap (
sender As String,
maxWidth As Integer,
font As Font
) As String
Dim sender As String
Dim maxWidth As Integer
Dim font As Font
Dim returnValue As String
returnValue = sender.WordWrap(maxWidth,
font)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static String^ WordWrap(
String^ sender,
int maxWidth,
Font^ font
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member WordWrap :
sender : string *
maxWidth : int *
font : Font -> string
No code example is currently available or this language may not be supported.
- sender String
-
The source String.
- maxWidth Int32
-
The maximum width, in pixels.
- font Font
-
The text font.
String
The resulting string.
In Visual Basic and C#, you can call this method as an instance method on any object of type
String. 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 String = "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 String = text.WordWrap(tb.Width, tb.Font)
Me.Controls.Add(tb)
tb.Text = wordWrappedText
Console.WriteLine(wordWrappedText)
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.