Solved

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

Posted on 2001-09-04
9
188 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
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now