473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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.

Sep 26 '06 #1
3 2819
te******@hotmail.com wrote:
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.
A wild guess, not sure if it makes sense:

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.

Sep 27 '06 #2
Brian Tkatch wrote:
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. :)

Sep 28 '06 #3

te******@hotmail.com wrote:
Brian Tkatch wrote:
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. :)
Kewl. Glad i could help.

Indeed, i got the MDIClient area trick from someone else when i needed
it. :)

B.

Sep 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nick Calladine | last post by:
Hi On my form i have multiple select which all have an id value total1, total2, total3 etc so i am trying to detect how many there are and then use this to caculate a total. Is there a...
10
by: Ben Xia | last post by:
Is there some way can detect MAC address with PHP? any help will be appreciate. Ben
19
by: lihua | last post by:
Hi, Group! I got one question here: We all know that fclose() must be called after file operations to avoid unexpected errors.But there are really cases when you forget to do that!Just like...
3
by: Hardy Wang | last post by:
Hi, I have a HttpModule in my ASP.NET application, in AuthorizeRequest event, I want to detect if page is posted back. Is there a way? using System; using System.Web; namespace MyModule {...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
3
by: Tegdeep | last post by:
Here's what I want to do: I have a hash table which contains data associated to different keys. The Hash keys are represented by a single character from the keyboard: 0-9, a-z, A-Z, and the...
3
by: Sara | last post by:
HI, I want to code a program to detect GSM mobile (any kind) which connected through serial port to computer and then be able to send SMS through this mobile phone to other mobile phones, could...
9
by: Anish G | last post by:
Hi, I have a visual basic application which needs to detect keyboard events. I want to it to detect all the arrow keys (Left, Right, Up, Down) and these should be detected at form level. I have...
4
by: nrocha | last post by:
Hello, I've been trying to detect when a user closes a page or navigates away from it. This is part of a solution for locking pages (that is, if a user enters a page, no one else can enter it...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.