How to Draw a Line ???
-
hi every one,i would like to draw a single line in my form,for that i am using the following code which i got from the samle code,but i just dont know what wrong with my code as i not geting the line,
Dim g As Graphics 'Sets g to a Graphics object representing the drawing surface of the ' control or form g is a member of. 'g = BtnLogin.CreateGraphics g = Me.CreateGraphics Dim myPen As New Pen(Color.White) myPen.DashStyle = Drawing.Drawing2D.DashStyle.Dash myPen.Width = 2 g.DrawLine(myPen, 4, 2, 12, 6)
pls get back to me.after viewing this -
hi every one,i would like to draw a single line in my form,for that i am using the following code which i got from the samle code,but i just dont know what wrong with my code as i not geting the line,
Dim g As Graphics 'Sets g to a Graphics object representing the drawing surface of the ' control or form g is a member of. 'g = BtnLogin.CreateGraphics g = Me.CreateGraphics Dim myPen As New Pen(Color.White) myPen.DashStyle = Drawing.Drawing2D.DashStyle.Dash myPen.Width = 2 g.DrawLine(myPen, 4, 2, 12, 6)
pls get back to me.after viewing thisWhere in your app is this code? Is it in the OnPaint Event of your form? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
hi every one,i would like to draw a single line in my form,for that i am using the following code which i got from the samle code,but i just dont know what wrong with my code as i not geting the line,
Dim g As Graphics 'Sets g to a Graphics object representing the drawing surface of the ' control or form g is a member of. 'g = BtnLogin.CreateGraphics g = Me.CreateGraphics Dim myPen As New Pen(Color.White) myPen.DashStyle = Drawing.Drawing2D.DashStyle.Dash myPen.Width = 2 g.DrawLine(myPen, 4, 2, 12, 6)
pls get back to me.after viewing thisHere's a user control that draws a 3D line like vb 6 has built-in. '------------------------------------- Imports System.Drawing Public Class ThreeDLine Inherits System.Windows.Forms.UserControl #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'UserControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() ' 'ThreeDLine ' Me.Name = "ThreeDLine" Me.Size = New System.Drawing.Size(472, 152) End Sub #End Region Public Enum tOrientation Horizontal Vertical End Enum Public Property Orientation() As tOrientation Get Return m_Orientation End Get Set(ByVal Value As tOrientation) m_Orientation = Value 'Set a "default" height and width If m_Orientation = tOrientation.Horizontal Then Me.Width = 120 Me.Height = 2 Else Me.Width = 2 Me.Height = 100 End If End Set End Property Private m_Orientation As tOrientation Private Sub ThreeDLine_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint 'Draws the line 'Point Variables Dim pL1 As Point Dim pL2 As Point Dim pL3 As Point Dim pL4 As Point 'Create a pen, you can change the colours if they're wrong. Dim DP As New Pen(System.Drawing.SystemColors.ControlDark) Dim LP As New Pen(SystemColors.ControlLight) 'Determine orientation then set the height of the control 'Set the sta