Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

Unfortunately searches here didn't quite result in anything that helped to answer my question.

 

So here it is. I would like to have a control that displays an image and can accept focus.

 

Using the button control (actually I'm subclassing it to do what I need) I can get it to load an image, however I can't resize the image that is loaded (as the button1.ImageList.Image.Size property is read-only) -- wasn't able to find anything to describe how to resize it. Decided to then use the PictureBox control (again subclassed to do some of the stuff I need), and although I have full control over it's ability to work with images, I can't find a way to make it accept focus when tab is pressed, the CanFocus is set to false by default, and I'm not sure how to enable it. Also according to MSDN the replacement to VB6's GotFocus and LostFocus are Enter and Leave, neither of which events I can seem to make use of (also the intellisense displays GotFocus and LostFocus events), but I can't get the control to accept focus.

 

If anyone could please help me that would be greatly appreciated, thanks.

Posted

I too couldn't get it to accept focus.

 

Picturebox.TabStop = True

Picturebox.TabIndex = 0

 

should cause it to start with focus. It isn't doing so.

 

Any reason you can't just Add a dummy control, like a textbox or button, behind the picturebox? Then when btnPicFocus gets focus, you can set the pictureboxes border to be different (if you want to) and do whatever it is you wanted.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...