erm greetings..

i have a situation here regarding picturebox. there are 2 boxes, 1 is for template image, and one for image to be compared with. i planned to make the user able to draw a box in template image picbox, as a region where the image the other picbox will be compared with, in terms of its colour components. it will display the difference between the two images in percentage.

the problem is making the box visible when doing the region selection part. i cant seem to properly generate temporary marking lines on the template image. all i get in the end is an array of boxes in different size within a maximum size box, which all of the boxes start at the point of the click.

i can however, make a box at the end of the click and drag procedure, but that doesnt give any visual feedback during the region selection process, which is the clicking and dragging. the box is not there, until you release the mouse button, that makes it hard for the user.

i used the usual

Tempbox.DrawLine (x,y)

to draw lines between initial clicking points and other points.

any suggestions would be greatly appreciated.

thanks in advance

Recommended Answers

All 5 Replies

why can't you do it on mouse_move? On mousedown set a boolean flag variable that says that the mouse is down. On mouseup clear the boolean flag variable (set it to false). On the mousemove procedure, check if the flag variable is true, and if so, draw the line..... if the flag variable is false, don't draw the line.... or am I completely missing the mark here?

Not entirely. Before this I did it in mousemove with a flag, that's when the array of boxes appear. Small boxes inside bigger boxes. What i'm trying to do here is a region selection box, which defines the border of the region in the image I'm going to compare with another. Is there any specific function that can be readily used?

Nothing that is readily, so to speak. You may have a look at bitblt or stretchblt to copy pieces of the image, but as for the whole region selection issue, I have no pre-defined method. Good luck, let me know what you find.

it's ok i found the solution, that is shpcrop, a crop box. never knew such thing existed.

thanks for your time.

Cool! Thanks for posting the solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.