2011-10-24 33 views

回答

0

我想通了。

第1步。创建一个事件框并更改事件框的大小。 第2步。在事件框中添加一个imagewidget(没有图像)。 第3步。确定颜色或添加颜色按钮以确定颜色。 步骤4.创建功能如下:

Private void DrawRectangle() 
    { 
    Gdk.Color RectangleColor = colorbutton_RectangleColor.Color; 
    eventbox_rectangle.ModifyBg(StateType.Normal, RectangleColor); 
    //To modify the size of the rectangle use the following. 
    eventbox_rectangle.HeightRequest = 10; 
    eventbox_rectangle.WidthRequest = 10; 
    } 
+0

建议将Eventbox放入固定容器中。 – Screwie

0

我只是张贴,因为我超恼火,有在StackOverflow的答案没有这样的具体问题。答案上面并没有回答最初的问题以任何方式:d

gc.RgbFgColor = new Gdk.Color(204,204,204); 

你需要改变你使用的Gdk.GC对象。

相关问题