Results 1 to 13 of 13

Thread: Beta test my line control please...

  1. #1

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Beta test my line control please...

    Ok, I got tired of everyone complaining about the lack of a line control in VB.Net, so I created one. Will all of you please check it out and see how it works. I basically need a beta test of it to check to be sure it works correctly.

    Some things to help you get started:
    Right-Click on your toolbox and click customize toolbox. Click the .Net Framework components tab. Click the browse button to locate where you extracted the dll at. Double click it. The toolbox customizer should add it, and check it for you. It will now be in your toolbox to use. Look at the bottom.

    Set the Angle property to get the desired effect needed.

    After setting the Angle property, resize the control to get the angle and/or size you desire.

    Set the LineWidth property to get a thicker or thinner line (float value).

    Set the Color property to change the lines color.

    Also, right-click the control and send to background if it overlaps any other controls.

    Good luck all, and I am looking forward to your feedback...

  2. #2

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Forgot to attach the file:
    Attached Files Attached Files

  3. #3

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    The only problem I have found is that the background isn't opaque. I am trying to find a solution to this, and if anyone knows how, please do tell..lol.

  4. #4
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by hellswraith
    The only problem I have found is that the background isn't opaque. I am trying to find a solution to this, and if anyone knows how, please do tell..lol.
    why do you need to do that? just override the resize event and make sure that the user can only resize the control lengthwise. wouldn't that work?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Nicely done . Thank you !
    Last edited by Pirate; May 28th, 2003 at 05:54 PM.

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Ok, I got tired of everyone complaining about the lack of a line control in VB.Net
    Yeah. God forbid someone actually having to type 2 whole lines of actual code!

    LOL.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by MrPolite
    why do you need to do that? just override the resize event and make sure that the user can only resize the control lengthwise. wouldn't that work?
    That isn't the problem, the problem comes when they make the line at an angle. Then the 'square' area that the user control takes up becomes quite large. When the line is horizontal or vertical, everything is perfect.

  8. #8

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I have a slightly updated version here:
    http://www.variantx.com/Main/DevTool...neControl.aspx
    not much has changed though.

  9. #9
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    hmm have you looked at SetStyle ()? there is an option for transparency, as far as I remember. btw you never told me why you're inheriting from Control and not UserControl? What's the difference?

    another though: isn't it possible to draw the line on the form, rather than drawing it in the usercontrol? I know you can easily draw something on the form, but is it possible to draw a line that passes over all the controls in the form ?(basically like a line that has the highest ZOrder and is on top of some controls)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I have done the SetStyle already, but it doesn't work so well.

    I thought about trying to get the graphics object of the form, and just directly drawing on it, but I couldn't figure out a way to get the graphics object from the form.

  11. #11

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I forgot to tell you about why I was inheriting from control and not usercontrol. It is because the documentation said that if I am going to be drawing my control using the paint event, then to inherit from control.

  12. #12
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by hellswraith
    I forgot to tell you about why I was inheriting from control and not usercontrol. It is because the documentation said that if I am going to be drawing my control using the paint event, then to inherit from control.
    I dont know the difference between control and usercontrol
    anyways I tried this with a usercontrol and it compiled. I didn't actualy test it though. So I guess you can draw on the form this way. But I really don't know how to draw on the controls that are on the form

    VB Code:
    1. Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         AddHandler Me.ParentForm.Paint, AddressOf Form_Paint
    3.     End Sub
    4.  
    5.     Private Sub Form_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    6.  
    7.     End Sub
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  13. #13
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    this would draw a line on the form, but I dont think there is a way to draw on the controls correctly without knowing which control has what Zorder.

    VB Code:
    1. Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         AddHandler Me.ParentForm.Paint, AddressOf Form_Paint
    3.         If Me.DesignMode Then
    4.             Me.Visible = False
    5.         End If
    6.  
    7.     End Sub
    8.  
    9.     Private Sub Form_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    10.         e.Graphics.DrawLine(Pens.Black, Me.Left, Me.Top, Me.Left + Me.Width, Me.Top + Me.Height)
    11.     End Sub
    12.  
    13.  
    14.     Private Sub LineControl_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
    15.         If designmode Then  ' Preview the line in the control at design time
    16.             e.Graphics.DrawLine(Pens.Black, 0, 0, Me.Width, Me.Height)
    17.         End If
    18.     End Sub
    19.  
    20. 'UserControl overrides dispose to clean up the component list.
    21.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    22.         If disposing Then
    23.             If Not (components Is Nothing) Then
    24.                 components.Dispose()
    25.             End If
    26.  
    27.             If Not Me.ParentForm Is Nothing Then
    28.                 RemoveHandler Me.ParentForm.Paint, AddressOf Form_Paint
    29.             End If
    30.         End If
    31.         MyBase.Dispose(disposing)
    32.     End Sub
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width