Hello and thanks for your answer
but The problem is that the code is in a userctrl, herited from a label:
so i Get an error "exception System.StackOverflowException"
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
<Category("Common control"), Browsable(True), Description("Ca c'est du
label de chez scalpa")> _
<ToolboxBitmap(GetType(Lbl_ClassLibrary.MonLabel), "MonLabel.bmp")> _
Public Class MonLabel
Inherits Windows.Forms.Label
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
'Me.AllowDrop = True
Me.BorderStyle = Windows.Forms.BorderStyle.FixedSingle
Me.MinimumSize = New Size(80, 25)
Me.Dock = DockStyle.Fill
Me.TextAlign = ContentAlignment.MiddleCenter
Me.BackColor = SystemColors.Control
End Sub
#Region "Events"
'copier le contenu du label quand clic gauche
Private Sub Me_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Me.DoDragDrop(Me.Text, DragDropEffects.Copy)
Me.BackColor = Color.Red
End Sub
Private Sub Me_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
Me.Text = e.Data.GetData(DataFormats.Text).ToString
If Me.DoDragDrop(Me.Text, DragDropEffects.Copy) = DragDropEffects.Copy
Then
Me.BackColor = Color.Green
Else
End If
End Sub
--
http://www.scalpa.info
http://scalpa-production.blogspot.com/
http://www.scalpa.info
http://scalpa98.blogspot.com/