本文整理汇总了C#中Gtk.Label.SetSizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetSizeRequest方法的具体用法?C# Label.SetSizeRequest怎么用?C# Label.SetSizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Label.SetSizeRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecentFileListWindow
public RecentFileListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data)
: base(title, parent, flags, button_data)
{
_searchView = new Gtk.Entry ("");
_searchView.SetSizeRequest (500, 40);
_searchView.Changed += _searchView_Changed;
_searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent;
_searchView.KeyPressEvent += HandleKeyPressEvent;
_searchView.FocusOutEvent += HandleFocusOutEvent;
VBox.Add (_searchView);
CreateTree ();
VBox.Add (_treeView);
_pathLabel = new Gtk.Label ();
_pathLabel.SetSizeRequest (500, 40);
VBox.Add (_pathLabel);
MemberExtensionsHelper.Instance.IsDirty = true;
UpdateDocuments ();
this.SetSizeRequest (500, 700);
CanFocus = true;
_searchView.CanFocus = true;
_searchView.IsEditable = true;
_searchView.GrabFocus ();
ShowAll ();
}
示例2: NotificationMessage
public NotificationMessage (string t, string m) : base (false, 5)
{
this.Style = style;
BorderWidth = 5;
icon = new Image (Stock.DialogInfo, IconSize.Dialog);
this.PackStart (icon, false, true, 5);
VBox vbox = new VBox (false, 5);
this.PackStart (vbox, true, true, 0);
title = new Label ();
title.SetAlignment (0.0f, 0.5f);
this.Title = t;
vbox.PackStart (title, false, true, 0);
message = new Label ();
message.LineWrap = true;
message.SetSizeRequest (500, -1); // ugh, no way to sanely reflow a gtk label
message.SetAlignment (0.0f, 0.0f);
this.Message = m;
vbox.PackStart (message, true, true, 0);
action_box = new HBox (false, 3);
Button hide_button = new Button (Catalog.GetString ("Hide"));
hide_button.Clicked += OnHideClicked;
action_box.PackEnd (hide_button, false, true, 0);
Alignment action_align = new Alignment (1.0f, 0.5f, 0.0f, 0.0f);
action_align.Add (action_box);
vbox.PackStart (action_align, false, true, 0);
}
示例3: buildWindow
/**
* Add in all needed components to our welcome window
* */
private void buildWindow()
{
//prevent resize on home screen
this.Resizable = false;
//create label and import button - put label in event box to allow setting of background
EventBox labelContainer = new EventBox ();
Label welcomeLabel = new Label (Constants.Constants.homeWindowWelcomeText);
//set the style of the label
Style labelStyle = welcomeLabel.Style.Copy();
labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
labelStyle.FontDescription.Size = Constants.Constants.WELCOME_MESSAGE_FONT_SIZE;
welcomeLabel.Style = labelStyle.Copy();
labelContainer.Add (welcomeLabel);
labelContainer.WidthRequest = 100;
importDataButton = new Button (Constants.Constants.homeWindowImportButtonText);
importDataButton.Clicked += new EventHandler(OpenFileTree);
//set the style of the button
Style buttonStyle = importDataButton.Style.Copy ();
buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;
importDataButton.Style = buttonStyle.Copy();
welcomeLabel.SetSizeRequest (100, 100);
importDataButton.SetSizeRequest (100, 100);
//create container for import button
HBox masterContainer = new HBox ();
VBox homeWindowContainer = new VBox (false, 100);
homeWindowContainer.PackStart (labelContainer, false, false, 50);
homeWindowContainer.PackStart (importDataButton, false, false, 50);
masterContainer.PackStart (homeWindowContainer, true, true, 100);
//set size of containers
masterContainer.SetSizeRequest (1000, 1000);
this.SetSizeRequest (1000, 500);
this.Add (masterContainer);
}
示例4: add_toolbar
public void add_toolbar(string name, Toolbar toolbar)
{
Gtk.Label label = new Label(name);
label.SetSizeRequest((int)Sugar.Style.TOOLBOX_TAB_LABEL_WIDTH, -1);
label.SetAlignment(0.0f, 0.5f);
Gtk.HBox toolbar_box = new HBox();
toolbar_box.PackStart(toolbar,true, true, Sugar.Style.TOOLBOX_HORIZONTAL_PADDING);
toolbar_box.ExposeEvent += _toolbar_box_expose_cb;
_notebook.AppendPage(toolbar_box, label);
toolbar_box.Show();
if (_notebook.NPages>1) {
_notebook.ShowTabs=true;
// _separator.Show();
}
}
示例5: LevelRangeWidget
public LevelRangeWidget(string label, int low, int high)
{
IConfigSource config = new DotNetConfigSource(DotNetConfigSource.GetFullConfigPath());
int entrySize = config.Configs["defaults"].GetInt("entrySize");
int entryWidth = config.Configs["defaults"].GetInt("entryWidth");
Low = new Entry(entrySize);
Low.SetSizeRequest(entryWidth, Low.SizeRequest().Height);
Low.WidthChars = entrySize;
Low.IsEditable = false;
Low.CanFocus = false;
Label = new Label(label);
Label.Justify = Justification.Center;
Label.SetSizeRequest(150, Label.SizeRequest().Height);
High = new Entry(entrySize);
High.SetSizeRequest(entryWidth, High.SizeRequest().Height);
High.WidthChars = entrySize;
High.IsEditable = false;
High.CanFocus = false;
}
示例6: SyncDialog
// TODO: Possible to make Tomboy not crash if quit while dialog is up?
public SyncDialog ()
: base (string.Empty,
null,
Gtk.DialogFlags.DestroyWithParent)
{
progressBarTimeoutId = 0;
SetSizeRequest (400, -1);
HasSeparator = false;
// Outer box. Surrounds all of our content.
VBox outerVBox = new VBox (false, 12);
outerVBox.BorderWidth = 6;
outerVBox.Show ();
VBox.PackStart (outerVBox, true, true, 0);
// Top image and label
HBox hbox = new HBox (false, 12);
hbox.Show ();
outerVBox.PackStart (hbox, false, false, 0);
image = new Image (GuiUtils.GetIcon ("tomboy", 48));
image.Xalign = 0;
image.Yalign = 0;
image.Show ();
hbox.PackStart (image, false, false, 0);
// Label header and message
VBox vbox = new VBox (false, 6);
vbox.Show ();
hbox.PackStart (vbox, true, true, 0);
headerLabel = new Label ();
headerLabel.UseMarkup = true;
headerLabel.Xalign = 0;
headerLabel.UseUnderline = false;
headerLabel.LineWrap = true;
headerLabel.Show ();
vbox.PackStart (headerLabel, false, false, 0);
messageLabel = new Label ();
messageLabel.Xalign = 0;
messageLabel.UseUnderline = false;
messageLabel.LineWrap = true;
messageLabel.SetSizeRequest (250, -1);
messageLabel.Show ();
vbox.PackStart (messageLabel, false, false, 0);
progressBar = new Gtk.ProgressBar ();
progressBar.Orientation = Gtk.ProgressBarOrientation.LeftToRight;
progressBar.BarStyle = ProgressBarStyle.Continuous;
progressBar.ActivityBlocks = 30;
progressBar.Show ();
outerVBox.PackStart (progressBar, false, false, 0);
progressLabel = new Label ();
progressLabel.UseMarkup = true;
progressLabel.Xalign = 0;
progressLabel.UseUnderline = false;
progressLabel.LineWrap = true;
progressLabel.Wrap = true;
progressLabel.Show ();
outerVBox.PackStart (progressLabel, false, false, 0);
// Expander containing TreeView
expander = new Gtk.Expander (Catalog.GetString ("Details"));
expander.Spacing = 6;
expander.Activated += OnExpanderActivated;
expander.Show ();
outerVBox.PackStart (expander, true, true, 0);
// Contents of expander
Gtk.VBox expandVBox = new Gtk.VBox ();
expandVBox.Show ();
expander.Add (expandVBox);
// Scrolled window around TreeView
Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow ();
scrolledWindow.ShadowType = Gtk.ShadowType.In;
scrolledWindow.SetSizeRequest (-1, 200);
scrolledWindow.Show ();
expandVBox.PackStart (scrolledWindow, true, true, 0);
// Create model for TreeView
model = new Gtk.TreeStore (typeof (string), typeof (string));
// Create TreeView, attach model
Gtk.TreeView treeView = new Gtk.TreeView ();
treeView.Model = model;
treeView.RowActivated += OnRowActivated;
treeView.Show ();
scrolledWindow.Add (treeView);
// Set up TreeViewColumns
Gtk.TreeViewColumn column = new Gtk.TreeViewColumn (
Catalog.GetString ("Note Title"),
new Gtk.CellRendererText (), "text", 0);
column.SortColumnId = 0;
column.Resizable = true;
//.........这里部分代码省略.........
示例7: Main
public static void Main(string[] args)
{
Application.Init();
Gtk.Window w = new Gtk.Window("Encodroyd");
HBox mainHBox = new HBox();
HBox dropHBox = new HBox();
HBox spinVideoHBox = new HBox();
HBox spinAudioHBox = new HBox();
HBox statusButtonHBox = new HBox();
VBox mainVBox = new VBox();
VBox leftVBox = new VBox();
VBox rightVBox = new VBox();
VBox prefVBox = new VBox();
VBox statusVBox = new VBox();
MenuBar mb = new MenuBar ();
//Gtk.Frame dndFrame = new Gtk.Frame();
Gtk.Frame prefFrame = new Gtk.Frame("Preferences");
Gtk.Frame statusFrame = new Gtk.Frame("Status");
icon = new Pixbuf(null, "encodroyd.png");
Gtk.EventBox image = new Gtk.EventBox();
Gtk.Label dropLabel = new Gtk.Label("Drop videos here\nto convert");
highQualityRadio = new RadioButton(null, "High Quality (H.264)");
prefVBox.PackStart(highQualityRadio, true, true, 0);
lowQualityRadio = new RadioButton(highQualityRadio, "Low Quality (MPEG4)");
lowQualityRadio.Active = true;
prefVBox.PackStart(lowQualityRadio, true, true, 0);
statusLabel = new Gtk.Label("Idle");
pBar = new ProgressBar();
skipCurrentButton = new Gtk.Button();
Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow();
Gtk.TreeView tree = new TreeView();
listStore = new ListStore(typeof (String));
// set properties
w.Icon = icon;
// transparence
//if (w.Screen.RgbaColormap != null)
// Gtk.Widget.DefaultColormap = w.Screen.RgbaColormap;
mainHBox.BorderWidth = 6;
mainHBox.Spacing = 6;
dropHBox.BorderWidth = 6;
dropHBox.Spacing = 6;
spinVideoHBox.BorderWidth = 6;
spinVideoHBox.Spacing = 6;
spinAudioHBox.BorderWidth = 6;
spinAudioHBox.Spacing = 6;
statusButtonHBox.BorderWidth = 0;
statusButtonHBox.Spacing = 6;
leftVBox.BorderWidth = 6;
leftVBox.Spacing = 6;
rightVBox.BorderWidth = 6;
rightVBox.Spacing = 6;
prefVBox.BorderWidth = 6;
prefVBox.Spacing = 6;
statusVBox.BorderWidth = 6;
statusVBox.Spacing = 6;
statusLabel.Ellipsize = Pango.EllipsizeMode.Middle;
scrollWin.ShadowType = ShadowType.In;
statusLabel.SetSizeRequest(120,-1);
skipCurrentButton.Sensitive = false;
skipCurrentButton.Label = "Skip";
// first hbox
image.Add(new Gtk.Image(icon));
dropHBox.Add(image);
dropHBox.Add(dropLabel);
// preferences frame
prefFrame.Add(prefVBox);
prefVBox.Add(spinVideoHBox);
prefVBox.Add(spinAudioHBox);
// status frame
statusFrame.Add(statusVBox);
statusVBox.Add(statusButtonHBox);
statusVBox.Add(pBar);
statusButtonHBox.Add(statusLabel);
statusButtonHBox.Add(skipCurrentButton);
// leftvbox
leftVBox.Add(dropHBox);
leftVBox.Add(prefFrame);
leftVBox.Add(statusFrame);
// right
tree.Model = listStore;
tree.HeadersVisible = true;
tree.AppendColumn ("Queue", new CellRendererText (), "text", 0);
// scrolledwindow
scrollWin.Add(tree);
// rightvbox
rightVBox.Add(scrollWin);
//.........这里部分代码省略.........
示例8: CreateWidgets
private Widget CreateWidgets()
{
table = new Table(1, 2, false);
table.ColumnSpacing = 12;
table.BorderWidth = 4;
image = new Image(normalPixbuf);
table.Attach(image,
0, 1,
0, 1,
AttachOptions.Shrink,
0, 0, 0);
VBox vbox = new VBox(false, 0);
table.Attach(vbox,
1, 2,
0, 1,
AttachOptions.Expand | AttachOptions.Fill,
0, 0, 0);
widthForLabels = (int)maxWidth - (int)normalPixbuf.Width
- (int)table.ColumnSpacing - (int)(table.BorderWidth * 2);
nameLabel = new Label("<span size=\"large\"></span>");
vbox.PackStart(nameLabel, false, false, 0);
nameLabel.UseMarkup = true;
nameLabel.UseUnderline = false;
nameLabel.Xalign = 0;
Requisition req = nameLabel.SizeRequest();
nameLabel.SetSizeRequest(widthForLabels, -1);
Util.GtkLabelSetMaxWidthChars(nameLabel, widthForLabels);
Util.GtkLabelSetEllipsize(nameLabel, true);
locationLabel = new Label("<span size=\"small\"></span>");
vbox.PackStart(locationLabel, false, false, 0);
locationLabel.UseMarkup = true;
locationLabel.UseUnderline = false;
locationLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Active));
locationLabel.Xalign = 0;
req = locationLabel.SizeRequest();
locationLabel.SetSizeRequest(widthForLabels, req.Height);
Util.GtkLabelSetMaxWidthChars(locationLabel, widthForLabels);
Util.GtkLabelSetEllipsize(locationLabel, true);
statusLabel = new Label("<span size=\"small\"></span>");
vbox.PackStart(statusLabel, false, false, 0);
statusLabel.UseMarkup = true;
statusLabel.UseUnderline = false;
statusLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Active));
statusLabel.Xalign = 0;
req = statusLabel.SizeRequest();
statusLabel.SetSizeRequest(widthForLabels, req.Height);
Util.GtkLabelSetMaxWidthChars(statusLabel, widthForLabels);
Util.GtkLabelSetEllipsize(statusLabel, true);
return table;
}
示例9: Build
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void Build()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow));
this.panel5 = new Fixed();
//this.groupBox1 = new Gtk.Box();
this.checkBox2 = new Gtk.CheckButton();
this.checkBox1 = new Gtk.CheckButton();
this.nickname_label = new Gtk.Label();
this.nickname_ent = new Gtk.Entry();
this.username_label = new Gtk.Label();
this.username_ent = new Gtk.Entry();
this.password_label = new Gtk.Label();
this.password_ent = new Gtk.Entry();
this.button1 = new Gtk.Button();
this.LoginButton = new Gtk.Button();
this.port = new Gtk.Entry();
this.port_label = new Gtk.Label();
this.server = new Gtk.Entry();
this.server_label = new Gtk.Label();
// Standard strings
string nickName = "Guest";
string accountName = "guest";
string password = "7Y3bdzjf";
bool rcmode = true;
if (this.settings != null)
{
accountName = this.settings.Account;
password = this.settings.Password;
if (!this.settings2.Loaded)
nickName = this.settings.Nickname;
else
nickName = this.settings2.Nickname;
rcmode = this.settings.RCMode;
}
else
{
//return null;
}
//
// checkBox2
//
this.checkBox2.Active = true;
this.checkBox2.Name = "checkBox2";
this.checkBox2.Label = "RC Mode?";
this.checkBox2.Xalign = 0;
this.checkBox2.Active = rcmode;
//
// checkBox1
//
this.checkBox1.Active = false;
this.checkBox1.Name = "checkBox1";
this.checkBox1.Label = "Don\'t save password";
this.checkBox1.Xalign = 0;
//
// nickname_label
//
this.nickname_label.Name = "nickname_label";
this.nickname_label.Xalign = 0;
this.nickname_label.SetSizeRequest(73, 23);
this.nickname_label.Text = "Nickname:";
//
// nickname
//
this.nickname_ent.Name = "nickname";
this.nickname_ent.Text = nickName;
//
// username_label
//
this.username_label.Name = "username_label";
this.username_label.Xalign = 0;
this.username_label.SetSizeRequest(73, 23);
this.username_label.Text = "Account:";
//
// username
//
this.username_ent.Name = "username";
this.username_ent.Text = accountName;
//this.username.Changed += new System.EventHandler(this.username_TextChanged);
//
// password_label
//
this.password_label.Name = "password_label";
this.password_label.Xalign = 0;
this.password_label.SetSizeRequest(73, 23);
//.........这里部分代码省略.........
示例10: SeparatorWidget
public override Widget SeparatorWidget()
{
Widget separator = new Label (String.Empty);
separator.SetSizeRequest (3, 1);
separator.Show ();
return separator;
}
示例11: DemoUIManager
public DemoUIManager () : base ("UI Manager")
{
ActionEntry[] entries = new ActionEntry[] {
new ActionEntry ("FileMenu", null, "_File", null, null, null),
new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null),
new ActionEntry ("ColorMenu", null, "_Color", null, null, null),
new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null),
new ActionEntry ("HelpMenu", null, "_Help", null, null, null),
new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)),
new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)),
new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)),
new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)),
new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)),
new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)),
new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated))
};
ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] {
new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true)
};
RadioActionEntry[] colorEntries = new RadioActionEntry[] {
new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red),
new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green),
new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue)
};
RadioActionEntry[] shapeEntries = new RadioActionEntry[] {
new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square),
new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle),
new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval)
};
ActionGroup actions = new ActionGroup ("group");
actions.Add (entries);
actions.Add (toggleEntries);
actions.Add (colorEntries, (int)Color.Red, new ChangedHandler (RadioActionActivated));
actions.Add (shapeEntries, (int)Shape.Oval, new ChangedHandler (RadioActionActivated));
UIManager uim = new UIManager ();
uim.InsertActionGroup (actions, 0);
AddAccelGroup (uim.AccelGroup);
uim.AddUiFromString (uiInfo);
VBox box1 = new VBox (false, 0);
Add (box1);
box1.PackStart (uim.GetWidget ("/MenuBar"), false, false, 0);
Label label = new Label ("Type\n<alt>\nto start");
label.SetSizeRequest (200, 200);
label.SetAlignment (0.5f, 0.5f);
box1.PackStart (label, true, true, 0);
HSeparator separator = new HSeparator ();
box1.PackStart (separator, false, true, 0);
VBox box2 = new VBox (false, 10);
box2.BorderWidth = 10;
box1.PackStart (box2, false, true, 0);
Button button = new Button ("close");
button.Clicked += new EventHandler (CloseClicked);
box2.PackStart (button, true, true, 0);
button.CanDefault = true;
button.GrabDefault ();
ShowAll ();
}
示例12: set_setting
public void set_setting (Setting s)
{
if(_s != null)
throw new Exception("set_setting may only be used once per instance!");
_s = s;
name_label.Text = _s.Name;
if (_s.Choices != null && _s.Limited) {
// TODO: This is broken, code was originally written to store a string
// but in this particular case there is a setting with string type
// and you are given an array of choices, so what should really be
// stored is a value between 0 and the length of the array; to
// indicate which choice is selected. As I am changing User-Agent
// switcher to "Un Limited" I do not have a use case for this yet.
ComboBox cobo = new ComboBox ((String[])_s.Choices);
cobo.SetSizeRequest (100, 20);
cobo.Name = _s.Name;
cobo.Changed += cobo_changed;
vbox2.Add (cobo);
} else if (_s.Choices != null && !_s.Limited) {
ComboBoxEntry combo = new ComboBoxEntry ((String[])_s.Choices);
combo.SetSizeRequest (100, 20);
combo.Name = _s.Name;
combo.Entry.Text = (String)_s.Value;
combo.Changed += combo_changed;
vbox2.Add (combo);
} else {
Entry e = new Entry ((string)_s.Value);
e.Name = _s.Name;
e.Changed += e_changed;
vbox2.Add (e);
}
Label l = new Label (_s.Description);
l.SetSizeRequest (315, 100);
l.SetAlignment (0, 0);
l.LineWrap = true;
l.SingleLineMode = false;
l.SetPadding (10, 2);
Pango.FontDescription pf2 = new Pango.FontDescription ();
pf2.Weight = Pango.Weight.Light;
l.ModifyFont (pf2);
vbox2.Add(l);
}
示例13: 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 =
//.........这里部分代码省略.........
示例14: SwitchTitleView
/// <summary>
/// See SwitchContentView.
/// This is an awkward solution and should be refactored.
/// The only other way I can think if is creating two different
/// EventHandlers, and they call with different parameters which
/// Label and TextView to switch (Content or Title).
/// </summary>
/// <param name='edit'>
/// If true, paint a TextView that can be edited.
/// If false, paint a Label that displays memo.
/// </param>
public void SwitchTitleView(bool edit)
{
if (edit) {
// Removing the label
_titleLabelListener.Destroy();
// Setting up the textview
_titleTextView = new TextView ();
_titleTextView.FocusInEvent += new FocusInEventHandler(MemoTextViewGotFocus);
_titleTextView.FocusOutEvent += new FocusOutEventHandler(MemoTitleTextViewLostFocus);
TextBuffer contentBuffer = _titleTextView.Buffer;
contentBuffer.Text = this._item.GetTitle();
_titleTextView.SetSizeRequest (200, 140);
_titleTextView.Justification = Justification.Fill;
_titleTextView.WrapMode = WrapMode.Word;
_titleAlignment.Add (_titleTextView);
_titleTextView.GrabFocus();
} else {
// Saving information from textview and removing it
this._item.SetTitle(_titleTextView.Buffer.Text);
Console.WriteLine ("Setting memo title to " + _titleTextView.Buffer.Text);
_titleTextView.Destroy();
// Creating label
_titleLabel = new Label();
_titleLabel.Text = this._item.GetTitle ();
_titleLabel.SetSizeRequest (200, 80);
_titleLabel.SetAlignment (0, 0);
_titleLabel.LineWrap = true;
_titleLabel.Justify = Justification.Fill;
// Label listener
_titleLabelListener = new EventBox ();
_titleLabelListener.ButtonPressEvent += new ButtonPressEventHandler (MemoTitlePressHandler);
_titleLabelListener.Add (_titleLabel);
_titleLabelListener.SetSizeRequest(200, 80);
_titleAlignment.Add (_titleLabelListener);
}
this._container.ShowAll();
}
示例15: Dispose
/// <summary>
/// Required designer variable.
/// </summary>
//private System.ComponentModel.IContainer components = null;
/*
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose();
}
*/
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow));
this.checkBox2 = new Gtk.CheckButton();
this.checkBox1 = new Gtk.CheckButton();
this.cancelButton = new Gtk.Button();
this.loginButton = new Gtk.Button();
//
// checkBox2
//
this.checkBox2.Active = true;
this.checkBox2.Name = "checkBox2";
this.checkBox2.Label = "Graphical Menu";
this.checkBox2.Xalign = 0;
//
// checkBox1
//
this.checkBox1.Active = false;
this.checkBox1.Name = "checkBox1";
this.checkBox1.Label = "Don\'t save password";
this.checkBox1.Xalign = 0;
/*
//
// nickname_label
//
this.nickname_label.Name = "nickname_label";
this.nickname_label.Xalign = 0;
this.nickname_label.SetSizeRequest(73, 23);
this.nickname_label.Text = "Nickname:";
//
// nickname
//
this.nickname.Name = "nickname";
this.nickname.Text = "Guest";
*/
//
// button1
//
this.cancelButton.SetSizeRequest(80, 25);
this.cancelButton.Label = "Cancel";
this.cancelButton.Clicked += new System.EventHandler(this.Close);
//
// refreshButton
//
this.refreshButton = new Gtk.Button();
this.refreshButton.Name = "refreshButton";
this.refreshButton.SetSizeRequest(80, 25);
this.refreshButton.Label = "Refresh";
this.refreshButton.Clicked += new System.EventHandler(this.refreshButton_Click);
//
// LoginButton
//
this.loginButton.Name = "LoginButton";
this.loginButton.SetSizeRequest(80, 25);
this.loginButton.Label = "Connect";
this.loginButton.Clicked += new System.EventHandler(this.loginButton_Click);
/*
//
// port
//
this.port.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(123)))), ((int)(((byte)(76)))));
this.port.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.port.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(184)))), ((int)(((byte)(142)))));
this.port.Location = new System.Drawing.Point(215, 101);
this.port.Margin = new System.Windows.Forms.Padding(0);
this.port.MaximumSize = new System.Drawing.Size(50, 25);
//.........这里部分代码省略.........