Draw a circle in gui window

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Draw a circle in gui window

      I make a window in gui builder and put some text and button. I can control them with their ID in main routine but i want draw a circle in window and control it in main for omit or draw. I cannt find a command which get ID of window until can draw circle or any object in it. How can i draw object in gui window with command in main routine for draw and omit? ?(
    • Hi,

      you have to add a 'case WM_PAINT' to the callback function of the dialog. This will allow you to draw into the WINDOW area. Please be aware that you have to take care about the whole window area then. If you set a back ground color for the window with WINDOW_SetBkColor() it has no effect any longer.

      Try to add this to your callback function:

      C Source Code

      1. case WM_PAINT:
      2. GUI_SetBkColor(GUI_WHITE);
      3. GUI_Clear();
      4. GUI_SetColor(GUI_RED);
      5. GUI_DrawCircle(120, 120, 60);
      6. GUI_SetColor(GUI_BLUE);
      7. GUI_DrawLine(20, 20, 130, 130);
      8. break;

      This can be done for any widget/window but will overwrite the default look of a widget. If you want to change the look of a widget you should use the skinning function or set a owner draw function (depends on the widget).

    • Thanks for your answer
      I want to change it in main routin but this function draw circle for once when window creat and you cannt change it. Skinnig function only use for widget but i would draw object like circle or rectangle. Can i use multilayer support for it?
      Thanks for regard