Rounded Corner Window

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

  • Rounded Corner Window

    Hi all,
    Rather than using predefined Dialogs in lib, I wanted to create my custom dialog with Window widgets.
    What I want to do is to make corners rounded . How can I do that ?

    thanks
    Regards
  • Hi,

    take a look into the sample attached. I have created a simple dialog with rounded corners. To achieve this I have set a transparency flag for the dialog and set its back ground color to GUI_INVALID_COLOR. Using GUI_INVALID_COLOR prevents the widget to draw its back ground with a default color (e.g. GUI_WHITE).

    Further I react on WM_PAINT in the dialog callback function and draw a rounded rectangle.

    Regards,
    Sven
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    good to know that I could help.

    When using alpha blending please keep in mind to deactivate it when you don't need it anymore. Otherwise it can have a heavy impact on performance. Also, in a lot of cases it not even required to use alpha blending. Depending on the design you have chosen.

    Regards,
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi

    Thanks you so much for your reminding about Alpha Blending. Here is my WM_PAINT callback and I enable Alpha at the begining then disabling at the end:

    case WM_PAINT:
    GUI_SetUserAlpha(&AlphaState, MARS_GUI_ALPHA_LEVEL);
    // Drawing
    GUI_RestoreUserAlpha(&AlphaState);
    break;

    Moreover, WM_SetHasTrans() is called in WM_CREATE stage of the windom.

    thanks
    Regards