Form in dll

  • VB.NET

Es gibt 9 Antworten in diesem Thema. Der letzte Beitrag () ist von Scream.

    Hey.
    Form als UserControl? Das widerspricht sich irgendwie...
    Falls du das meinst: Du kannst in einer DLL auch ganz normal Windows-Forms benutzen.
    Mein Code

    VB.NET-Quellcode

    1. Public Class Form1
    2. Sub abrunden(ByVal was As Object, _
    3. ByVal x As Integer, ByVal y As Integer, _
    4. ByVal width As Integer, ByVal height As Integer, _
    5. ByVal radius As Integer)
    6. Dim gp As System.Drawing.Drawing2D.GraphicsPath = _
    7. New System.Drawing.Drawing2D.GraphicsPath()
    8. gp.AddLine(x + radius, y, x + width - radius, y)
    9. gp.AddArc(x + width - radius, y, radius, radius, 270, 90)
    10. gp.AddLine(x + width, y + radius, x + width, y + height - radius)
    11. gp.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90)
    12. gp.AddLine(x + width - radius, y + height, x + radius, y + height)
    13. gp.AddArc(x, y + height - radius, radius, radius, 90, 90)
    14. gp.AddLine(x, y + height - radius, x, y + radius)
    15. gp.AddArc(x, y, radius, radius, 180, 90)
    16. gp.CloseFigure()
    17. was.region = New System.Drawing.Region(gp)
    18. gp.Dispose()
    19. End Sub
    20. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    21. MyBase.Size = New Drawing.Size(411, 230)
    22. abrunden(Me, 0, 0, Me.Width, Me.Height, 40)
    23. abrunden(MyBase.ParentForm, 0, 0, MyBase.Width, MyBase.Height, 40)
    24. abrunden(Panel1, 0, 0, Panel1.Width, Panel1.Height, 40)
    25. End Sub
    26. Private CurrentPosition As New System.Drawing.Point
    27. Private MouseButton As System.Windows.Forms.MouseButtons = Nothing
    28. Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
    29. MyClass.MouseButton = e.Button()
    30. With MyClass.CurrentPosition
    31. .X = e.X()
    32. .Y = e.Y()
    33. End With
    34. End Sub
    35. Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
    36. Select Case MouseButton
    37. Case Is = Windows.Forms.MouseButtons.Left
    38. MyClass.Top = Windows.Forms.Cursor.Position.Y() - MyClass.CurrentPosition.Y()
    39. MyClass.Left = Windows.Forms.Cursor.Position.X() - MyClass.CurrentPosition.X()
    40. Exit Sub
    41. End Select
    42. End Sub
    43. Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
    44. MyClass.MouseButton = Nothing
    45. End Sub
    46. End Class





    Mfg Scream ;)

    zusammengefasst

    er soll sich abrunden und die form wohin er importiert wurde..
    und sich bewegen wen der cursor mousedown ist...
    eine abgerundete Form halt ;)

    Mfg Scream ;)
    ______

    vll. hilft das weiter:

    Markierte Stelle

    VB.NET-Quellcode

    1. was.region = New System.Drawing.Region(gp)



    @mods

    srry, könntet ihr bitte diesen beitrag zusammenführen? :S

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Agent“ ()

    Na eigentlich sagt:
    Die Objektvariable oder die With-Blockvariable wurde nicht festgelegt
    Schon alles aus. Habe mir jetzt nicht deinen Code angesehen, aber ich denke mal zu 80% das du bei einem With-Block kein Control gesetzt hast.
    Habs nun so gelöst

    VB.NET-Quellcode

    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2. MyBase.Size = New Drawing.Size(411, 230)
    3. abrunden(Panel1, 0, 0, Panel1.Width, Panel1.Height, 40)
    4. abrunden(Me, 0, 0, Me.Width, Me.Height, 40) 'hier hatte ich ein denkfehler, und wollte auch noch mybase abrunden
    5. End Sub