?
Solved

How do you Locate Coordinates of Large Picture Behing Picture Box?

Posted on 2001-09-04
9
Medium Priority
?
203 Views
Last Modified: 2008-03-06
I have a picture box with a extremely large picture behind it.  I use the (picMain.PaintPicture LoadPicture(Pic), x, y) to manuever around the large picture.  How do you determine the x,y coordinates of the large picture?

This is what I'm trying to do:  Inside the large picture box I have 10 small picture boxes that you can move around by clicking on one and then clicking on the location you want to move it to.  To do this I use the Left, Top Coordinates of the picture boxes.  Although, now, I have a large "map" (Much bigger than the large picture box) behind the large picture box that you can move around.  Although, using the left, top properties, when I move to a different position on the main map, the 10 small picture boxes(Units), stay at the same spot on the large picture box instead of staying at their locations on the "map" behind the large picture box.  When I move on the map I want the large picture box to remain in its same position.  The problem with using left, top properties is that when moving on the map it would be possible to move so far that you would not be able to see the small picture boxes any longer(But I'm not sure that with the left,top properties this would be possible).  So I would appreciate any help solving this problem.  Thanks.
0
Comment
Question by:minitrucker87
9 Comments
 
LVL 1

Expert Comment

by:NathanC
ID: 6455565
This will probably be of little help- but maybe give you some ideas-
set picmain.paintpicture.visible = false
set picmain.stretch = false before calling the load
then call the load
take the the height and width of picmain.paintpicture into vars-
create a conversion routine keeping original ratios but creating new dimensions of the picture that match your small boxes-
set picmain.height and width = to return of conversion-
set picmain.stretch = true
set picmain.visible = true

hope it helps...
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6455727
Do  you use vertical / horizontal scroll bars. If so, you could set the top/left properties of the other picture boxes, in the scroll bar click event(s), according to the large picture box's position.
0
 
LVL 1

Expert Comment

by:superchook
ID: 6455946
Also look at the picclip control. (in MS Common COntrols)
It's fast, and very flexible.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Accepted Solution

by:
TimCottee earned 400 total points
ID: 6456887
minitrucker87: So if I understand correctly you want the small picture boxes to stay in the same position relative to the origin of the "Map" rather than the origin of the Picture box in which they are contained? If this is the case then it should be a relatively simple task as all you need to do is when you move the large picture box, determine the difference between the old origin relative to the map and the new origin relative to the map, add/subtract this from the origins of the smaller picture boxes as appropriate. The following code demonstrates an example of how this may be achieved.

Assumptions, large picture box is picLarge, small ones are control array picSmall(0) .. (9)

Private Sub MoveLarge(ByVal dX As Integer, ByVal dY As Integer)
  For intPicture = 0 To 9
    picSmall(intPicture).Left = picSmall(intPicture).Left - dX
    picSmall(intPicture).Top = picSmall(intPicture).Top - dY
  Next
  picLarge.Move picLarge.Left + dX, picLarge.Top + dY
End Sub

This will shift the position of the smaller picture boxes relative to the origin of the larger one as it is similarly moved relative to the origin of the "map". It may not directly apply to your scenario but the principle should be.
0
 
LVL 2

Expert Comment

by:JanusFury
ID: 6459055
Don't touch the picclip control.  Just follow tim's solution.
0
 
LVL 1

Expert Comment

by:superchook
ID: 6459173
I'm curious - what do you have against the picclip control ??

I've used it in several graphics intensive apps, and it provides a very useful set of tools at a high-level...

Not arguing, just wondering ?
0
 
LVL 1

Expert Comment

by:NathanC
ID: 6459313
As long as we are talking tools- LeadTools offers a very extensive set for pciture handling/manipulation.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7207629
Hi minitrucker87@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TimCottee's comment(s) as an answer.

minitrucker87@devx, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7240958
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question