473,565 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Bu tton 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 9690
> 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
6560
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 release the mouse button. I want to see the line when im drawing!! Im using the following code: Private Sub Picture1_MouseDown(Button As...
3
1988
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
4782
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 to move it around on the picture and delete it. Thanks Brad Shook
4
2711
by: icek | last post by:
How draw point on picture of map in php
1
4368
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? Thank you..
8
2296
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 interconnecting these buttons(locations). But I dont know how to draw lines connecting those buttons. Can I draw lines using...
4
4620
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 create a grid allowing better placement on the builder. here is my code so far. It draws a single line but if i place a control over it, it is drawn...
1
5583
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 working fine. My aim is to double click the picture box and the desired image will be drawn at the mouse position. This works fine unless I scroll or...
8
3808
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 desired location. I have this working but when i scroll the panel or minimise the form the drawing is wiped away. Is there a method to draw on the...
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7951
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.