vercomax
Messages postés547Date d'inscriptionmercredi 28 juillet 2004StatutMembreDernière intervention11 septembre 2013
-
17 nov. 2006 à 15:07
vercomax
Messages postés547Date d'inscriptionmercredi 28 juillet 2004StatutMembreDernière intervention11 septembre 2013
-
17 nov. 2006 à 16:16
bonjour,
je cherche à faire un ptit code qui m'affichera dans un textbox, le nom du controle survolé par la souris sur une form.
je ne trouve pas de source ou d'aide
Dim HoverControl As System.Windows.Forms.Control = MyBase.GetChildAtPoint( _
MyBase.PointToClient(System.Windows.Forms.Control.MousePosition), _
GetChildAtPointSkip.None)
If HoverControl IsNot Nothing Then TaTextBox.Text = HoverControl.Name,
cs_kazer04
Messages postés182Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention14 mars 2011 17 nov. 2006 à 15:24
Option Explicit
Dim var As String
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
var = Command1.ToolTipText
End Sub
Private Sub Form_Load()
var = ""
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
var = Label1.ToolTipText
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
var = Picture1.ToolTipText
End Sub
Private Sub Timer2_Timer()
Text1.Text = var
End Sub
cs_kazer04
Messages postés182Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention14 mars 2011 17 nov. 2006 à 15:38
ok moi j'ai fais du vb6
c'est pas grave voila l'equivalent
Public Class Form1
Inherits System.Windows.Forms.Form
Public var As String
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
'Ajoutez une initialisation quelconque après l'appel InitializeComponent()
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Timer1 As System.Windows.Forms.Timer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(144, 48)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Label1"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(24, 88)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(160, 40)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(192, 24)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(80, 72)
Me.PictureBox1.TabIndex = 2
Me.PictureBox1.TabStop = False
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(24, 160)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(152, 20)
Me.TextBox1.TabIndex = 3
Me.TextBox1.Text = "TextBox1"
'
'Timer1
'
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.PictureBox1, Me.Button1, Me.Label1})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Timer1.Interval = 100
var = ""
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = var
End Sub
Private Sub Label1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove
var = Label1.Name
End Sub
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
var = Button1.Name
End Sub
End Class