Click here to Skip to main content
       

Visual Basic

 
GeneralRe: fill a webpage from vb.net 2010 PinmemberPaul Conrad24-Sep-12 17:00 
QuestionSocket Voice Chat PinmemberMember 769141624-Sep-12 4:33 
AnswerRe: Socket Voice Chat PinmemberEddy Vluggen24-Sep-12 4:49 
GeneralRe: Socket Voice Chat PinmemberMember 769141624-Sep-12 5:03 
AnswerRe: Socket Voice Chat PinmemberEddy Vluggen24-Sep-12 5:08 
QuestionHow can I do to make my vb player be able to play in a specific portion of time Pinmembersosthenes paul21-Sep-12 0:52 
AnswerRe: How can I do to make my vb player be able to play in a specific portion of time PinmemberEddy Vluggen21-Sep-12 3:07 
QuestionVisable Line Draw PinmemberMember 939749920-Sep-12 21:25 
Hello, i need help with this code to make the line visable as drawing and not just after. any help would be great
Public Class Form1
     
        'The lines that have been drawn but not saved.
        Private lines As New List(Of Line)
     
        'The start point of the line currently being drawn.
        Private start As Point
     
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Place a blank image in the PictureBox control.
            Me.PictureBox1.Image = New Bitmap(Me.PictureBox1.Width, Me.PictureBox1.Height)
        End Sub
     
        Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
            'Remember the point at which the line started.
            Me.start = e.Location
        End Sub
     
        Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
            'Remember the point at which the line ended.
            Dim [end] As Point = e.Location
     
            'Add the new line to the list.
            Me.lines.Add(New Line(Me.start, [end]))
     
            Dim area As New Rectangle(Math.Min(Me.start.X, [end].X), _
                                      Math.Min(Me.start.Y, [end].Y), _
                                      Math.Abs(Me.start.X - [end].X), _
                                      Math.Abs(Me.start.Y - [end].Y))
     
            'Inflate the rectangle by 1 pixel in each direction to ensure every changed pixel will be redrawn.
            area.Inflate(1, 1)
     
            'Force the control to repaint so the new line is drawn.
            Me.PictureBox1.Invalidate(area)
            Me.PictureBox1.Update()
        End Sub
     
        Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
            'Draw each line on the control.
            Me.DrawLines(e.Graphics)
        End Sub
     
        Private Sub Save()
            'Create a Graphics object from the Image in the PictureBox.
            Using g As Graphics = Graphics.FromImage(Me.PictureBox1.Image)
                'Draw each line on the image to make them permanent.
                Me.DrawLines(g)
            End Using
     
            'Clear the temporary lines that were just saved.
            Me.Clear()
        End Sub
     
        Private Sub Clear()
            'Clear all unsaved lines.
            Me.lines.Clear()
     
            'Force the control to repaint so the lines are removed.
            Me.PictureBox1.Refresh()
        End Sub
     
        Private Sub DrawLines(ByVal g As Graphics)
            For Each line As Line In Me.lines
                g.DrawLine(Pens.Black, line.Start, line.End)
            Next line
        End Sub
     
    End Class
     
    Public Class Line
     
        'The line's start point.
        Private _start As Point
     
        'The line's end point.
        Private _end As Point
     
        'The line's start point.
        Public Property Start() As Point
            Get
                Return Me._start
            End Get
            Set(ByVal value As Point)
                Me._start = value
            End Set
        End Property
     
        'The line's end point.
        Public Property [End]() As Point
            Get
                Return Me._end
            End Get
            Set(ByVal value As Point)
                Me._end = value
            End Set
        End Property
     
        Public Sub New()
            Me.New(Point.Empty, Point.Empty)
        End Sub
     
        Public Sub New(ByVal start As Point, ByVal [end] As Point)
            Me._start = start
            Me._end = [end]
        End Sub
     
    End Class

AnswerRe: Visable Line Draw PinmemberEddy Vluggen21-Sep-12 3:02 
GeneralRe: Visable Line Draw PinmemberMember 939749921-Sep-12 8:56 
GeneralRe: Visable Line Draw PinmvpRichard MacCutchan21-Sep-12 21:19 
GeneralRe: Visable Line Draw PinmemberEddy Vluggen21-Sep-12 22:53 
AnswerRe: Visable Line Draw PinmvpRichard MacCutchan21-Sep-12 3:20 
Questionvb 6.0 API PinmemberAinnop20-Sep-12 4:15 
AnswerRe: vb 6.0 API PinmemberWes Aday20-Sep-12 4:26 
GeneralRe: vb 6.0 API PinmemberAinnop20-Sep-12 4:46 
AnswerRe: vb 6.0 API PinmemberEddy Vluggen20-Sep-12 4:48 
GeneralRe: vb 6.0 API PinmemberWes Aday20-Sep-12 4:52 
GeneralRe: vb 6.0 API PinmemberMember 939749921-Sep-12 8:51 
GeneralRe: vb 6.0 API PinmemberWes Aday21-Sep-12 8:54 
AnswerRe: vb 6.0 API PinmemberJoan Murt20-Sep-12 6:37 
Questionvb 2008 methods Pinmemberdcof18-Sep-12 8:28 
AnswerRe: vb 2008 methods PinmvpRichard MacCutchan18-Sep-12 9:44 
GeneralRe: vb 2008 methods Pinmemberdcof19-Sep-12 4:04 
GeneralRe: vb 2008 methods PinmemberSteven St. John19-Sep-12 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 21 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid