Prev: Differences between VB5 and VB6
Next: Creating ADD ONS
From: David on 11 Feb 2010 22:59 One thought is something like this: 1) Set Property FirstInPBox for all Line to False For i = 0 To UBound(TLines) TLines(i).FirstInPBox = False Next 2) Now Flag the !st line in Each PBox For i = 0 to UBound(PBox) For j = 0 to UBound(TLines) If i = TLines(j).ThisPBox THen TLines(j).FirstInPBox = True Exit For End If Next Next "Bob Butler" <noway(a)nospam.ever> wrote in message news:OsUjIk4qKHA.4636(a)TK2MSFTNGP06.phx.gbl... > > "David" <NoWhere(a)earthlink.net> wrote in message > news:OSXC1c4qKHA.5936(a)TK2MSFTNGP04.phx.gbl... >> Mr. Butler: >> Thanks for taking a look see. >> >> First your correct on this declare >> >>>> Type TPBox(PBoxNumber) >>> >>> You can't declare a type as an array like that so that isn't valid VB >>> code >>> >> >> My error, was trying to cut corners and show that the structure was an >> array. >> >> ====================== >> >> There is a lot of code (many procedures) so difficult to post. >> ======================== >> >> Bottom line is I'm trying to track different objects (e.g. lines) which >> can be drawn and moved -- at user selection -- between different >> pictureboxes. >> >> Since the first line drawn in each picturebox determines the scale for >> the picturebox, the movement of that line to a "new" picturebox would >> corrupt any other lines in the "old" picturebox. >> >> Looking for a simple yet effective method to do this. > > OK, setting aside how to do it for a moment... I as a user draw a few > lines on the first PB, a couple on the second, and none on the third... > > Now I "move" the first line from the first PB to the second (which already > has some) > -- what happens on the first PB? does the second line drawn now become > the basis for scaling? Does the first line remain since it set the scale? > -- what happens on the second PB? does the line being moved get re-scaled > to fit the scale already set or does it become the new "first" line and > cause whatever is there already to be rescaled? > > If I move the line to the third PB instead (which has nothing already) I'd > assume it would become the first line there but the question of what > happens on the first PB still holds? > > I'm unclear how one line defines scale for the others but it one line is > different than all others in a set then I'd probably consider treating it > differently... maybe *always* having a scale line on each PB that the user > can manipulate but not move to another PB; possibly having these scaling > lines in an array of their own or otherwise defined apart from the arrays > of "regular" lines for each PB. >
From: Mike Williams on 12 Feb 2010 04:04 "David" <NoWhere(a)earthlink.net> wrote in message news:OUjB3H5qKHA.3792(a)TK2MSFTNGP05.phx.gbl... > 1) The first line in any PBox determines the scale. You are ommitting important stuff, David. Exactly HOW does the first line determine the scale? And what EXACTLY does it determine the scale of? Do you mean that it alters the ScaleMode of the PictureBox, and if so then by what mechanism does it do so. Otherwise, if it is not the ScaleMode you are altering then what alternative method are you using. Is it something about the property of the line itself? In other words, is it not really a line you have "drawn". You seem to be missing out important parts of your code and details about the lines themselves is one of them. You say that you are "drawing" them, and yet you also say that you are sometimes "moving" some of them into another different PictureBox without expanding on the code you are using to actually perform that task. It is of course possible to move actual drawn lines, but it requires code to do so and also a record somewhere of the drawn line's coordinates (which do not appear in the Type structure you posted) and so your ommission of any remarks regarding such data or code makes me think that you are actually placing Line Controls in the PictureBox instead of actually "drawing" the lines. Is that what you are doing? Whatever it is, I think you need to tell us a lot more about what you are actually doing. A rough outline overview of the entire job in ordinary English without any mention of code or methods is perhaps the best place to start, because the methods you are currently using may or may not be the best way to do it. Mike
From: Larry Serflaten on 12 Feb 2010 08:24 "David" <NoWhere(a)earthlink.net> wrote > One thought is something like this: This is yet another example of a person asking what a forest is, when they bring you a leaf. "I've got this leaf, how do I connect it to a branch?" So far, its told: 1. There are pictureboxes 2. There are lines in the pictureboxes. 3. The first line in a picturebox determines the scale. 4. Lines can be moved among pictureboxes. And the question; How does a picturebox know what line governs the scale? How about this for an answer.... Associate a Collection of lines to each picturebox and make the first line in the collection the controlling entity. LFS
From: Bob Butler on 12 Feb 2010 08:41 "David" <NoWhere(a)earthlink.net> wrote in message news:OUjB3H5qKHA.3792(a)TK2MSFTNGP05.phx.gbl... > OK -- Trying to keep this post simple, I don't think you'll be able to get much more help unless you can elaborate. From what you've said so far I'd either have the "first lines" in their own array or having the first entry in each array controlling the scale (whatever that means) and forget about the "FirstInPB" flag.
From: David on 12 Feb 2010 09:37
Mr. Williams Not using a line control but API Moveto, Lineto Mr. Butler Using the first in the PBox, with the "FirstInPBox" flag because if I expand this to include circles and rectangles it may be required. In relooking at my loop code, it will work well for just lines but has issues if circles and rectangles are added to the same picturebox. Hence another tracking method is needed. Mr. Serflaten: Originally had thought of using a collection of lines -- a structured array is basically the same thing, but wasn't sure how to go about handling the addition of circles and rectangles within the "line" collection. ========================== After playing with this last evening, looks like some form of MetaFile may work best. The biggest issue with a MetaFile as I see it is finding the right entry to delete and then flag when one object is moved. "Larry Serflaten" <serflaten(a)usinternet.com> wrote in message news:uzZRYa%23qKHA.728(a)TK2MSFTNGP04.phx.gbl... > > "David" <NoWhere(a)earthlink.net> wrote >> One thought is something like this: > > This is yet another example of a person asking what a forest is, when > they bring you a leaf. "I've got this leaf, how do I connect it to a > branch?" > > So far, its told: > > 1. There are pictureboxes > 2. There are lines in the pictureboxes. > 3. The first line in a picturebox determines the scale. > 4. Lines can be moved among pictureboxes. > > And the question; > > How does a picturebox know what line governs the scale? > > How about this for an answer.... > > Associate a Collection of lines to each picturebox and make the first > line in the collection the controlling entity. > > LFS > > > |