Use ControlChars.Lf in VB.NET

A control character is a code point in a character set, ControlChars.Lf stands for the line feed character (LF) causes the device to put the printing position on the next line.
  • 4378

ControlChars.Lf

A control character is a code point in a character set, that does not in itself represent a written symbol. It is in-band signaling in the context of character encoding. When you call print and display functions, you can use the following constants in your code in place of the actual values.

Constant is a meaningful name that takes the place of a number or string that does not change. Constants store values that, as the name implies, remain the same throughout the execution of an application. The Lf in ControlChars.Lf stands for the line feed character (LF) causes the device to put the printing position on the next line. It may, depending on the device and its configuration.

Lets have an example of ControlChars.Lf:

Example

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports
System.Windows.Forms
 
Public Class information
    Public Shared Sub
Main()
        Application.Run(New Form1)
    End Sub
End Class
 

Public Class Form1
    Inherits
System.Windows.Forms.Form
 
    Protected Overrides Sub onpaint(ByVal a As PaintEventArgs)
        Dim gr As Graphics = Me.CreateGraphics()
        Dim clr As Color = Color.FromArgb(255, 200, 0, 100)
        Dim hue As Single = clr.GetHue()
        Dim saturation As Single = clr.GetSaturation()
        Dim brightness As Single = clr.GetBrightness()
        Dim str As String = "Hue: " + hue.ToString() + ControlChars.Lf + "Saturation: " + saturation.ToString() +
       
ControlChars
.Lf + "Brightness: " + brightness.ToString()
       
gr.DrawString(str, New Font("verdana", 14), Brushes.Green, 60, 65)
        gr.Dispose()
  
    End Sub
 
    Public Sub New()
 
        MyBase.New()
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 16)
        Me.ClientSize = New System.Drawing.Size(300, 290)
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
 
    End Sub
 
End Class

Output:

paint.gif

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.