Determine bounds of ImageMargin

G

Guest

Is there any way to determine the bounds (or at least the width) of the image
margin region of a Windows.Forms.ToolStripDropDownMenu? I know that the
bounds are specified in
Windows.Forms.ToolStripProfessionalRenderer.OnRenderImageMargin via the
Windows.Forms.ToolStripRenderEventArgs.AffectedBounds property. But, there
are other times when the width of the image margin is required, such as when
drawing images or checks within the region (especially when ShowCheckMargin
and ShowImageMargin are both true) or when custom drawing separators.

Thanks for any help!
Lance
 
L

Linda Liu [MSFT]

Hi Lance,

This is a quick note to let you know that I am performing research on this
issue and will get the result back to you ASAP.

I appreciate your patience!


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================

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

Linda Liu [MSFT]

Hi Lance,

I have spent several hours researching on this problem but unfortunately, I
haven't found a way to get the bounds of image&check margin of a
ToolStripDropDownMenu except the way of getting it in the override
OnRenderImageMargin method in the derived ToolStripRenderer class.

In additon, in the override OnRenderImageMargin method in the derived
ToolStripRenderer class, the AffectedBounds property of
ToolStripRenderEventArgs parameter returns the bound covering both the
check and image margin, if they all exist.

Actually, when the ImageScaling property of a ToolStripItem is set to
SizeToFit, which is the default value, the image of the ToolStripItem will
be resized to fit the image margin. We needn't worry that the width of our
image may not fit the image margin.

Hope this helps.
If you have any concerns, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support
 
G

Guest

Hi Linda,

Thank you for looking into this. Just knowing that there isn't a direct way
to determine the width of the ImageMargin is very helpful. I'm sure that I
will be able to implement a workaround without too much difficulty.

Thanks again. You're always a big help!
Lance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top