473,396 Members | 1,836 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,396 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 9657
> 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...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.