473,473 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Programmatic MouseEnter and MouseLeave

I need to programmatically add an invisible control to my form that will
enable me to trigger MouseEnter and MouseLeave code relative to the control
area.

Is this possible to add the control and the triggers without the use of the
Form Designer? How?

My Form Design window is won't let me add any more controls so that is why I
need to do this programmatically. After two years of coding on this project
it blows up even if I look cross-eyed at it. :o(

I really need to programmatically add the invisible control with associated
MouseEnter and Leave triggers to complete my project.

Thanks!

Bob
Jun 5 '07 #1
7 2203
Bob,

Wow, I think you may have bigger problems that just an invisible control.

I wrote a little test app to repeatedly add button controls to a form. The
app errors out (Win32Exception: Error creating window handle) at 9964
controls.

You must have a lot of controls if the designer won't let you add more.

You might want to look at componetizing controls into user controls, more of
an OO approach.

Also, why do you need an invisible control to handle the triggers, you could
add the logic to the form itself to detect those events, and determine if it
is in a specific area.

Hope this helps,
Steve

"BobAchgill" <Bo********@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
>I need to programmatically add an invisible control to my form that will
enable me to trigger MouseEnter and MouseLeave code relative to the
control
area.

Is this possible to add the control and the triggers without the use of
the
Form Designer? How?

My Form Design window is won't let me add any more controls so that is why
I
need to do this programmatically. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmatically add the invisible control with
associated
MouseEnter and Leave triggers to complete my project.

Thanks!

Bob

Jun 5 '07 #2
Bob,

I thought that every regular visitor had seen this sample now.

http://www.vb-tips.com/dbpages.aspx?...2-03abce36aa60

There is more of this dynamical stuff on our website.

Cor
"BobAchgill" <Bo********@discussions.microsoft.comschreef in bericht
news:15**********************************@microsof t.com...
>I need to programmatically add an invisible control to my form that will
enable me to trigger MouseEnter and MouseLeave code relative to the
control
area.

Is this possible to add the control and the triggers without the use of
the
Form Designer? How?

My Form Design window is won't let me add any more controls so that is why
I
need to do this programmatically. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmatically add the invisible control with
associated
MouseEnter and Leave triggers to complete my project.

Thanks!

Bob

Jun 6 '07 #3
Than ks Cor,

I tried programmatically making a listbox but it does not show up. :o(

Here is the code I tried...

'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.AllowDrop = True
MyListBox.Items.AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Location = New System.Drawing.Point(232, 176)
MyListBox.Name = "MyListBoxH2"
MyListBox.Size = New System.Drawing.Size(56, 17)
MyListBox.TabIndex = 100
MyListBox.BringToFront()
MyListBox.Visible = True
MyListBox.Enabled = True
MyListBox.ItemHeight = 13
Controls.Add(MyListBox)

Thanks!
Bob

"Cor Ligthert [MVP]" wrote:
Bob,

I thought that every regular visitor had seen this sample now.

http://www.vb-tips.com/dbpages.aspx?...2-03abce36aa60

There is more of this dynamical stuff on our website.

Cor
"BobAchgill" <Bo********@discussions.microsoft.comschreef in bericht
news:15**********************************@microsof t.com...
I need to programmatically add an invisible control to my form that will
enable me to trigger MouseEnter and MouseLeave code relative to the
control
area.

Is this possible to add the control and the triggers without the use of
the
Form Designer? How?

My Form Design window is won't let me add any more controls so that is why
I
need to do this programmatically. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmatically add the invisible control with
associated
MouseEnter and Leave triggers to complete my project.

Thanks!

Bob


Jun 8 '07 #4
Than ks Cor,

I tried programmatically making a listbox but it does not show up. :o(

Here is the code I tried...

'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.AllowDrop = True
MyListBox.Items.AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Location = New System.Drawing.Point(232, 176)
MyListBox.Name = "MyListBox"
MyListBox.Size = New System.Drawing.Size(56, 17)
MyListBox.TabIndex = 100
MyListBox.BringToFront()
MyListBox.Visible = True
MyListBox.Enabled = True
MyListBox.ItemHeight = 13
Controls.Add(MyListBox)

Thanks!
Bob

"Cor Ligthert [MVP]" wrote:
Bob,

I thought that every regular visitor had seen this sample now.

http://www.vb-tips.com/dbpages.aspx?...2-03abce36aa60

There is more of this dynamical stuff on our website.

Cor
"BobAchgill" <Bo********@discussions.microsoft.comschreef in bericht
news:15**********************************@microsof t.com...
I need to programmatically add an invisible control to my form that will
enable me to trigger MouseEnter and MouseLeave code relative to the
control
area.

Is this possible to add the control and the triggers without the use of
the
Form Designer? How?

My Form Design window is won't let me add any more controls so that is why
I
need to do this programmatically. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmatically add the invisible control with
associated
MouseEnter and Leave triggers to complete my project.

Thanks!

Bob


Jun 8 '07 #5
Mike,
Also, why do you need an invisible control to handle the triggers, you could
add the logic to the form itself to detect those events, and determine if it
is in a specific area.
Thanks, I added the logic using mousemove on the form and it works
great!

Wow, I think you may have bigger problems that just an invisible control.

I wrote a little test app to repeatedly add button controls to a form. The
app errors out (Win32Exception: Error creating window handle) at 9964
controls.
Well, I don't think it is because of too many controls that my design
window crumps. And even when I so much as move a control on the
window it crumps. Got any ideas how to debug why the designer would
be so ill?

Bob
Jun 8 '07 #6
Bob,

This shows in the left beneath corner a listbox, are you sure your form is
large enough?

Private Sub Form1_Load(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.AllowDrop = True
MyListBox.Items.AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Location = New System.Drawing.Point(232, 176)
MyListBox.Name = "MyListBox"
MyListBox.Size = New System.Drawing.Size(56, 17)
MyListBox.TabIndex = 100
MyListBox.BringToFront()
MyListBox.Visible = True
MyListBox.Enabled = True
MyListBox.ItemHeight = 13
Controls.Add(MyListBox)
End Sub

Cor
"BobAchgill" <Bo********@discussions.microsoft.comschreef in bericht
news:48**********************************@microsof t.com...
Than ks Cor,

I tried programmatically making a listbox but it does not show up. :o(

Here is the code I tried...

'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.AllowDrop = True
MyListBox.Items.AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Location = New System.Drawing.Point(232, 176)
MyListBox.Name = "MyListBox"
MyListBox.Size = New System.Drawing.Size(56, 17)
MyListBox.TabIndex = 100
MyListBox.BringToFront()
MyListBox.Visible = True
MyListBox.Enabled = True
MyListBox.ItemHeight = 13
Controls.Add(MyListBox)

Thanks!
Bob

"Cor Ligthert [MVP]" wrote:
>Bob,

I thought that every regular visitor had seen this sample now.

http://www.vb-tips.com/dbpages.aspx?...2-03abce36aa60

There is more of this dynamical stuff on our website.

Cor
"BobAchgill" <Bo********@discussions.microsoft.comschreef in bericht
news:15**********************************@microso ft.com...
>I need to programmatically add an invisible control to my form that will
enable me to trigger MouseEnter and MouseLeave code relative to the
control
area.

Is this possible to add the control and the triggers without the use of
the
Form Designer? How?

My Form Design window is won't let me add any more controls so that is
why
I
need to do this programmatically. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmatically add the invisible control with
associated
MouseEnter and Leave triggers to complete my project.

Thanks!

Bob



Jun 8 '07 #7
Cor,

My form was big enough... but the list box was hiding under something else
on the form. Thanks!

Hey, now I am trying to programmatically add a Flash control to my form that
already has some Flash controls. (so I know the references are right) I
tried to follow what you showed me for adding a control programmatically but
it does not work. Do you see anything I may be missing... I had to comment
out the one line ...

'AxShockwaveFlash10.OcxState = ...

because the "Resources.GetObject" was saying GetObject is not a member of
Resources.

Here is the code...

'AxShockwaveFlash10
Dim AxShockwaveFlash10 = New AxShockwaveFlashObjects.AxShockwaveFlash
'
AxShockwaveFlash10.Enabled = True
AxShockwaveFlash10.Location = New System.Drawing.Point(100, 100)
AxShockwaveFlash10.Name = "AxShockwaveFlash10"
'AxShockwaveFlash10.OcxState =
CType(Resources.GetObject("AxShockwaveFlash10.OcxS tate"),
System.Windows.Forms.AxHost.State)
AxShockwaveFlash10.Size = New System.Drawing.Size(152, 144)
'AxShockwaveFlash10.TabIndex = 29

Controls.Add(AxShockwaveFlash10)

AxShockwaveFlash10.Movie = strCurDir + "\MyFlash.swf"
AxShockwaveFlash10.Play()
AxShockwaveFlash10.Loop = True
Jun 11 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Mulholland | last post by:
I have written some code that causes mouseover effects on a picture box. The code works fine most of the time and creates some really nice effects. HOWEVER, If i try, i can get the effects to...
3
by: Tim Mulholland | last post by:
i posted this a while ago and never got a response, but i'm still having problems, so i thought i'd see if anyone had any sudden realizations this time Thanks in advance! Tim I have...
1
by: SeaNICK | last post by:
I am trying to figure out how to use MouseEnter or MouseLeave events, and be able to use the EventArgs to determine where the mouse cursor is. To my great confusion, the MouseEnter and MouseLeave...
0
by: Machi | last post by:
I am using C#.NET. API version showintaskbar form Window taskbar hide show not fire events MouseLeave and MouseEnter! Now i am facing a critical problem for MouseLeave and MouseEnter event when i...
3
by: M O J O | last post by:
Hi, I have a panel on my form. I want to detect when the user enters my panel with his mouse and when he leaves my panel. If the user hovers a control inside my panel, I get the mouseleave,...
0
by: Pucara | last post by:
Hi all, I have noticed that the picturebox object doesnt' fire correctly the mouseEnter mouseLeave events. The problem is seen ONLY when you show a form more than once. You can reproduce it...
3
by: JohnR | last post by:
I have a form with a number of text boxes, comboboxes etc. What I would like to do is create an event handler for the "mouseenter" event for each of the controls whereby I display information...
0
by: Nathan M | last post by:
Hi, I use a certain control's MouseEnter and MouseLeave events to make this control appear highlighted. The control also has a context menu, but when the control is right-clicked and the...
1
by: Michelangelo | last post by:
Hello, I have a form. On the form is a button. When I move the cursor onto the button, exactly on the edge (most outer pixel of the button), I get a continuous stream of MouseEnter and...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.