Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8707057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:46:16+00:00 2026-06-13T03:46:16+00:00

I am designing a control where the user can specify the X, Y, Width

  • 0

I am designing a control where the user can specify the X, Y, Width and Height of the DisplayRectangle property in relation to the ClientRectangle.

From what I have read in the MSDN documentation, DisplayRectangle only has a get accessor, and therefore its dimensions cannot be set, however this is imperative in my control!

Can any one suggest how I might safely implement a DisplayRectangle that has both get and set accessors? – or explain why this is bad practice?

Thanks.

TESTS:

  1. Set TabControl style to UserPaint, and adjust the Alignment property, The DisplayRectangle moves to compensate for the location of the tabs. Assuming TabControl has a built in mechanism to set the Rectangle bounds.

  2. Created DemoControl : Control, painted ClientRectangle in Red, and DisplayRectangle in Blue and tried calling SetDisplayRectLocation(x, y)…not quite what I wanted…and yielded no results!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:46:17+00:00Added an answer on June 13, 2026 at 3:46 am

    In order to allow the user to set the bounds of the DisplayRectangle property for a control, I have come up with the following solution:

    public class ExtendedControl : Control
    {
        private Rectangle displayRectangle;
    
        protected override Rectangle DisplayRectangle
        {
            get { return this.displayRectangle; }
        }
    
        public void SetDisplayRectangle(Rectangle rect)
        {
            this.displayRectangle = rect;
        }
    
        public ExtendedControl()
        {
            this.displayRectangle = base.DisplayRectangle;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently designing a user control which will have other controls contained within
while designing my user control, i encountered the following problem: i would like to
I'm designing a simple expander control. I've derived from UserControl, drawn inner controls, built,
I am designing a user control that attempts to create a filter bar with
I'm currently designing a custom tab control class which derives from System.Windows.Forms.Control. The problem
I am designing a WPF user control which contains other user controls (imagine a
I've made a simple project to illustrate my problem. I have a user control
I am defining a user control deriving from TextBox class in Windows Forms. The
I'm designing an user control and I'd like to make its behaviour configurable -
Suppose I was designing a component representing grips on a UI control for resizing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.