473,379 Members | 1,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Draw line on picture

Hello,

Ive to draw a line on a picture i used this code:

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
x1 = z.X
y1 = z.Y
lbl3 = "x1: " & x1
lbl4 = "y1: " & y1
With Line1
.Visible = True
.x1 = X
.y1 = Y
.x2 = X
.y2 = Y
Drawing = True
End With
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If Drawing Then
With Line1
.x2 = X
.y2 = Y
End With
End If

End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
x2 = z.X
y2 = z.Y
lbl5 = "x2: " & x2
lbl6 = "y2: " & y2
Drawing = False
With Line1
Me.Line (.x1, .y1)-(.x2, .y2)
.Visible = False
End With
End Sub
But i doesnt draw on the picture, only on the form??/
Can someone help me with this??

Thx in advance

Dennis
Jul 17 '05 #1
1 9653
> Ive to draw a line on a picture i used this code:

.....<code snipped>.....

But i doesnt draw on the picture, only on the form??/
Can someone help me with this??


Where is the picture? In a PictureBox that is on the form? If so, then
you have to place the Line control INSIDE of the PictureBox. There are
two ways to do this.

First method... after placing the Line control on the form by
double-clicking it from the ToolBox, cut it from the Form by selecting
it (if not already selected) and then pressing Ctrl+X, then select the
PictureBox and paste the Line control into it by pressing Ctrl+V.

Second method... don't double-click the Line control in the first place;
instead, click on it once in the ToolBox to select it, then click and
drag the mouse directly in the PictureBox to place the Line control
directly within the PictureBox.

Rick - MVP

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dennis | last post by:
I started a new thread because i cant reply on the older one. Thank you very much Rick for the usefull reply. But i'v got another question. When drawing the line, you cant see the line untill you...
3
by: ACaunter | last post by:
Hi there, I was wondering how i could draw a line on an image to find the distance (in mm or cm) from the one point to the other point. -- AdamPC@hotmail.com
6
by: Brad Shook | last post by:
Can someone point me to an example or post some code on how to allow a user to draw a rectangle on top of an image and retrieve the coordinates and dimensions of it. They will also need to be able...
4
by: icek | last post by:
How draw point on picture of map in php
1
by: berry | last post by:
Hi all.. How to draw a line graph? My axis-x is the daily hour from 8am to 8pm. Can i use a XY mschart type to draw it? Or I must use a picture box to draw it? If with XY chart type, how to draw?...
8
by: Anuhas | last post by:
Dear experts, I have used buttons to indicate certain locations on a map.(Just a picture used as form background) I am going to draw lines...
4
by: martinsmith160 | last post by:
Hi Everyone I am creating a level bulider using windows forms and the background for the level is stored in a picture box control. All i want to do is draw a number of lines over the image to...
1
by: martinsmith160 | last post by:
Hi all I am trying to create a level builder tool for a final year project and im having some problems drawing. I have placed a picture box within a panel so i can scroll around the image which is...
8
by: martinsmith160 | last post by:
Hi all I have a picture box placed within a panel so i can scroll across the picture due to it being very wide. My problem is I want to draw an image over the picture box when a user clicks at a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.