本文整理汇总了C#中Gtk.DrawingArea.OverrideBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingArea.OverrideBackgroundColor方法的具体用法?C# DrawingArea.OverrideBackgroundColor怎么用?C# DrawingArea.OverrideBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.DrawingArea
的用法示例。
在下文中一共展示了DrawingArea.OverrideBackgroundColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DemoColorSelection
public DemoColorSelection () : base ("Color Selection")
{
BorderWidth = 8;
VBox vbox = new VBox (false,8);
vbox.BorderWidth = 8;
Add (vbox);
// Create the color swatch area
Frame frame = new Frame ();
frame.ShadowType = ShadowType.In;
vbox.PackStart (frame, true, true, 0);
drawingArea = new DrawingArea ();
// set a minimum size
drawingArea.SetSizeRequest (200,200);
// set the color
color.Red = 0;
color.Green = 0;
color.Blue = 1;
color.Alpha = 1;
drawingArea.OverrideBackgroundColor (StateFlags.Normal, color);
frame.Add (drawingArea);
Alignment alignment = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
Button button = new Button ("_Change the above color");
button.Clicked += new EventHandler (ChangeColorCallback);
alignment.Add (button);
vbox.PackStart (alignment, false, false, 0);
ShowAll ();
}
示例2: Display_Result
static void Display_Result (Gdk.RGBA color)
{
dialog = new Dialog ();
dialog.Title = "Selected Color: " + HexFormat (color);
DrawingArea da = new DrawingArea ();
da.OverrideBackgroundColor (StateFlags.Normal, color);
dialog.ContentArea.BorderWidth = 10;
dialog.ContentArea.PackStart (da, true, true, 10);
dialog.SetDefaultSize (200, 200);
Button button = new Button (Stock.Ok);
button.Clicked += new EventHandler (Dialog_Ok);
button.CanDefault = true;
dialog.ActionArea.PackStart (button, true, true, 0);
button.GrabDefault ();
dialog.ShowAll ();
}