本文整理汇总了C#中Gtk.Button.ModifyBg方法的典型用法代码示例。如果您正苦于以下问题:C# Button.ModifyBg方法的具体用法?C# Button.ModifyBg怎么用?C# Button.ModifyBg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Button
的用法示例。
在下文中一共展示了Button.ModifyBg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Unhighlight
void Unhighlight(Button button)
{
button.ModifyBg(StateType.Normal, new Gdk.Color(210, 210, 210));
button.ModifyBg(StateType.Prelight, new Gdk.Color(210, 210, 210));
}
示例2: CreateViewWidget
private Widget CreateViewWidget()
{
HBox hbox = new HBox (false, 2);
statusLabel = new Label ();
statusLabel.ModifyBg (StateType.Normal, Style.Background (StateType.Active));
statusLabel.LineWrap = false;
statusLabel.UseMarkup = true;
statusLabel.UseUnderline = false;
statusLabel.Show ();
hbox.PackStart (statusLabel, true, true, 0);
Image downImage = new Image (Stock.GoDown, IconSize.Menu);
statusDownButton = new Button (downImage);
statusDownButton.ModifyBg (StateType.Normal, Style.Background (StateType.Active));
statusDownButton.Relief = ReliefStyle.None;
statusDownButton.Clicked += OnStatusDownButtonClicked;
statusDownButton.Show ();
hbox.PackStart (statusDownButton, false, false, 0);
hbox.Show ();
return hbox;
}
示例3: Highlight
void Highlight(Button button)
{
button.ModifyBg(StateType.Normal, new Gdk.Color(0, 255, 0));
button.ModifyBg(StateType.Prelight, new Gdk.Color(0, 255, 0));
}
示例4: FetchForm
public static void FetchForm(Container Parent, XmlNode Nodes)
{
int cIndex = 0;
string[] UFont;
XmlNodeList original = Nodes.ChildNodes;
XmlNodeList reverse = new ReverseXmlList(original);
foreach (XmlNode C in reverse) {
if (C.Name == "Object") {
cIndex++;
if (C.Attributes[0].Name == "type") {
if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) {
var PB = new Gtk.Button();
global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB]));
Parent.Add(PB);
foreach (XmlNode V in C.ChildNodes) {
if (V.Name == "Property") {
switch (V.Attributes["name"].Value) {
case "BorderStyle":
if (V.InnerText == "Solid") {
//PB.ModifierStyle =
}
break;
case "Name":
PB.Name = V.InnerText;
break;
case "ForeColor":
var FColor = V.InnerText.GetXColor().ToNative();
PB.Children[0].ModifyFg(StateType.Normal, FColor);
PB.Children[0].ModifyFg(StateType.Active, FColor);
PB.Children[0].ModifyFg(StateType.Prelight, FColor);
PB.Children[0].ModifyFg(StateType.Selected, FColor);
break;
case "Caption":
case "Text":
PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")));
break;
case "BackColor":
var BColor = V.InnerText.GetXColor().ToNative();
PB.ModifyBg(StateType.Normal, BColor);
PB.ModifyBg(StateType.Active, BColor);
PB.ModifyBg(StateType.Insensitive, BColor);
PB.ModifyBg(StateType.Prelight, BColor);
PB.ModifyBg(StateType.Selected, BColor);
break;
case "SizeMode":
//PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText);
break;
case "Location":
PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX);
PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY);
break;
case "Size":
PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY));
break;
case "Font":
string VC = V.InnerText;
UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
string VCFName = UFont[0];
float VCSize = float.Parse(UFont[1].Replace("pt", ""));
float Z = (float)(VCSize * App.ScaleFactorY);
PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString()));
break;
case "Image":
if (V.HasChildNodes) {
string IMGData = V.FirstChild.InnerText;
byte[] B = System.Convert.FromBase64String(IMGData);
Pixbuf P = new Pixbuf(B);
P=P.ScaleSimple(PB.WidthRequest-10, PB.HeightRequest, InterpType.Bilinear);
PB.Image = new Gtk.Image(P);
}
break;
}
} else if (V.Name == "Object") {
//FetchForm(PB, V.ParentNode);
}
}
} else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) {
var CE = new Gtk.EventBox();
CE.ResizeMode = ResizeMode.Parent;
var CC = new Gtk.Label();
CE.Add(CC);
Parent.Add(CE);
CC.LineWrapMode = Pango.WrapMode.Word;
CC.LineWrap = true;
CC.Wrap = true;
CC.Justify = Justification.Fill;
global::Gtk.Fixed.FixedChild PBC1;
if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") {
var XVC = Parent[CE].Parent.Parent;
PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]);
} else {
PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE]));
}
foreach (XmlNode V in C.ChildNodes) {
if (V.Name == "Property") {
switch (V.Attributes["name"].Value) {
case "BorderStyle":
if (V.InnerText == "Solid") {
//PB.ModifierStyle =
//.........这里部分代码省略.........