Solved

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

Posted on 2001-09-04
9
187 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now