Click here to Skip to main content
15,921,169 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Question about objects and forms Pin
Wendelius10-Oct-08 8:06
mentorWendelius10-Oct-08 8:06 
GeneralRe: Question about objects and forms Pin
sa_runner12-Oct-08 18:00
sa_runner12-Oct-08 18:00 
GeneralRe: Question about objects and forms Pin
Wendelius13-Oct-08 5:17
mentorWendelius13-Oct-08 5:17 
Questionhow to draw a line on a picture box Pin
flamingo210-Oct-08 3:12
flamingo210-Oct-08 3:12 
AnswerRe: how to draw a line on a picture box Pin
Thomas Stockwell10-Oct-08 4:29
professionalThomas Stockwell10-Oct-08 4:29 
AnswerRe: how to draw a line on a picture box Pin
C1AllenS10-Oct-08 4:55
C1AllenS10-Oct-08 4:55 
GeneralRe: how to draw a line on a picture box Pin
flamingo210-Oct-08 9:49
flamingo210-Oct-08 9:49 
Generalhow to draw a rectangle on a pictureBox Pin
flamingo210-Oct-08 20:05
flamingo210-Oct-08 20:05 
I am trying to draw rectangle but it is drawn just with a single click (with different lengths and widths) also it is going out of pictureBox area But i want it to start from where mouse key is pressed and end where mouse key is released. i think there is something wrong with my quardinate. Waiting for reply.
Thanks

[code]

Dim x1, y1, x2, y2 As Integer
Dim MD, MU As Point
Dim mywidth As Integer
Dim drawtool As String
Dim drawpen As Pen
Dim g As Graphics

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
MD = e.Location
x1 = MD.X
y1 = MD.Y
End Sub


Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
If e.Button = Windows.Forms.MouseButtons.Left Then
MU = e.Location
x2 = MD.X
y2 = MD.Y
DrawRectangle()
End Sub


Public Sub DrawRectangle()
gr = PictureBox1.CreateGraphics
Dim solidColorBrush As SolidBrush = New SolidBrush(Color.Red)
Dim coloredPen As Pen = New Pen(solidColorBrush)
coloredPen.Width = 3
coloredPen.Color = Color.Blue

Dim drawArea2 As Rectangle = New Rectangle(x1, y1, x2, y2)
gr.DrawRectangle(coloredPen, drawArea2)
gr.Dispose()

End Sub

[End code]
Questionweb browser Pin
Shazz Rock10-Oct-08 0:45
Shazz Rock10-Oct-08 0:45 
AnswerRe: web browser Pin
jzonthemtn10-Oct-08 3:52
jzonthemtn10-Oct-08 3:52 
GeneralRe: web browser Pin
LloydA11110-Oct-08 8:37
LloydA11110-Oct-08 8:37 
QuestionControls and threads problem Pin
ambio9-Oct-08 22:52
ambio9-Oct-08 22:52 
AnswerRe: Controls and threads problem Pin
Dave Kreskowiak10-Oct-08 1:04
mveDave Kreskowiak10-Oct-08 1:04 
GeneralRe: Controls and threads problem Pin
ambio10-Oct-08 4:40
ambio10-Oct-08 4:40 
GeneralRe: Controls and threads problem Pin
Dave Kreskowiak10-Oct-08 5:14
mveDave Kreskowiak10-Oct-08 5:14 
GeneralRe: Controls and threads problem Pin
ambio12-Oct-08 22:34
ambio12-Oct-08 22:34 
GeneralRe: Controls and threads problem Pin
Dave Kreskowiak13-Oct-08 1:27
mveDave Kreskowiak13-Oct-08 1:27 
GeneralRe: Controls and threads problem Pin
ambio13-Oct-08 2:13
ambio13-Oct-08 2:13 
QuestionTransaction AS400 Pin
helelark1239-Oct-08 20:32
helelark1239-Oct-08 20:32 
AnswerRe: Transaction AS400 Pin
Ashfield9-Oct-08 21:34
Ashfield9-Oct-08 21:34 
GeneralRe: Transaction AS400 Pin
Mycroft Holmes9-Oct-08 21:41
professionalMycroft Holmes9-Oct-08 21:41 
GeneralRe: Transaction AS400 Pin
Wendelius10-Oct-08 7:01
mentorWendelius10-Oct-08 7:01 
AnswerRe: Transaction AS400 Pin
Kschuler10-Oct-08 6:41
Kschuler10-Oct-08 6:41 
AnswerRe: Transaction AS400 Pin
Wendelius10-Oct-08 7:59
mentorWendelius10-Oct-08 7:59 
QuestionSockets, remoting or web services which one to use? Pin
rprateek9-Oct-08 13:08
rprateek9-Oct-08 13:08 

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

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