Should I resize the canvas

BenTam 1,621 Reputation points
2023-12-02T17:08:27.3666667+00:00

Dear All,

On a WindowsFormControlLibrary project, when I add a UserControl, a canvas is shown. After adding a button, should I resize the canvas? Which of the following is right?

Adding a button on the canvas (canvas not resized)
ButtonOnCanvas

Resizing the canvas
CanvasResized

**

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,637 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiale Xue - MSFT 43,046 Reputation points Microsoft Vendor
    2023-12-04T01:23:33.72+00:00

    Hi @BenTam-3003 , Welcome to Microsoft Q&A,

    As I said before in your question: https://learn.microsoft.com/en-us/answers/questions/1428070/what-is-the-difference-between-wpfcustomcontrollib said that generally we need to use usercontrol when we need to fix several commonly used control combinations together.

    If you only place a single control and resize its canvas, there is not much difference from directly creating a button custom control.

    What you need to know is that your canvas will obscure subsequent controls after being dragged into the designer, and you need to take this into account.

    Generally, when we use usercontrol, we will customize the appropriate canvas size.

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful