Prev: MS video control (msvidctl) to implement digital tv (dmb-th) with
Next: Progressbar in Listview v5 ?
From: Webbiz on 3 Nov 2009 14:13 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'm not sure how I should do this. 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, correct? 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 (whatever was underneath at the time the line was drawn over it)? With the line control, that was not a problem. Just give the coordinates and it would move there without hassle. Suggestions? Thanks! Webbiz
From: Jeff Johnson on 3 Nov 2009 14:47 "Webbiz" <nospam(a)forme.thanks.com> wrote in message news:brv0f5pd1ngeek612n7rie827287f1168h(a)4ax.com... > 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? Quick question: are you trying to create a splitter?
From: Mike Williams on 3 Nov 2009 15:23 "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
From: Webbiz on 3 Nov 2009 16:08 On Tue, 3 Nov 2009 14:47:10 -0500, "Jeff Johnson" <i.get(a)enough.spam> wrote: >"Webbiz" <nospam(a)forme.thanks.com> wrote in message >news:brv0f5pd1ngeek612n7rie827287f1168h(a)4ax.com... > >> 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? > >Quick question: are you trying to create a splitter? > You mean, like for splitting an audio or video time line? No. I'm actually trying to create a thin-line vertical bar that is used to return the information that is below that bar, such as on a stock chart. As you move the mouse, the bar moves. This allows for precise pointing to the area of the chart you want information on. :-) Webbiz
From: Webbiz on 3 Nov 2009 16:12 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
|
Next
|
Last
Pages: 1 2 3 4 Prev: MS video control (msvidctl) to implement digital tv (dmb-th) with Next: Progressbar in Listview v5 ? |