|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
putting a line on my formBack in VB4 there was a line tool in my toolbox that allowed me to put a
decorative line on the form somewhere. Does VB.net 2003 offer this? It's not in the toolbox and I can't find it in the list to add to the toolbox. "cj" <cj@nospam.nospam> schrieb: No, it doesn't.> Back in VB4 there was a line tool in my toolbox that allowed me to put a > decorative line on the form somewhere. Does VB.net 2003 offer this? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> that sucks
Herfried K. Wagner [MVP] wrote: Show quoteHide quote > "cj" <cj@nospam.nospam> schrieb: >> Back in VB4 there was a line tool in my toolbox that allowed me to put >> a decorative line on the form somewhere. Does VB.net 2003 offer this? > > No, it doesn't. > use a 1 pixel high label (horizontal line) or 1 pixel wide label (vertical
line) hth guy Show quoteHide quote "cj" wrote: > Back in VB4 there was a line tool in my toolbox that allowed me to put a > decorative line on the form somewhere. Does VB.net 2003 offer this? > It's not in the toolbox and I can't find it in the list to add to the > toolbox. > I might do that, but I might use GDI graphics. It just seems overly
complicated to use GDI graphics for 1 horizontal line. I'm thinking I'll need to put it in the form paint event too. I wonder which way requires the least resources from the pc, a label 1 pixel high or a gdi graphic generated line? guy wrote: Show quoteHide quote > use a 1 pixel high label (horizontal line) or 1 pixel wide label (vertical > line) > > hth guy > > "cj" wrote: > >> Back in VB4 there was a line tool in my toolbox that allowed me to put a >> decorative line on the form somewhere. Does VB.net 2003 offer this? >> It's not in the toolbox and I can't find it in the list to add to the >> toolbox. >> cj,
I would take the advice from guy, using GDI makes it slow. Cor Show quoteHide quote "cj" <cj@nospam.nospam> schreef in bericht news:uyzyACglGHA.4708@TK2MSFTNGP04.phx.gbl... >I might do that, but I might use GDI graphics. It just seems overly >complicated to use GDI graphics for 1 horizontal line. I'm thinking I'll >need to put it in the form paint event too. I wonder which way requires >the least resources from the pc, a label 1 pixel high or a gdi graphic >generated line? > > guy wrote: >> use a 1 pixel high label (horizontal line) or 1 pixel wide label >> (vertical line) >> >> hth guy >> >> "cj" wrote: >> >>> Back in VB4 there was a line tool in my toolbox that allowed me to put a >>> decorative line on the form somewhere. Does VB.net 2003 offer this? >>> It's not in the toolbox and I can't find it in the list to add to the >>> toolbox. >>> Guy's advice looks and works nice. It's a shame we have to fool VB into
making a line using a label. I've been reading and GDI seems to be the way they want us to make lines now. Cor Ligthert [MVP] wrote: Show quoteHide quote > cj, > > I would take the advice from guy, using GDI makes it slow. > > Cor > > "cj" <cj@nospam.nospam> schreef in bericht > news:uyzyACglGHA.4708@TK2MSFTNGP04.phx.gbl... >> I might do that, but I might use GDI graphics. It just seems overly >> complicated to use GDI graphics for 1 horizontal line. I'm thinking I'll >> need to put it in the form paint event too. I wonder which way requires >> the least resources from the pc, a label 1 pixel high or a gdi graphic >> generated line? >> >> guy wrote: >>> use a 1 pixel high label (horizontal line) or 1 pixel wide label >>> (vertical line) >>> >>> hth guy >>> >>> "cj" wrote: >>> >>>> Back in VB4 there was a line tool in my toolbox that allowed me to put a >>>> decorative line on the form somewhere. Does VB.net 2003 offer this? >>>> It's not in the toolbox and I can't find it in the list to add to the >>>> toolbox. >>>> > > cj,
I am glad you write that, I had already written this is a little bit other way somewhere else. Cor Show quoteHide quote "cj" <cj@nospam.nospam> schreef in bericht news:OMcLGuhlGHA.4696@TK2MSFTNGP05.phx.gbl... > Guy's advice looks and works nice. It's a shame we have to fool VB into > making a line using a label. I've been reading and GDI seems to be the > way they want us to make lines now. > > Cor Ligthert [MVP] wrote: >> cj, >> >> I would take the advice from guy, using GDI makes it slow. >> >> Cor >> >> "cj" <cj@nospam.nospam> schreef in bericht >> news:uyzyACglGHA.4708@TK2MSFTNGP04.phx.gbl... >>> I might do that, but I might use GDI graphics. It just seems overly >>> complicated to use GDI graphics for 1 horizontal line. I'm thinking >>> I'll need to put it in the form paint event too. I wonder which way >>> requires the least resources from the pc, a label 1 pixel high or a gdi >>> graphic generated line? >>> >>> guy wrote: >>>> use a 1 pixel high label (horizontal line) or 1 pixel wide label >>>> (vertical line) >>>> >>>> hth guy >>>> >>>> "cj" wrote: >>>> >>>>> Back in VB4 there was a line tool in my toolbox that allowed me to put >>>>> a decorative line on the form somewhere. Does VB.net 2003 offer this? >>>>> It's not in the toolbox and I can't find it in the list to add to the >>>>> toolbox. >>>>> >> Hi Cj,
I think using GDI+ to draw a line on the form is a better choice. A control like label on the form requires a lot of extra code such as maintaining a message loop, control painting code, maintaining window class structure, interacting with OS Windows Manager component etc.. which more expensive than a single GDI+ line drawing calling. Additionally, Label can only express a vertical or horizontal line on the form and can not meet your bias drawing need. However this can be easily achieved by using GDI+. Using GDI+ is much easier than you think(actually .Net Winform controls internally use GDI+ to draw its appearance). "gene kelley" has provided you a little sample code snippet, you may give it a try. Thanks. Best regards, Jeffrey Tan Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Jeffrey,
Creating a dataclass is as well relative easy, it takes some time, therefore I am glad that Microsoft did it already for us by all those things that are in the system.data namespace. (And have created that great new part in 2.0 around that). Of course you can do everything by a GDI class, but that creating a line in HTML is one of the main tags <HR> means that it is one of the main things. Your statement sound for me that it is no problem to eat with your feets. I prefer using my hands for that. Just my thought, Cor ""Jeffrey Tan[MSFT]"" <je***@online.microsoft.com> schreef in bericht Show quoteHide quote news:HpCu$TolGHA.2260@TK2MSFTNGXA01.phx.gbl... > Hi Cj, > > I think using GDI+ to draw a line on the form is a better choice. A > control > like label on the form requires a lot of extra code such as maintaining a > message loop, control painting code, maintaining window class structure, > interacting with OS Windows Manager component etc.. which more expensive > than a single GDI+ line drawing calling. > > Additionally, Label can only express a vertical or horizontal line on the > form and can not meet your bias drawing need. However this can be easily > achieved by using GDI+. > > Using GDI+ is much easier than you think(actually .Net Winform controls > internally use GDI+ to draw its appearance). "gene kelley" has provided > you > a little sample code snippet, you may give it a try. > > Thanks. > > Best regards, > Jeffrey Tan > Microsoft Online Community Support > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > This posting is provided "AS IS" with no warranties, and confers no > rights. > Jeffrey,
I have even a more important argument. How can I put a line on a screen while being in Designer mode. Cor ""Jeffrey Tan[MSFT]"" <je***@online.microsoft.com> schreef in bericht Show quoteHide quote news:HpCu$TolGHA.2260@TK2MSFTNGXA01.phx.gbl... > Hi Cj, > > I think using GDI+ to draw a line on the form is a better choice. A > control > like label on the form requires a lot of extra code such as maintaining a > message loop, control painting code, maintaining window class structure, > interacting with OS Windows Manager component etc.. which more expensive > than a single GDI+ line drawing calling. > > Additionally, Label can only express a vertical or horizontal line on the > form and can not meet your bias drawing need. However this can be easily > achieved by using GDI+. > > Using GDI+ is much easier than you think(actually .Net Winform controls > internally use GDI+ to draw its appearance). "gene kelley" has provided > you > a little sample code snippet, you may give it a try. > > Thanks. > > Best regards, > Jeffrey Tan > Microsoft Online Community Support > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > This posting is provided "AS IS" with no warranties, and confers no > rights. > true, but which is easier to maintain?
""Jeffrey Tan[MSFT]"" wrote: Show quoteHide quote > Hi Cj, > > I think using GDI+ to draw a line on the form is a better choice. A control > like label on the form requires a lot of extra code such as maintaining a > message loop, control painting code, maintaining window class structure, > interacting with OS Windows Manager component etc.. which more expensive > than a single GDI+ line drawing calling. > > Additionally, Label can only express a vertical or horizontal line on the > form and can not meet your bias drawing need. However this can be easily > achieved by using GDI+. > > Using GDI+ is much easier than you think(actually .Net Winform controls > internally use GDI+ to draw its appearance). "gene kelley" has provided you > a little sample code snippet, you may give it a try. > > Thanks. > > Best regards, > Jeffrey Tan > Microsoft Online Community Support > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message How so? I see adding a label to the form would be slower because the label news:eayfgFglGHA.1640@TK2MSFTNGP02.phx.gbl... > cj, > > I would take the advice from guy, using GDI makes it slow. > > Cor > uses GDI to draw all 4 borders, while using GDI, you just draw one line... Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) e.Graphics.DrawLine(Me.ForeColor, 100, 100, 300, 100) End Sub Code not tested :) HTH, Mythran Mythran,
How about giving me that line in a manner that can be pasted into Form1_Load or Form1_Paint event? I'd like to play with it. Mythran wrote: Show quoteHide quote > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message > news:eayfgFglGHA.1640@TK2MSFTNGP02.phx.gbl... >> cj, >> >> I would take the advice from guy, using GDI makes it slow. >> >> Cor >> > > How so? I see adding a label to the form would be slower because the > label uses GDI to draw all 4 borders, while using GDI, you just draw one > line... > > Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) > MyBase.OnPaint(e) > > e.Graphics.DrawLine(Me.ForeColor, 100, 100, 300, 100) > End Sub > > Code not tested :) > > HTH, > Mythran > On Thu, 22 Jun 2006 17:03:33 -0400, cj <cj@nospam.nospam> wrote:
Show quoteHide quote >Mythran, Private Sub Form1_Paint(ByVal sender As Object, ByVal e _> >How about giving me that line in a manner that can be pasted into >Form1_Load or Form1_Paint event? I'd like to play with it. > > >Mythran wrote: >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message >> news:eayfgFglGHA.1640@TK2MSFTNGP02.phx.gbl... >>> cj, >>> >>> I would take the advice from guy, using GDI makes it slow. >>> >>> Cor >>> >> >> How so? I see adding a label to the form would be slower because the >> label uses GDI to draw all 4 borders, while using GDI, you just draw one >> line... >> >> Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) >> MyBase.OnPaint(e) >> >> e.Graphics.DrawLine(Me.ForeColor, 100, 100, 300, 100) >> End Sub >> >> Code not tested :) >> >> HTH, >> Mythran >> As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Dim bPen As New Drawing.Pen(Color.Chocolate, 1) e.Graphics.DrawLine(bPen, 0, 100, Me.Width, 100) bPen.Dispose() End Sub Gene Thanks for this code. I was just dealing with the same issue recently,
and also could not believe vb.net doesn't have the "line" tool anymore. gene kelley wrote: Show quoteHide quote > On Thu, 22 Jun 2006 17:03:33 -0400, cj <cj@nospam.nospam> wrote: > > >Mythran, > > > >How about giving me that line in a manner that can be pasted into > >Form1_Load or Form1_Paint event? I'd like to play with it. > > > > > >Mythran wrote: > >> > >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message > >> news:eayfgFglGHA.1640@TK2MSFTNGP02.phx.gbl... > >>> cj, > >>> > >>> I would take the advice from guy, using GDI makes it slow. > >>> > >>> Cor > >>> > >> > >> How so? I see adding a label to the form would be slower because the > >> label uses GDI to draw all 4 borders, while using GDI, you just draw one > >> line... > >> > >> Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) > >> MyBase.OnPaint(e) > >> > >> e.Graphics.DrawLine(Me.ForeColor, 100, 100, 300, 100) > >> End Sub > >> > >> Code not tested :) > >> > >> HTH, > >> Mythran > >> > Private Sub Form1_Paint(ByVal sender As Object, ByVal e _ > As System.Windows.Forms.PaintEventArgs) Handles Me.Paint > Dim bPen As New Drawing.Pen(Color.Chocolate, 1) > e.Graphics.DrawLine(bPen, 0, 100, Me.Width, 100) > bPen.Dispose() > End Sub > > Gene cj,
In addition to the other comments: The following articles discusses how to create a .NET Line control that wraps Win32 STATIC controls. useful for lines in dialog boxes (not grids per se). http://www.codeproject.com/cs/miscctrl/hvrules1.asp -- Show quoteHide quoteHope this helps Jay B. Harlow [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "cj" <cj@nospam.nospam> wrote in message news:eVgRljflGHA.1272@TK2MSFTNGP03.phx.gbl... | Back in VB4 there was a line tool in my toolbox that allowed me to put a | decorative line on the form somewhere. Does VB.net 2003 offer this? | It's not in the toolbox and I can't find it in the list to add to the | toolbox. |
|||||||||||||||||||||||