Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to draw in a dialog's client area, but from an event ocurred in another dialog?

how to draw in a dialog's client area, but from an event ocurred in another dialog?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutoriallearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    timbk
    wrote on last edited by
    #1

    Hello, I hope that somebody can help me, the thing is this: the context: my application has one main dialog and one non-main dialog. the question: When I press a specific button in the non-main dialog, a line has to be drawn in the client area of the main dialog. how can I do this? Actually I have a method declared as public and defined in the main dialog class (an instance from Cdialog let's say) to draw my lines, this is the method:

    void CCalibracionDlg::BorrarRecta(int Rx,unsigned char D_Ry, unsigned char Vref)
    {

    CClientDC pDC(this) ;
    float tgAng=0,Ry=0; // float porque estas variables tienen cocientes
    int x = 0 , y = 0 ,y_=0; // int porque pueden ser mayor q 255
    char multiplo=0;
    unsigned char indice_recta=0, y_RectaVieja[300]; // con char alcanza
    unsigned int pixel=0, PixelRectaVieja[300]; // int porque son de 32bit
    pDC.SetWindowOrg(-168,-165); // seteo el origen de coordenadas a ese punto, q es el centro de la grilla
    .
    .a lot of code that it isn't important for this issue
    .
    }

    Of course when i use this code within the main dialog it works fine, the lines are drawn in the client area of the main dialog, but how can i do to use this code to draw in the client area of the main dialog when i press a button in the non-man dialog? . Thanks in advance, let me know if you need more information.

    H 1 Reply Last reply
    0
    • T timbk

      Hello, I hope that somebody can help me, the thing is this: the context: my application has one main dialog and one non-main dialog. the question: When I press a specific button in the non-main dialog, a line has to be drawn in the client area of the main dialog. how can I do this? Actually I have a method declared as public and defined in the main dialog class (an instance from Cdialog let's say) to draw my lines, this is the method:

      void CCalibracionDlg::BorrarRecta(int Rx,unsigned char D_Ry, unsigned char Vref)
      {

      CClientDC pDC(this) ;
      float tgAng=0,Ry=0; // float porque estas variables tienen cocientes
      int x = 0 , y = 0 ,y_=0; // int porque pueden ser mayor q 255
      char multiplo=0;
      unsigned char indice_recta=0, y_RectaVieja[300]; // con char alcanza
      unsigned int pixel=0, PixelRectaVieja[300]; // int porque son de 32bit
      pDC.SetWindowOrg(-168,-165); // seteo el origen de coordenadas a ese punto, q es el centro de la grilla
      .
      .a lot of code that it isn't important for this issue
      .
      }

      Of course when i use this code within the main dialog it works fine, the lines are drawn in the client area of the main dialog, but how can i do to use this code to draw in the client area of the main dialog when i press a button in the non-man dialog? . Thanks in advance, let me know if you need more information.

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      timbk wrote:

      when i use this code within the main dialog it works fine

      There's your answer. If it works in the main dialog, then have the non-main dialog send a message to the main dialog when the button is pressed; the message handler in the main dialog will then draw the line.

      Best wishes, Hans


      [Hans Dietrich Software]

      T 1 Reply Last reply
      0
      • H Hans Dietrich

        timbk wrote:

        when i use this code within the main dialog it works fine

        There's your answer. If it works in the main dialog, then have the non-main dialog send a message to the main dialog when the button is pressed; the message handler in the main dialog will then draw the line.

        Best wishes, Hans


        [Hans Dietrich Software]

        T Offline
        T Offline
        timbk
        wrote on last edited by
        #3

        Ok , thanks for your time, well I'm quite newbie programing, folowing your suggestion , the message that I use in the non-main's button is BN_CLICKED, and of course i have a method to handle this message, but , can you tell me how can i do to send a message to the main dialog from this message handler in the non-main dialog?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups