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

  • Home
  • SEARCH
  • 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 8402423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:03:34+00:00 2026-06-09T22:03:34+00:00

An example: Using VS I can create MyControl which derives from UserControl, to this

  • 0

An example:

Using VS I can create MyControl which derives from UserControl, to this can be added a set of data as a member or property.
Using the visual designer I can add a two panels to MyControl – each intended to render the same data but in a different form (FTSOA say a pie chart and a bar graph) using methods I intend to supply.

I think there are a number of approaches that will allow MyControl to use those methods to redraw the panels.

Firstly use VS to add a paint event for each panel. This is quick to implement and allows the methods access to MyControl data as they are created within the MyControl class.

Secondly to override the OnPaint method for each panel. AFAIK to do this requires creating a UserControl for each panel with the associated class. Then the OnPaint method of each class can be overridden. A downside is that each class has to be given access to MyControl data.

Thirdly it is also likely (I’ve not done this one) that overriding MyControl OnPaint and manually re-drawing each panel is also possible – but getting hold of the Graphics etc is an issue.

Question:
I can get (1 & 2) to work, but I’d like to know what other people think.

  • 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-09T22:03:36+00:00Added an answer on June 9, 2026 at 10:03 pm

    Well, all of the above. But a Panel control certainly wasn’t optimized to be a very good control for painting. It derives from ScrollableControl and that’s what it is really good at, a container that can scroll its content. Also good as quick way to move a group of controls. Or hide them. Or disable them.

    It is not exactly ideal for painting. It doesn’t double-buffer, turning that on requires deriving your own control from it. And it also optimizes for container behavior, you’ll need to turn on the ControlStyles.ResizeRedraw style to get the Paint event to fire when it resizes. If you actually need custom painting that also needs to be scrollable then Panel is a good base class to derive from.

    Sounds to me you should really override the UserControl’s OnPaint() method. Minimizing the number of controls is a very strong optimization goal, they are really expensive.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I create one query using both ICriteria and Linq? Example: var q
For example using SQL I can do: SELECT (a+b) as c FROM table WHERE
How can I omit Zeros in my data? For example using the MIN function?
I'm wondering if I can create a Property that returns a read-only Dictionary? Example:
I'm working in Delphi 2007. Net, where I can find an example of using
Using cURL I can send a GET request with a body. Example: curl -i
I can't seem to find a gem or example of anyone using Rails-style rake
I follow example from here using section listview http://lalit3686.blogspot.com/2012/05/sectionadapter.html But how can I implement
Can someone provide an example of drawing an iPhone-like turning wheel using Core Graphics
Can anybody give any working example of how to read/write Unicode text files using

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.