473,396 Members | 1,722 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,396 software developers and data experts.

How to get control clip region?

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
2 6588
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fain Cowie | last post by:
I am trying to paste a pile of text boxes onto a large form in groups of 15 when I try to copy the first group (0-14)and paste it below the elements are numbered backwards.(29-15) Is there a way to...
11
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the...
1
by: °Ë´óɽÈË | last post by:
HI, I create a custom transparent control, set the style is ControlStyles.DoubleBuffer, It display black background. How to create a double buffer transparent control? The ralative code is:...
2
by: Tom Hornyak | last post by:
I need to do the following in C#: 1. Drop an arbitrary image from one control to another bitmap on another control. 2. Interact with this shape (stretch it, rotate it, etc,) once on the...
3
by: Martin | last post by:
I'm trying to paint my own caption bar/title bar and also my own frame border, but I'm having problems with modifying the clip region so windows doesn't paint over my stuff when I call base.WndProc...
3
by: peter.chase | last post by:
In my Web application, a have an image within a DIV. One of the allowed user gestures is to drag the image with the mouse. When dragging, parts of the image that would otherwise be displayed...
3
by: Sagaert Johan | last post by:
Hi I have a customcontrol that has a boolean state variable. The control is placed over a picturebox. Depending on the value i assign a new Region to the control. The region is simple and...
1
by: Sagaert Johan | last post by:
i have a control that uses a region to make it non rectangular when i try to to remove the region by calling this.Region.Makeinfinite() the control keeps its non rectangular Region. if i call...
2
by: \(O\)enone | last post by:
I'm trying to create a usercontrol that is transparent, both visibly and to mouse clicks. I can make the usercontrol visibly transparent by setting the SupportsTransparentBackColor style and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.