NexusFi: Find Your Edge


Home Menu

 





OnMouseEnter


Discussion in NinjaTrader

Updated
    1. trending_up 1,855 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 3 attachments




 
Search this Thread

OnMouseEnter

  #1 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291

I have searched futures.io (formerly BMT), Ninja and MSDN but have been unable to resolve an issue.
Is it possible to put a rectangle or a button on a panel and then have it change colour upon the mouse entering it and leaving it?
sounds simple?

I can get the button to change colour upon clicking it but the OnMouseEnter and OnMouseLeave methods stubbornly refuse to co operate.


Any help much appreciated.

Attached Thumbnails
Click image for larger version

Name:	canary.png
Views:	164
Size:	43.8 KB
ID:	18676   Click image for larger version

Name:	canary 2.png
Views:	143
Size:	43.8 KB
ID:	18677  
Attached Files
Elite Membership required to download: DrawRectangle.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
 
  #3 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


with a button it can be easily done. just set a MouseEnter/MouseLeave event.


 
Code
btn.MouseEnter += new EventHandler(mouse_enter);
 
Code
private void mouse_enter(object sender,EventArgs e)
        {
            btn.BackColor = Color.Green;
        }
edit: i just have a peep at your code. you got to add the button FormButton to the chartpanel. you havent done that.

 
Code
panel.Controls.Add(FormButton);
and do remember to remove it on termination.

Reply With Quote
Thanked by:
  #4 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291

Bukkan

Many thanks - I had the FormButton Control posted in chartcontrol - hence all my issues.
One final thing the button sits 'on top' of the chart and I would like to make it invisible - sort of like a hotspot on a web page.
I tried FormButton.Visible = false;
but that means OnMouseEnter no longer works - I guess the control is no longer visible to the mouse?
any ideas?

Started this thread Reply With Quote
  #5 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


Mindset View Post
Bukkan

Many thanks - I had the FormButton Control posted in chartcontrol - hence all my issues.
One final thing the button sits 'on top' of the chart and I would like to make it invisible - sort of like a hotspot on a web page.
I tried FormButton.Visible = false;
but that means OnMouseEnter no longer works - I guess the control is no longer visible to the mouse?
any ideas?

i dont know whether its a elegant approach or not but you can try this.


OnStartUp
 
Code
ChartControl.ChartPanel.MouseMove += new MouseEventHandler(panel_enter);
panel enter

 
Code
private void panel_enter(object sender,MouseEventArgs e)
{
       //assuming the button is placed at point X=100,Y=100, change 100 with your own location start points
       if (e.X >= 100 && e.X < 100 + btn.Width && e.Y >= 100 && e.Y <= 100 + btn.Height)
       {
              btn.Visible = true;
       }
        else {btn.Visible = false;}
}
OnTermination
 
Code
ChartControl.ChartPanel.MouseMove -= new MouseEventHandler(panel_enter);
p.s. - btn = Button

Reply With Quote
Thanked by:
  #6 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291

Excellent work!
I have now completed my trade aid.
I will post it in the download section at some point tomorrow.

Started this thread Reply With Quote
Thanked by:




Last Updated on August 18, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts