How to change the background of picture using MouseEnter event??

1 Ansicht (letzte 30 Tage)
Meer Salman
Meer Salman am 15 Feb. 2011
Hi..
I have import the System.Windows.Forms and System.Drawings.Bitmap in the code.. Can anybody please tell me how to change the background of PictureBox using MouseEnter event?? I have created a Form in Matlab using .Net library and i have a picture box, i want to change its background image as soon as the mouse come on it..
Thanks in advance..

Antworten (1)

Jiro Doke
Jiro Doke am 15 Feb. 2011
I may not have the VB part well coded, but this should get you started.
function ln = formTest
NET.addAssembly('System.Windows.Forms');
f = System.Windows.Forms.Form;
f.Width = 640;
f.Height = 480;
p = System.Windows.Forms.PictureBox;
p.Width = 640;
p.Height = 480;
p.ImageLocation = which('street1.jpg');
f.Controls.Add(p);
f.Visible = true;
ln(1) = addlistener(p, 'MouseEnter', @mouseEnterFcn);
ln(2) = addlistener(p, 'MouseLeave', @mouseLeaveFcn);
function mouseEnterFcn(obj, edata)
obj.ImageLocation = which('street2.jpg');
function mouseLeaveFcn(obj, edata)
obj.ImageLocation = which('street1.jpg');

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by