我正在尝试右对齐按钮。
到目前为止,我有这个:
#include <iup.h>
#include <stdlib.h>
int close(Ihandle *self) {
return IUP_CLOSE;
}
int main(int argc, char **argv) {
Ihandle *button, *quit, *dlg;
IupOpen(&argc, &argv);
button = IupButton(NULL, NULL);
IupSetAttribute(button, "IMAGE", "extras/view.bmp");
IupSetAttribute(button, "IMAGEPOSITION", "LEFT");
quit = IupButton(NULL, NULL);
IupSetAttribute(quit, "IMAGE", "extras/close.bmp");
IupSetAttribute(quit, "IMAGEPOSITION", "RIGHT");
IupSetCallback(quit, "ACTION", (Icallback)close);
dlg = IupDialog(IupVbox(button, quit, NULL));
IupShow(dlg);
IupMainLoop();
IupClose();
return EXIT_SUCCESS;
}
但是按钮没有向右对齐。
我尝试了以下方法:
IupSetAttribute(quit, "IMAGEPOSITION", "RIGHT");
但IupSetAttribute(quit, "ALIGNMENT", "ARIGHT");
按钮不会向右。
我可以设置SCREENPOSITON
,但我担心如果在不同尺寸的屏幕上运行可能无法正常工作。如何将按钮向右对齐?
这是一张我现在想要按钮结束的地方的图片: