Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

PictureBox that Receives and Shows Input Focus

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 17 Jan 2005 14:06 GMT
I am trying to create a control which is basically a PictureBox than
can receive and show focus. I have created a UserControl descendant
that simply contains a PictureBox control. The PictureBox control
automatically sizes to whatever size is selected for the control. To
show focus, I am overriding the OnEnter and OnLeave methods of the
derived controi to change the BorderStyle property of the PictureBox
control.

The problem I am having is in handling click and double-click mouse
events. It appears that when the user clicks on the control, it is the
PictureBox that receives the mouse events. Since I want to be able to
set event handlers for mouse events external to the control, I have
declared event handlers for MouseUp, MouseDown, Click and DoubleClick
for the PictureBox control that simply pass these events to the
underlying control.

The behavior I am looking for is for a single click to give focus to
the control, and a double-click to fire the control's DoubleClick
event. This works except for the case where the control does not have
focus and the user double-clicks on it. In this case, it seems the
first click is consumed to give focus to the control, and it never
sees the double-click.

How can I get the desired behavior?

--Bruce
Ed Kaim - 17 Jan 2005 18:07 GMT
Perhaps you can track the MouseDown event.

>I am trying to create a control which is basically a PictureBox than
> can receive and show focus. I have created a UserControl descendant
[quoted text clipped - 22 lines]
>
> --Bruce

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.