我正在编写一个带有窗口的程序并创建一个正方形和一个椭圆
:- use_module(library(pce)).
start:-new(DW,dialog('Окно моей программы')),new(Picture,picture), send(Picture,width(350)), send(Picture, height(350)), send_list(DW, append, [Picture, new(Width, int_item(width, low:=10, high:=300, default:=150)), new(Height, int_item(height, low:=10, high:=300, default:=150))]), send(DW, append, new(X, int_item(x_coord, default:=10))), send(DW, append, new(Y,int_item(y_coord, default:=10))),send_list(DW,append,[button('нарисовать прямоугольник', message(@prolog, mybox, Picture, Width?selection, Height?selection, X?selection,Y?selection)), button('нарисовать эллипс', message(@prolog, myellipse, Picture, Width?selection, Height?selection, X?selection, Y?selection)), button('стереть',message(Picture, clear))]), send(DW, append, button(exit, and(message(DW, destroy), message(Picture, destroy)))), send(Picture, open), send(DW, open).
mybox(Picture,Width,Height,X,Y):-send(Picture, display, new(_,box(Width,Height)),point(X,Y)),send(Picture,colour,colour(red)).
myellipse(Picture,Width,Height,X,Y):-send(Picture, display, new(_,ellipse(Width,Height)),point(X,Y)).
尝试:发送(图片,颜色,颜色(红色))发送(图片,填充图案,颜色(红色))不工作。
问题:如何更改形状(边框)的颜色和形状的背景?
mybox(Picture,Width,Height,X,Y):- send(Picture, display,new(Box,box(Width,Height)),point(X,Y)), send(Box, color, color(green) ),发送(框,填充图案,颜色(黄色))。