WinForms Controls

srfpala 111 Reputation points
2020-10-24T21:54:48.133+00:00

Using VC++ 2019 Comm Ed. under Win 10 building a Windows
Form application.
I would like to add controls to my form by using the ToolBox dialog editor.
I can use the dialog editor to add controls to the Help| About Message dialog.
So I know the Dialog editor is present. But how do I add controls to
the main form which now is blank and has only File and Help menu items ?
TIA
Bob

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,891 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Anonymous
    2020-10-24T22:26:13.87+00:00

    From the toolbox flyout you should be able to just drag them over and drop on form.

    34730-win10x64-vs-remote-desktop-connection-2020-10-24-1.gif

    --please don't forget to Accept as answer if the reply is helpful--

    0 comments No comments

  2. Daniel Zhang-MSFT 9,626 Reputation points
    2020-10-26T07:57:05.63+00:00

    Hi srfpala,
    Could your form be displayed normally as shown below?
    34918-10261.png
    If not, please follow the steps below:
    1.Create new CLR Empty Project.
    2.Right-click your project name and add new item from UI->Windows Forms.
    3. Next, you will go to Project>>Properties>>Linker>>System, in the field "SubSystem" you choose "Windows (/SUBSYSTEM:WINDOWS)", click Apply.
    And then go to Project>>Properties>>Linker>>Advanced, in the field "entry point", input value "Main" and Apply, finally click OK.
    After, you go to file code of form you created(ex: MyForm.cpp) and input code bellow to this file(Project1 is my test project name, you need to change to your project name.)

    using namespace System;  
    
    using namespace System::Windows::Forms;  
    
    [STAThreadAttribute]  
    
    void Main(array<String^>^ args)  
    
    {  
    
    Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); Project1::MyForm form; Application::Run(%form);  
    
    }  
    

    4.Save and exit visual studio, and then open it again, UI Form will work.
    5.Finallly, you can drag controls from Toolbox to MyForm.h[Design]
    Here some related links you can refer to.
    Visual Studio 2017 - can't find Visual C++ Windows Forms
    Visual Studio 2017 and 2019 C++/CLI Missing
    Best Regards,
    Daniel Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    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

  3. srfpala 111 Reputation points
    2020-10-26T16:57:21.963+00:00

    Daniel
    I think I may have found an easier solution which worked nicely for me.
    See
    https://www.rkaiser.de/wp-content/uploads/2019/04/cpp-2019-WinForms-Anleitung-EN.pdf
    Give it a try and let me know what you think.
    Bob


  4. srfpala 111 Reputation points
    2020-10-27T22:08:59.507+00:00

    Sorry about the link. Try this
    https://marketplace.visualstudio.com/items?itemName=RichardKaiser.CppWinformsVS2019VSIX001
    Let me know what you think.
    Bob


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.