How to change the background of picture using MouseEnter event??
조회 수: 1 (최근 30일)
이전 댓글 표시
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..
댓글 수: 0
답변 (1개)
Jiro Doke
2011년 2월 15일
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');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!