By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,967 Members | 815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,967 IT Pros & Developers. It's quick & easy.

How to get control clip region?

P: n/a
How do you retrieve the visible clipping region for a control?

I have a control where I do some on-screen drawing (specifically
ControlPaint.DrawReversibleLine()), however I need to clip the line to the
visible bounds of my control.

Obviously, the client rect is simple enough to retrieve, but what I need to do
is to clip the line segment to only that portion of the control that is
visible, which may _not_ correspond to the client rect if there is some other
window partially obscuring my control.

In my tests, Control.CreateGraphics().ClipBounds() is returning an 'infinite'
rectangle.

Anyone have any pointers on how to do what I want in .Net?
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Julie wrote:
How do you retrieve the visible clipping region for a control?

I have a control where I do some on-screen drawing (specifically
ControlPaint.DrawReversibleLine()), however I need to clip the line to
the visible bounds of my control.

Obviously, the client rect is simple enough to retrieve, but what I need
to do is to clip the line segment to only that portion of the control
that is visible, which may _not_ correspond to the client rect if there
is some other window partially obscuring my control.

In my tests, Control.CreateGraphics().ClipBounds() is returning an
'infinite' rectangle.

Anyone have any pointers on how to do what I want in .Net?


Anyone have any comments? Is it clear what I'm after?

Thanks
Nov 17 '05 #2

P: n/a
Julie,

You can use the ClientRectangle property.

In your Paint overrides, there is a parameter ClipRectangle.

Tom T.

"Julie" wrote:
Julie wrote:
How do you retrieve the visible clipping region for a control?

I have a control where I do some on-screen drawing (specifically
ControlPaint.DrawReversibleLine()), however I need to clip the line to
the visible bounds of my control.

Obviously, the client rect is simple enough to retrieve, but what I need
to do is to clip the line segment to only that portion of the control
that is visible, which may _not_ correspond to the client rect if there
is some other window partially obscuring my control.

In my tests, Control.CreateGraphics().ClipBounds() is returning an
'infinite' rectangle.

Anyone have any pointers on how to do what I want in .Net?


Anyone have any comments? Is it clear what I'm after?

Thanks

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.