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

1 visualización (últimos 30 días)
Meer Salman
Meer Salman el 15 de Feb. de 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..

Respuestas (1)

Jiro Doke
Jiro Doke el 15 de Feb. de 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');

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by