473,796 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Specify a region for a ToolStripItem

I want to create a Windows.Forms.T oolStripItem that behaves as if it is an
ellipse (e.g., similar to the round Office Button in Office 2007). Drawing
the item is no problem, but I also want to prevent the item from reponding to
the mouse unless the mouse is within the elliptical bounds of the item. For
a Windows.Forms.C ontrol this can be done by setting the Region property, but
as far as I can tell there no such property for a ToolStripItem.

Thanks for any help!
Lance

Feb 6 '07 #1
6 1415
Hi Lance,

Yes, you're right. Only Control class has the Region property.
ToolStripItem is derived from Component class, so it doesn't have a Region
property.

I have spent several hours researching on this problem, but unfortunately I
haven't found a solution yet.

I suggest that you use a Button instead of ToolStripItem. You may paint the
button by handling its Paint event and then set the button's Region
property.

FYI, you may visit the following link to get a sample code.

'Control.Region Property'
http://msdn2.microsoft.com/en-us/lib...control.region
.aspx

Hope this helps.
If you have any concerns, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 7 '07 #2
Hi Linda,

Thank you so much for your time and your suggestion. Using a Button is a
good idea, but I would prefer to use a class that inherits from ToolStripItem
if at all possible in order to maintain internal consistency. Also, it might
be difficult to have a Button behave exactly like a ToolStripItem (with
DropDown items, etc.).

If it is not possible to associate a region with a ToolStripItem, then is
there some way to prevent the ToolStripItem from thinking that the mouse is
has entered it? I would guess that there is some method (probably either in
ToolStrip or ToolStripItem) where the hit test logic is being performed. If
it is possible to override that method then I could include custom logic for
handling elliptical ToolStripItems.

Thanks again,
Lance

Feb 7 '07 #3
Hi Lance,

In fact, I have spent some time researching on how to prevent the
ToolStripItem from being focused when the mouse is not located in the
'region'. But unfortunately, I haven't worked it out yet.

I will go on research and will get the result back to you ASAP.

I appreciate your patience.
Sincerely,
Linda Liu
Microsoft Online Community Support

Feb 9 '07 #4
Sounds good. Thanks!
Lance

Feb 9 '07 #5
Hi Lance,

We could subscribe the MouseMove event of a ToolStripItem and write our hit
test logic in the event handler. However, the problem is that it may not
easy to implement hit test logic since the 'region' is just a graph we draw.

What's more, it is may not easy to get the area only within the 'region'
focused when the mouse is located in the 'region', either.

I still suggest that you use a Button. As for the drop down items, you may
use ContextMenuStri p and call the Show method of the ContextMenuStri p in
the Button's Click event handler.

The following is a sample.

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Me.ContextMenuS trip1.Show(Me.B utton1, 0, Me.Button1.Heig ht)
End Sub

Hope this helps.
If you have any concerns, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support

Feb 12 '07 #6
Hi Linda,

Ok, I suspect that I will be able to implement some kind of workaround.
Thanks for your help and for the suggestion of using a Button.

Lance

Feb 13 '07 #7

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

Similar topics

11
7658
by: Altramagnus | last post by:
I have a complicated Region object, which I need to draw the outline, but not fill How can I convert the Region object to GraphicsPath object? or How can I draw the outline of the Region object?
1
4786
by: Jason Richmeier | last post by:
Hopefully there is an easy answer to this question since it has been bothering me all afternoon. What are the keys that are associated with ToolStripItem objects? Are they keys that allow access to individual items in the ToolStripItemCollection object (this is what I assumed they were)? Are they the shortcut keys? I have noticed that there are several methods (such as ContainsKey) of the ToolStripItemCollection class that use these...
6
3736
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to specify a custom color for disabled text that is used by a class that inherits from ToolStripProfessionalRenderer. The code would look something like this: Public Class MyRenderer Inherits Windows.Forms.ToolStripProfessionalRenderer Protected Overrides Sub OnRenderItemText(ByVal e As System.Windows.Forms.ToolStripItemTextRenderEventArgs) If (Not e.Item.Enabled) Then e.TextColor = Color.Red
0
1023
by: Duracel | last post by:
Is it possible to add an owner draw combo box (or similar) as a toolstripitem in a toolstrip? thx.
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.