|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Detect right-click in MDI container's client area?I need to display a tiled image in the MDI container form's client
area, and also detect right-clicks in that area. How do you do that? So far, I've unsuccessfully tried: 1) Placing my image in the form's BackgroundImage, and creating a MouseUp event for the form. The event never fires. 2) Placing a Picturebox in the Form, docked to fill, and moving my image and MouseUp event to that. Now the event fires, but the Picturebox covers all my child forms. Sending the Picturebox to the back didn't change anything. 3) Googling for the answer helped with dozens of my other silly VB.NET questions, but I can't find a solution for this one. Thanks in advance. tesla***@hotmail.com wrote:
Show quoteHide quote > I need to display a tiled image in the MDI container form's client A wild guess, not sure if it makes sense:> area, and also detect right-clicks in that area. How do you do that? > > So far, I've unsuccessfully tried: > > 1) Placing my image in the form's BackgroundImage, and creating a > MouseUp event for the form. The event never fires. > 2) Placing a Picturebox in the Form, docked to fill, and moving my > image and MouseUp event to that. Now the event fires, but the > Picturebox covers all my child forms. Sending the Picturebox to the > back didn't change anything. > 3) Googling for the answer helped with dozens of my other silly VB.NET > questions, but I can't find a solution for this one. > > Thanks in advance. Find the MDIClient object and add a Handler to get the mouse-up event in the client area. Dim The_MDIClient As MdiClient For Each Current_Control As Control In Me.Controls If TypeOf Current_Control Is MdiClient Then The_MDI_Client = Current_Control AddHandler The_MDIClient.MouseUp, AddressOf The_MDIClient_MouseUp Exit For End If Next Private Sub The_MDIClient_MouseUp(ByVal sender As Object, ByVal e As System.EventArgs) (put some code here) End Sub Obviously, the name "The_MDIClient_MouseUp" can be anything as long as it is the same in both places. And, make sure to change the incoming arguments to match a real MouseUp event. HTH, B. Brian Tkatch wrote:
> A wild guess, not sure if it makes sense: Works perfectly, thank you! I never considered the possibility that-snip- the client area might be a separate control. VB.NET continues to confuse and amaze me. :) tesla***@hotmail.com wrote:
> Brian Tkatch wrote: Kewl. Glad i could help.> > A wild guess, not sure if it makes sense: > -snip- > > Works perfectly, thank you! I never considered the possibility that > the client area might be a separate control. VB.NET continues to > confuse and amaze me. :) Indeed, i got the MDIClient area trick from someone else when i needed it. :) B.
check username and password in database
A question of design Encrypt a date to use in demo version System.Diagnostics.Process.Start Freezes No Recursive instr?!! Finding embedded controls? Visual Studio Proffessional 2005 RTf to Word.Doc .Net user control in a VB6 app requires double-click to activate C# to VB Conversion Help - Overriding Events? |
|||||||||||||||||||||||