Thread: MFC Dialogue based Prog NEED HELP PLEASE

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    34

    MFC Dialogue based Prog NEED HELP PLEASE

    Hi

    I know my way around VC++ and basically know how to write bit and pieces. My problem is that i want to create a Single dialogue based program which basically has a big drawing area in the middle and buttons on one side.

    Each button i want to represent a shape eg, square etc or maybe even a simple bitmap. I then want to be able to click on a place in the drawing area and it then gets the co-ordinates from the mouse click and draws the selected object.

    I also want to be able to save the design to file in the end and re-open it if necessary.

    I have some rough ideas but im hoping some of you on here could give me a hand with regards to specifics as im finding it quite hard. i.e things like what would be used for the drawing surface in the middle of the Dialogue Box etc.

    Thanks

    Any links too tutorials or some source code of something similar would be much appreciated.

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    223

    drawing on a dialog

    No way dude!!! Sounds like you should be using a sdi or an mdi instead of a single dialog application. This way you can serialize your the drawings by using the document... There is a tutorial in the help files called scribble.
    If you are still persistent on the idea of using a dialog... you might want to change the background color to white or something..
    You might want to load a bitmap as the bacground..

    then you will need to know the location of the drawing rectangle so that you can draw on it...
    to draw on the rectangle you can access the device context by calling GetDC() or declaring an object CClientDC dc(this);

    then using the normal GDI calls...

    You can always create your own derived class from CWnd to create the drawing surface then create it on the dialogs Init handler....

    just some ideas...
    zMan

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    34
    OK thanks man, ill look into MDI'

    A Dialogue based prog isnt what ive decided on, im just checking if there is a better way of doing it, I havent really got a clue how i could map a bit map onto a button on one form and then have it displayed at a co-ord on another form etc. See where im going?

    Im actually trying to design a very basic garden design package.

    Thanks

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    223

    drawing area

    why don't you try this...

    Create an SDI or MDI program
    Create a new tool bar using your resource editor
    and create it in the function:
    CMainFrame::OnCreate(...) // message handler...


    Then instead of docking it to the top dock it to the left side.....

    notice the CBRS_LEFT it is usually CBRS_TOP....
    you can create your own tool bar and create it like this
    or just modify the default toolbard through the resource editor...
    and put the buttons that you want...
    CBRS_LEFT
    Code:
    if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
    {
             TRACE0("Failed to create toolbar\n");
              return -1;      // fail to create
    }
    zMan

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    34
    Thanks Zman

    That is a good idea, ill try and do that, might be a bit hard though cos ive only just started learning MFC programming.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC based paint
    By c.zdravko in forum Windows Programming
    Replies: 4
    Last Post: 02-18-2008, 09:11 AM
  2. Creating a Dialog Based Application without MFC
    By MitchellH in forum C++ Programming
    Replies: 8
    Last Post: 05-21-2005, 10:02 AM
  3. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 08:34 PM
  4. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  5. Using MFC based DLL with C only exe
    By novacain in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2002, 03:40 PM