473,587 Members | 2,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmatic MouseEnter and MouseLeave

I need to programmaticall y 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 programmaticall y. After two years of coding on this project
it blows up even if I look cross-eyed at it. :o(

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

Thanks!

Bob
Jun 5 '07 #1
7 2206
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********@dis cussions.micros oft.comwrote in message
news:15******** *************** ***********@mic rosoft.com...
>I need to programmaticall y 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 programmaticall y. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmaticall y 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********@dis cussions.micros oft.comschreef in bericht
news:15******** *************** ***********@mic rosoft.com...
>I need to programmaticall y 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 programmaticall y. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmaticall y 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 programmaticall y making a listbox but it does not show up. :o(

Here is the code I tried...

'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.Allow Drop = True
MyListBox.Items .AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Locat ion = New System.Drawing. Point(232, 176)
MyListBox.Name = "MyListBoxH 2"
MyListBox.Size = New System.Drawing. Size(56, 17)
MyListBox.TabIn dex = 100
MyListBox.Bring ToFront()
MyListBox.Visib le = True
MyListBox.Enabl ed = True
MyListBox.ItemH eight = 13
Controls.Add(My ListBox)

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********@dis cussions.micros oft.comschreef in bericht
news:15******** *************** ***********@mic rosoft.com...
I need to programmaticall y 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 programmaticall y. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmaticall y 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 programmaticall y making a listbox but it does not show up. :o(

Here is the code I tried...

'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.Allow Drop = True
MyListBox.Items .AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Locat ion = New System.Drawing. Point(232, 176)
MyListBox.Name = "MyListBox"
MyListBox.Size = New System.Drawing. Size(56, 17)
MyListBox.TabIn dex = 100
MyListBox.Bring ToFront()
MyListBox.Visib le = True
MyListBox.Enabl ed = True
MyListBox.ItemH eight = 13
Controls.Add(My ListBox)

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********@dis cussions.micros oft.comschreef in bericht
news:15******** *************** ***********@mic rosoft.com...
I need to programmaticall y 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 programmaticall y. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmaticall y 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(ByVa l sender As _
System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.Allow Drop = True
MyListBox.Items .AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Locat ion = New System.Drawing. Point(232, 176)
MyListBox.Name = "MyListBox"
MyListBox.Size = New System.Drawing. Size(56, 17)
MyListBox.TabIn dex = 100
MyListBox.Bring ToFront()
MyListBox.Visib le = True
MyListBox.Enabl ed = True
MyListBox.ItemH eight = 13
Controls.Add(My ListBox)
End Sub

Cor
"BobAchgill " <Bo********@dis cussions.micros oft.comschreef in bericht
news:48******** *************** ***********@mic rosoft.com...
Than ks Cor,

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

Here is the code I tried...

'MyListBox
Dim MyListBox As New ListBox

'
MyListBox.Allow Drop = True
MyListBox.Items .AddRange(New Object() {"A", "B", "C", "D"})
MyListBox.Locat ion = New System.Drawing. Point(232, 176)
MyListBox.Name = "MyListBox"
MyListBox.Size = New System.Drawing. Size(56, 17)
MyListBox.TabIn dex = 100
MyListBox.Bring ToFront()
MyListBox.Visib le = True
MyListBox.Enabl ed = True
MyListBox.ItemH eight = 13
Controls.Add(My ListBox)

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********@dis cussions.micros oft.comschreef in bericht
news:15******* *************** ************@mi crosoft.com...
>I need to programmaticall y 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 programmaticall y. After two years of coding on this
project
it blows up even if I look cross-eyed at it. :o(

I really need to programmaticall y 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 programmaticall y 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 programmaticall y but
it does not work. Do you see anything I may be missing... I had to comment
out the one line ...

'AxShockwaveFla sh10.OcxState = ...

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

Here is the code...

'AxShockwaveFla sh10
Dim AxShockwaveFlas h10 = New AxShockwaveFlas hObjects.AxShoc kwaveFlash
'
AxShockwaveFlas h10.Enabled = True
AxShockwaveFlas h10.Location = New System.Drawing. Point(100, 100)
AxShockwaveFlas h10.Name = "AxShockwaveFla sh10"
'AxShockwaveFla sh10.OcxState =
CType(Resources .GetObject("AxS hockwaveFlash10 .OcxState"),
System.Windows. Forms.AxHost.St ate)
AxShockwaveFlas h10.Size = New System.Drawing. Size(152, 144)
'AxShockwaveFla sh10.TabIndex = 29

Controls.Add(Ax ShockwaveFlash1 0)

AxShockwaveFlas h10.Movie = strCurDir + "\MyFlash.s wf"
AxShockwaveFlas h10.Play()
AxShockwaveFlas h10.Loop = True
Jun 11 '07 #8

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

Similar topics

0
1577
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 not disappear (as if the MouseLeave event isn't firing) or i can get the effects to not appear in the first place (as if the MouseEnter/MouseMove...
3
7429
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 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.
1
2641
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 events are not MouseEventHandlers. so am I missing something, or is my .NET install messed up? it seems to me that an event caused by a mouse...
0
1923
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 activate window taskbar hide show. I do a testing that a form have 2 button and 1 label text. 1 button is showintaskbar=true, another is...
3
7672
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, which is understandable.
0
1519
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 easily: create a form, drop a picturebox, and handle the events mouseEnter, mouseLeave (of the picturebox), change the image for example. Then do...
3
3974
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 about the control they just entered (sort of like an extended tooltip). Now, I can certainly create a separate mouseenter event for each control (too...
0
1085
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 context menu appears, the control is no longer highlighted. This is of course because the MouseLeave event runs when the context menu appears. I've...
1
1751
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 MouseLeave events for the button. Is this normal? Is it possible to get just 1 MouseEnter event when I enter the button and 1 MouseLeave event when I leave...
0
8205
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6619
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
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 we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.