From: Webbiz on
On Tue, 03 Nov 2009 15:12:14 -0600, Webbiz <nospam(a)forme.thanks.com>
wrote:

>On Tue, 3 Nov 2009 20:23:29 -0000, "Mike Williams"
><Mike(a)WhiskyAndCoke.com> wrote:
>
>>
>>"Webbiz" <nospam(a)forme.thanks.com> wrote in message
>>news:brv0f5pd1ngeek612n7rie827287f1168h(a)4ax.com...
>>
>>> Usually, when I want to create a vertical line that can be moved
>>> across a PicBox, I simply add a Line control onto the PicBox
>>> during design time. However, I'm opening up PicBoxes during
>>> Run-time from a PicBox control array, loading and unloading
>>> them. When I load a new picbox, it won't have a line control
>>> within . . . I'd like a line control to be contained in each Picbox
>>> loaded and unloaded, but I believe the only way to do this
>>> is to create a User Control? If I don't create a UC but want to
>>> stick to my current array of Picboxes, how might I simulate a
>>> vertical line that moves across the picbox as the mouse moves?
>>> Now I know that I can draw a line using the picbox.line method.
>>> But as I move the mouse, I'll need to delete the previous line so
>>> it makes it look like the vertical line is moving. How would I do
>>> this, and do it without erasing anything that the line has drawn
>>> over . . .
>>
>>Drawing the line in such a way is fairly easy, but if you would prefer to
>>stick with the simplicity of a Line Control then you can do it that way
>>instead. Simply start off with a Line Control with an Index of zero (in the
>>same way as I presume you are starting off with a PictureBox with an Index
>>of zero) and then load another element of the Line Control array in the same
>>way as you are already loading another element of the PictureBox array. For
>>example:
>>
>>Load Picture1(n)
>>Load Line1(n)
>>Set Line1(n).Container = Picture1(n)
>>Picture1(n).Move 0, 0 ' or wherever you want it
>>Line1(n).X1 = Picture1(n).ScaleWidth / 2
>>Line1(n).X2 = Line1(n).X1
>>Line1(n).Y1 = 0
>>Line1(n).Y2 = Picture1(n).ScaleHeight
>>Picture1(n).Visible = True
>>Line1(n).Visible = True
>>
>>Mike
>>
>
>
>Oh, that's right. You can assign a control's container. Never done it
>before, but it's pretty straightforward.
>
>Before I do this, which approach would you use Mike? I know you're a
>graphics genius with VB6, and perhaps you might make a suggestion for
>performance sake?
>
>If this info is needed to make such a suggestion, note that the
>maximum picboxes open at any time is 4.
>
>Thanks.
>
>Webbiz


Quick question on the addition of a Line control array.

If you assign the Line Control container as the picbox, and you unload
the picbox, will that automatically unload the controls it contains?

Thanks.

Webbiz
From: Jeff Johnson on
"Webbiz" <nospam(a)forme.thanks.com> wrote in message
news:gp61f5dmkcp5cvbjqcikrpb48esepecd78(a)4ax.com...

>>Quick question: are you trying to create a splitter?
>>
>
> You mean, like for splitting an audio or video time line?

No, I meant like for changing the size between two objects, like the message
list and the reading pane of your newsreader.


From: Mike Williams on
"Webbiz" <nospam(a)forme.thanks.com> wrote in message
news:9171f5pk6rlsp0m9c0bfemdg39dk31g9u4(a)4ax.com...

> Oh, that's right. You can assign a control's container. Never
> done it before . . . Before I do this, which approach would
> you use Mike? . . . perhaps you might make a suggestion for
> performance sake? If this info is needed to make such a
> suggestion, note that the maximum picboxes open at any time
> is 4.

On the grounds of simplicity and ease of coding I think I would use a Line
Control. The time in either case for the line to be drawn will be a few
microseconds or less whereas the minimum possible time between successive
mouse move events is something in the region of 15000 microseconds, so
you're using just a tiny fraction of the available time whichever method you
use.

Mike





From: Mike Williams on
"Webbiz" <nospam(a)forme.thanks.com> wrote in message
news:4j71f5dn7qfnhtu3vbc7fpns00kmi3heif(a)4ax.com...

> Quick question on the addition of a Line control array.
> If you assign the Line Control container as the picbox, and
> you unload the picbox, will that automatically unload the
> controls it contains?

No. In fact if you attempt to unload a PictureBox which is the container for
one or more Controls then you will get the error, "Unable to unload within
this context". In order to Unload the PictureBox you will need to either
Unload all the Controls it contains or alternatively move them into the Form
or into some other container. In your case I would simply Load both the
PictureBox and its associated Line Control together (the PictureBox first,
of course) and then when you want to Unload them you should Unload both of
them, unloading the Line first and then the PictureBox. It makes sense
anyway for both the PictureBox and its associated contained Line Control to
have the same Index number, so you might as well load and unload them
together.

Mike



From: Eduardo on

> Quick question on the addition of a Line control array.
>
> If you assign the Line Control container as the picbox, and you unload
> the picbox, will that automatically unload the controls it contains?

No.