Article : Using WinForms controls in an MFC dialog

After a long gap, I’ve written another article for The Code Project.

The article is a simple introduction to using the CWinFormsControl MFC class to put a Windows Forms control on an MFC dialog.

Advertisements

2 thoughts on “Article : Using WinForms controls in an MFC dialog

  1. Hi Nishant,
    Based on your example, I decided to try out MFC to .Net bridge and actually bought your book also. I have made some progress. However, I go stuck with the problem below for which I have not been able to find a solution. I have now bought your book on C++/CLI to seek further clues to the problem below. I will appreciate if you can provide further help.
    Hi,

    I have been testing out MFC to .NET connection. I have been through a number of hurdles. This one is
    beyond me.

    #pragma once

    using namespace System;
    using namespace System::ComponentModel;
    #using

    ref class CManagedClass1
    {
    public:

    array^ MyArr;
    // default indexer
    [Category(“MyArrFIX”)]
    property int default[int] {
    int get(int index) {
    return MyArr[index];
    }
    void set(int index, int value) {
    MyArr[index] = value;
    }
    }

    bool bCanStretch;
    [Category(“Appearance”)]
    property Boolean CanStretch
    {
    Boolean get() { return bCanStretch; }
    void set(Boolean value)
    {
    bCanStretch = value;
    }
    }

    enum class suit{clubs,diamonds,spade,hearts};
    [Category(“MyPropertysuit”)]
    property suit MyPropertysuit
    {
    void set( suit value )
    {
    }
    suit MyPropertysuit::get()
    {
    // Getter code here:
    return(suit::clubs);
    }
    }
    CManagedClass1(void);
    };

    Out of 3 properties defined above, I do not know why property “MyArrFIX” DOES NOT WORK.
    Am I missing something here.
    Thanks in anticipation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s