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 9227805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:10:13+00:00 2026-06-18T05:10:13+00:00

Suppose I want to develop a custom, purely graphical control to be used in

  • 0

Suppose I want to develop a custom, purely graphical control to be used in both WinForms as well as ASP.NET. The control will, based on some property settings and associated rules, render an image.

Obviously, I could just duplicate the code from the WinForms version to the ASP.NET version, but that would mean that if an error is found, or a rule is changed, I have two versions to update.

I could write a core class, with the various properties and rules needed, and the WinForms and ASP.NET control classes will have a property pointing to this core class, something like:

public class MyControlCore
{
    // all properties and control rules

    public void PaintTo(Graphics graphics)
    {
        // rendering of control
    }
}

public class MyWinFormsControl: Control
{
    public MyWinFormsControl(Control parent): base(parent)
    {
        CoreControl = new MyControlCore();
    }

    public MyControlCore CoreControl { get; private set; }

    protected override OnPaint(object sender, PaintEventArgs e)
    {
        CoreControl.PaintTo(e.Graphics);
    }
}

This will work, but in the property grid I would get a property CoreControl, containing the customization properties. Is there a way to have the property grid show the MyControlCore properties, instead of the CoreControl property with the sub properties?

I was thinking that I could perhaps accomplish this with TypeDescriptionProvider and related classes, but I’m unsure how to proceed and if it would even give me the results I’m after. I realize this would only help me in the designer, but that’s fine.

  • 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-18T05:10:14+00:00Added an answer on June 18, 2026 at 5:10 am

    There is another choice. You could use partial classes and put the common code in a single file that you can link to from both projects.

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

Sidebar

Related Questions

I want to develop a webapp using ASP.NET but it have to use some
Suppose I want to add two buffers and store the result. Both buffers are
Suppose we want to find out what will be the color property of particular
I want to develop a Java EE6 application that contains some Web-GUI functionality. Suppose
I'm starting to develop a new ASP.NET MVC application, and I'd like to make
suppose if i want to develop a windows chat application then a chat server
Suppose, I want to develop a generic library which should be usable with number-like
I want to develop an app which will support different screen sizes. I've read
The general goal: Suppose for instance I want to develop a very pluggable issue
Suppose I develop a social networking site and I decide that I want the

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.