473,325 Members | 2,480 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,325 software developers and data experts.

draw in imagebox

hi, i`ve got 2 imageboxes on each other.
the one at the bottom displays a picture (image1), the other one is for drawing (imagedraw).
imagedraw shows a line when i move the mouse on it, and if i move it a bit furthen than the previous line going to be deleted using "CLS", theres a "zoom" function which is changeing the size of the boxes, and strech them, when this happens the line has dissapear.

i want to add the line to imagedraw or image1 whitout deleting its content.
by the way, i think imagedraw is drawing the line in the form surface, but im not sure...

Expand|Select|Wrap|Line Numbers
  1. private sub imagedraw_mousemove.....
  2. cls
  3. line (x1, y1) - (x2, y2) 
regards: Zsolt
Feb 16 '12 #1

✓ answered by Guido Geurs

You can solve this by placing an image and a line IN a picturebox. Use NOT Picturebox.Line because the line IS NOT AN ELEMENT and you can't scale or distort it.
Calculate, each time you make an adaption on the image, the new coordinates of the line.

Attached is a demo.
Draw the line by MouseDown - Drag - MouseUp in the image.

6 2756
Guido Geurs
767 Expert 512MB
Did you place the line in the PICTUREBOX (not possible to place a line in a IMAGEBOX !) ?
Try to cut the line and paste it in the PICTUREBOX.

Is it possible to attach your project in Bytes so I can see what you exactly want to do with the pictures?
Feb 16 '12 #2
Guido Geurs
767 Expert 512MB
You can't put a line in an imagebox, only in a picturebox.
This is the code:

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Dim Xstart As Integer
  4. Dim Ystart As Integer
  5.  
  6. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  7.     Xstart = X
  8.     Ystart = Y
  9. End Sub
  10.  
  11. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  12.     Picture1.Line (Xstart, Ystart)-(X, Y)
  13. End Sub
Feb 19 '12 #3
sorry for late response
now i know i cant draw in an image box...
but i need to create 2 layers of image, the point is you`ll be able to look trough the one at the top to see the one at the back.
both must be an imagebox because i need to strech them.
i have an idea for this:
the pic at the back will allways be the same (except the strech function), and the one at the top shall allways ready for use...
now what if i draw a line by an imagebox (at a specified position) and draw a same line to a hidden picturebox with the imagebox mouse move function/event, save it to specified path, then open it in the top imagebox

i`ll be able to strech it, because im able to strech images wich are loaded as a picture.

but im stuck, i dont know how to save the drawn lines from the picturebox, it saves a blank picture.
i think this may work what do you think?
Feb 19 '12 #4
Guido Geurs
767 Expert 512MB
You can solve this by placing an image and a line IN a picturebox. Use NOT Picturebox.Line because the line IS NOT AN ELEMENT and you can't scale or distort it.
Calculate, each time you make an adaption on the image, the new coordinates of the line.

Attached is a demo.
Draw the line by MouseDown - Drag - MouseUp in the image.
Attached Files
File Type: zip draw in imagebox_v2.4.zip (39.5 KB, 95 views)
Feb 20 '12 #5
Guido Geurs
767 Expert 512MB
Attached is an expurgated version with comments.
Attached Files
File Type: zip draw in imagebox_v2.5.zip (39.5 KB, 129 views)
Feb 20 '12 #6
thanks its working now
Feb 20 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
I am writing a recursive program to draw the lines recursively, given the range and number of intervals (n) between the range. The problem is I don't know how to draw the line in point 0.375, as...
0
by: Florida Draw | last post by:
------=_NextPart_000_0012_1D5428A2.65C196F8 Content-Type: text/plain Content-Transfer-Encoding: 8bit Sign-up for the FREE Holiday Giveaway Draw You must register to be eligible for the draw....
5
by: Matt | last post by:
I am writing a recursive program to draw the lines recursively, given the range and number of intervals (n) between the range. The problem is I don't know how to draw the line in point 0.375, as...
2
by: cyshao | last post by:
I opened an image and want to change its size, then display it in a ImageBox. How can I do that ? Thanks Charles Shao
3
by: Colin McGuire | last post by:
Hi there. I have written a small procedure to draw various shapes on things. A bit of it is shown below. Private Sub drawShape(ByVal shapeType As Integer, ByRef g As Graphics) Select Case...
1
by: zxo102 | last post by:
Hi everyone, I have tried two days to figure out how to draw the image in wx.BufferedDC on the page created by AddPage of wx.Notebook but still got no clue. The attached example works fine. If...
1
by: ApexData | last post by:
I have an ImageBox with PictureType set to LINK. I have a string with a path strPicFolderPath = "C:\Pictures" In the OnCurrent event of the form I have this code: If...
9
by: zhaow | last post by:
Hi, All Greetings! I want to develop as appllication that requires a line-drawing function in the blank area between two forms. I have looked up the MSDN, it says that a graphics object need a...
2
by: Niu Kun | last post by:
Dear all, I'm trying to draw many overlapped PNG files with transparent background in imagebox control. But the transparent background in this control is rendered as the main control's...
1
by: Sumamadhavanitpark | last post by:
1.loading image in to imagebox using http 2. help for ADrotator
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.