The border of msgbox


What MCU/Processor/Board and compiler are you using?

NXP RT1052

What LVGL version are you using?


What do you want to achieve?

I want to remove the white part of the message box border.I don’t know why there are white things around my message box,as shown in the figure below.

What have you tried so far?

I set the background color to red and the border width to 0.But the white things are still there.I dont’t know how to cancel them.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

static const char * btns2[] = {“Ok”, “Cancel”, “”};

/* Create the message box as a child of the modal background */
lv_obj_t *mbox = lv_msgbox_create(DefaultScr, NULL);
lv_msgbox_add_btns(mbox, btns2);
lv_msgbox_set_text(mbox, "Hello world!");
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_color(mbox, LV_MSGBOX_PART_BG, LV_STATE_DEFAULT, LV_COLOR_RED);
lv_obj_set_style_local_border_width(mbox, LV_MSGBOX_PART_BG, LV_STATE_DEFAULT, 0);

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Try to remove shadows with:
lv_obj_set_style_local_shadow_width to 0

Your method works well,thank you very much.

1 Like

Hi, do you know how to set the size of msgbox?I want to set its width and height,but now it automatically adjusts its width and height based on the text.

try with