473,753 Members | 7,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Dr awReversibleLin e()), 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.CreateG raphics().ClipB ounds() is returning an 'infinite'
rectangle.

Anyone have any pointers on how to do what I want in .Net?
Nov 17 '05 #1
2 6613
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.Dr awReversibleLin e()), 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.CreateG raphics().ClipB ounds() 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.Dr awReversibleLin e()), 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.CreateG raphics().ClipB ounds() 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
6262
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 copy and paste these elements so each paste is a continuation of the element numbers in the same order as the first? or maybe a better way of handling groups of 15??? Thanks Fain
11
6195
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 OnPaint . The recangle draws correct when i press the mouse, but when i release the mouse the background is not restored What should i do in the Onpaint to make sure the background (the form) is restored correctly ? This problem already keeps...
1
1306
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: // in constructor base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.StandardClick | ControlStyles.Opaque, true);
2
7605
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 bitmap. Really I want a poor man's Visio 2003 drawing control. Any example, commercial, or open source solution would be apprectiated. I could write
3
5007
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 I tried skipping base.WndProc alltogether, but it seems like the Menu and Toolbar is part of the non client region and painted during WM_NCPAINT and thus won't show up if base.WndProc is left out. How do I modify the current clip region so...
3
2286
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 outside the DIV should be clipped. I had no trouble at all achieving this on FireFox and Safari. But I can't get Internet Explorer to do the clipping; it always shows the whole image, including the bits outside the DIV. Here's the HTML: -
3
2022
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 contructed from a graphicpath containing 1 ellipse. (size no more then 100 pixels) if (state)
1
1566
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 RecreateHandle() after calling Region.Makeinfinite() it works. I Don't understand why it does not work if i don't call RecreateHandle(); Johan
2
6576
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 providing some additional processing in CreateParams and OnPaintBackground, as detailed here: http://www.codeproject.com/KB/edit/TransparentTextBox.aspx This works fine, but if I click the transparent part of my control, the
0
9072
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
8896
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9451
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
9421
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
9333
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8328
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...
0
4771
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.