.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Drawing Text on a Windows Form using the Draw Method of Graphics Class.

Posted By:Prasanti Prusty       Posted Date: February 27, 2010    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Drawing Text on a Windows Form using the Draw Method of Graphics Class.
 


'Drawing Text on a Windows Form using the Draw Method of Graphics Class.

Public Class frmDrawMethod

    Private Sub frmDrawText_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        'Create the Object of Graphics Class
        Dim grpx As Graphics = e.Graphics
        grpx.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

        'Create Pen Object.
        Dim penRed As Pen = New Pen(Color.Red, 20)
        Dim penYellow As Pen = New Pen(Color.Yellow, 12)

        'call Draw methods
        grpx.DrawLine(Pens.Black, 25, 150, 250, 130)
        grpx.DrawEllipse(penYellow, 20, 15, 100, 100)
        grpx.DrawRectangle(penRed, 150, 10, 100, 100)

    End Sub

End Class


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend