本文整理汇总了C#中Gtk.DrawingArea.ModifyBg方法的典型用法代码示例。如果您正苦于以下问题:C# DrawingArea.ModifyBg方法的具体用法?C# DrawingArea.ModifyBg怎么用?C# DrawingArea.ModifyBg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.DrawingArea
的用法示例。
在下文中一共展示了DrawingArea.ModifyBg方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VideoView
public VideoView()
{
preview_pos = PreviewPos.ButtonRight;
VBox vbox = new VBox(false, 0);
vbox.Show();
Frame frame = new Frame();
//frame.BorderWidth = 5;
frame.Show();
vbox.Add(frame);
mainView = new Gtk.EventBox();
mainView.WidthRequest = 400;
mainView.HeightRequest = 300;
mainView.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255,255,255));
mainView.ModifyBg (Gtk.StateType.Active, new Gdk.Color (255,255,255));
mainView.Show();
//this.WidthRequest = 333; // 500; //250;
//this.HeightRequest = 250; // 375; //187; 250
preview = new Gtk.DrawingArea ();
preview.WidthRequest = 120; // 75; //150;
preview.HeightRequest = 90; // 56; //112;
preview.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0,0,0));
preview.ModifyBg (Gtk.StateType.Active, new Gdk.Color (0,0,0));
preview.Show();
fix = new Gtk.Fixed ();
fix.Put (preview, space, space);
fix.Show();
mainView.Add(fix);
frame.Add(mainView);
// Label label = new Label(Catalog.GetString("Video Chat in progress..."));
// label.Show();
// vbox.PackStart(label, false, true, 0);
Button button = new Button(Catalog.GetString("End Call"));
button.Clicked += OnCloseVideoClicked;
button.Show();
vbox.PackStart(button, false, false, 5);
this.Add(vbox);
mainView.SizeAllocated += OnSizeAllocated;
// this.SizeRequested += OnsizeRequested;
this.QueueResize ();
MovePreview ();
}
示例2: 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 ();
drawingArea.ExposeEvent += new ExposeEventHandler (ExposeEventCallback);
// set a minimum size
drawingArea.SetSizeRequest (200,200);
// set the color
color = new Gdk.Color (0, 0, 0xff);
drawingArea.ModifyBg (StateType.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);
ShowAll ();
}
示例3: GetDisplayWidget
public override Gtk.Widget GetDisplayWidget()
{
DrawingArea colorPreview = new DrawingArea ();
colorPreview.ModifyBg(StateType.Normal, GetColor ());
colorPreview.WidthRequest = 15;
Alignment colorPreviewAlign = new Alignment (0, 0, 0, 1);
colorPreviewAlign.SetPadding (2, 2, 2, 2);
colorPreviewAlign.Add (colorPreview);
string labelText;
System.Drawing.Color color = (System.Drawing.Color) parentRow.PropertyValue;
//TODO: dropdown known color selector so this does something
if (color.IsKnownColor)
labelText = color.Name;
else if (color.IsEmpty)
labelText = "[empty]";
else
labelText = String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B);
//we use StringValue as it auto-bolds the text for non-default values
Label theLabel = (Label) base.StringValue (labelText);
theLabel.Xalign = 0;
theLabel.Xpad = 3;
HBox hbox = new HBox ();
hbox.PackStart (colorPreviewAlign, false, false, 0);
hbox.PackStart (theLabel, true, true, 0);
return hbox;
}
示例4: DemoRotatedText
public DemoRotatedText () : base ("Rotated text")
{
DrawingArea drawingArea = new DrawingArea ();
Gdk.Color white = new Gdk.Color (0xff, 0xff, 0xff);
// This overrides the background color from the theme
drawingArea.ModifyBg (StateType.Normal, white);
drawingArea.ExposeEvent += new ExposeEventHandler (RotatedTextExposeEvent);
this.Add (drawingArea);
this.DeleteEvent += new DeleteEventHandler (OnWinDelete);
this.SetDefaultSize (2 * RADIUS, 2 * RADIUS);
this.ShowAll ();
}
示例5: MainWindow
public MainWindow()
: base("Overlaytest")
{
VBox vBox = new VBox ();
_da = new DrawingArea ();
_da.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
_da.SetSizeRequest (400, 300);
_da.DoubleBuffered = false;
vBox.PackStart (_da, false, false, 0);
_scale = new HScale (0, 1, 0.01);
_scale.DrawValue = false;
_scale.ValueChanged += ScaleValueChanged;
vBox.PackStart (_scale, false, false, 0);
HBox hBox = new HBox ();
Button btnOpen = new Button ();
btnOpen.Label = "Open";
btnOpen.Clicked += ButtonOpenClicked;
hBox.PackStart (btnOpen, false, false, 0);
Button btnPlay = new Button ();
btnPlay.Label = "Play";
btnPlay.Clicked += ButtonPlayClicked;
hBox.PackStart (btnPlay, false, false, 0);
Button btnPause = new Button ();
btnPause.Label = "Pause";
btnPause.Clicked += ButtonPauseClicked;
hBox.PackStart (btnPause, false, false, 0);
_lbl = new Label ();
_lbl.Text = "00:00 / 00:00";
hBox.PackEnd (_lbl, false, false, 0);
vBox.PackStart (hBox, false, false, 3);
Add (vBox);
WindowPosition = Gtk.WindowPosition.Center;
DeleteEvent += OnDeleteEvent;
GLib.Timeout.Add (1000, new GLib.TimeoutHandler (UpdatePos));
}
示例6: BackGroundColorChangeMenuBar
public void BackGroundColorChangeMenuBar()
{
try {
da1 = new DrawingArea ();
da1.ExposeEvent += OnExposed1;
Gdk.Color col = new Gdk.Color ();
Gdk.Color.Parse ("#3b5998", ref col);
ModifyBg (StateType.Normal, col);
da1.ModifyBg (StateType.Normal, col);
} catch (Exception ex) {
Console.Write (ex.Message);
}
}
示例7: BackGroundColorChange
public void BackGroundColorChange()
{
try {
da = new DrawingArea ();
da.ExposeEvent += OnExposed1;
Gdk.Color col = new Gdk.Color ();
Gdk.Color.Parse ("#6d84b4", ref col);
Gdk.Color col1 = new Gdk.Color ();
Gdk.Color.Parse ("#dfe3ee", ref col1);
Gdk.Color col2 = new Gdk.Color ();
Gdk.Color.Parse ("#f7f7f7", ref col2);
da.ModifyBg (StateType.Normal, col);
}
catch (Exception ex)
{
Console.Write (ex.Message);
}
}
示例8: SetButtonColor
void SetButtonColor(DrawingArea area, Color color)
{
Gdk.Color gcolor = Misc.ToGdkColor (color);
area.ModifyBg (StateType.Normal, gcolor);
area.ModifyBg (StateType.Active, gcolor);
area.ModifyBg (StateType.Insensitive, gcolor);
area.ModifyBg (StateType.Prelight, gcolor);
area.ModifyBg (StateType.Selected, gcolor);
}
示例9: initDrawingArea
// }}}
// MainWindow::initDrawingArea() {{{
/// <summary>Init the drawing area and put some layout's property</summary>
/// <param name="area">The drawing area</param>
/// <returns>void</returns>
public void initDrawingArea(DrawingArea area)
{
area.SetSizeRequest(this.pref.mainWindowWidth, this.pref.mainWindowHeight);
area.ExposeEvent += onExposeEvent;
// define some colors
Gdk.Color white = new Gdk.Color();
Gdk.Color black = new Gdk.Color();
Gdk.Color.Parse("white", ref white);
Gdk.Color.Parse("black", ref black);
// define area colors
area.ModifyBg(StateType.Normal, white);
area.ModifyBase(StateType.Normal, black);
// XXX move out ?
this.layout.Width = Pango.Units.FromPixels(this.pref.mainWindowWidth);
this.layout.Wrap = Pango.WrapMode.Word;
this.layout.Alignment = Pango.Alignment.Left;
}
示例10: Display_Result
static void Display_Result (Gdk.Color color)
{
dialog = new Dialog ();
dialog.Title = "Selected Color: " + HexFormat (color);
dialog.HasSeparator = true;
DrawingArea da = new DrawingArea ();
da.ModifyBg (StateType.Normal, color);
dialog.VBox.BorderWidth = 10;
dialog.VBox.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 ();
}
示例11: AddExtraControlsSeparator
void AddExtraControlsSeparator ()
{
projectConfigurationTable.NRows++;
extraControlsSeparator = new DrawingArea ();
extraControlsSeparator.HeightRequest = 1;
extraControlsSeparator.ModifyBg (StateType.Normal, separatorColor);
projectConfigurationTable.Attach (
extraControlsSeparator,
0,
3,
defaultTableRows,
defaultTableRows + 1,
AttachOptions.Fill,
(AttachOptions)0,
0,
10);
}
示例12: Init
private static void Init()
{
_random = new Random();
InitializeLua();
Application.Init();
if (!GLib.Thread.Supported)
GLib.Thread.Init();
Gdk.Threads.Init();
Gdk.Threads.Enter();
_window = new Gtk.Window(Globals.WINDOW_NAME);
_window.SetDefaultSize(Globals.WIDTH, Globals.HEIGHT);
_window.AppPaintable = true;
_window.DoubleBuffered = false;
_window.DeleteEvent += OnWinDelete;
_window.KeyPressEvent += OnKeyPress;
_window.KeyReleaseEvent += OnKeyRelease;
//_window.ConfigureEvent += OnWindowConfigure;
DrawingArea da = new DrawingArea();
da.ExposeEvent += OnExposed;
Gdk.Color col = new Gdk.Color(0, 0, 0);
_window.ModifyBg(StateType.Normal, col);
da.ModifyBg(StateType.Normal, col);
GLib.Timeout.Add(33, new GLib.TimeoutHandler(Graphics.TimedDraw));
_window.Add(da);
_window.ShowAll();
Gdk.Threads.Leave();
Graphics.Init(); // depends on _window being initialized
Item.Init();
Enemy.Init(); // depends on Globals ctor
Weapon.Init(); // depends on Globals ctor
Armor.Init(); // depends on Globals ctor
Accessory.Init(); // depends on Globals ctor
Materia.Init(); // depends on Globals ctor
Character.Init(); // depends on [Weapons|Armor|Materia].Init()
Globals.Init(); // depends on Character.Init()
MenuScreen.Init(); // depends on Globals.Init()
Inventory.Init(); // depends on a whole lot of things
Spell.Init(); // depends on Globals ctor
Materiatory.Init(); // depends on Materia.Init()
int time = Int32.Parse(Globals.SaveGame.SelectSingleNode("//time").InnerText);
_clock = new Clock(time); // depends on Globals ctor
// Go to Main Menu
_state = MainMenu;
// Go to new Battle
//GoToBattleState();
// Go to Post-Battle
//List<IItem> i = new List<IItem>();
//i.Add(Item.ItemTable["powersource"]);
//i.Add(Item.ItemTable["powersource"]);
//i.Add(Item.ItemTable["potion"]);
//PostBattle = new PostBattleState(234, 12, 1200, i);
//_state = PostBattle;
_state.Init();
if (Globals.Party[0] == null && Globals.Party[1] == null && Globals.Party[2] == null)
throw new GamedataException("No character in party!");
// Level-up demo
//using (StreamWriter w = new StreamWriter(@"c:\scripts\test.txt"))
//{
// while (Character.Cloud.Level < 98)
// {
// Character.Cloud.GainExperience(Character.Cloud.ToNextLevel + 10);
// w.WriteLine(Character.Cloud.ToString());
// }
// w.Flush();
//}
}