本文整理汇总了C#中Gtk.Label.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetPadding方法的具体用法?C# Label.SetPadding怎么用?C# Label.SetPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Label.SetPadding方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
string value = val.Value;
Gdk.Color col = new Gdk.Color (85, 85, 85);
if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
value = '"' + GetString (val) + '"';
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
var font = label.Style.FontDescription.Copy ();
if (font.SizeIsAbsolute) {
font.AbsoluteSize = font.Size - 1;
} else {
font.Size -= (int)(Pango.Scale.PangoScale);
}
label.ModifyFont (font);
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var line15 = label.Layout.GetLine (15);
if (line15 != null) {
label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例2: Clear
public void Clear ()
{
if (contentBox != null)
contentBox.Destroy ();
noContentLabel = new Label ();
noContentLabel.Text = noContentMessage;
noContentLabel.Xalign = 0F;
noContentLabel.Justify = Justification.Left;
noContentLabel.SetPadding (6, 6);
addButton = new Button ();
addButton.Label = addMessage;
// addButton.Relief = ReliefStyle.None;
addButton.Clicked += delegate {
OnCreateNew (EventArgs.Empty);
};
contentBox = new VBox ();
contentBox.PackStart (this.noContentLabel, true, true, 6);
var hbox = new HBox ();
hbox.PackStart (addButton, false, false, 0);
contentBox.PackEnd (hbox, false, false, 0);
PackStart (contentBox, true, true, 6);
ShowAll ();
}
示例3: Create
public static Gtk.Window Create ()
{
window = new Dialog ();
window.Title = "Bi-directional flipping";
window.SetDefaultSize (200, 100);
label = new Label ("Label direction: <b>Left-to-right</b>");
label.UseMarkup = true;
label.SetPadding (3, 3);
window.VBox.PackStart (label, true, true, 0);
check_button = new CheckButton ("Toggle label direction");
window.VBox.PackStart (check_button, true, true, 2);
if (window.Direction == TextDirection.Ltr)
check_button.Active = true;
check_button.Toggled += new EventHandler (Toggle_Flip);
check_button.BorderWidth = 10;
button = new Button (Stock.Close);
button.Clicked += new EventHandler (Close_Button);
button.CanDefault = true;
window.ActionArea.PackStart (button, true, true, 0);
button.GrabDefault ();
window.ShowAll ();
return window;
}
示例4: Label_Toggle
static void Label_Toggle (object o, EventArgs args)
{
if (label == null) {
label = new Label ("This is Text label inside a Dialog");
label.SetPadding (10, 10);
window.ContentArea.PackStart (label, true, true, 0);
label.Show ();
} else {
label.Destroy ();
label = null;
}
}
示例5: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
ops.AllowTargetInvoke = true;
ops.ChunkRawStrings = true;
ops.EllipsizedLength = 5000;//Preview window can hold aprox. 4700 chars
val.Refresh (ops);//Refresh DebuggerDisplay/String value with full length instead of ellipsized
string value = val.Value;
Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor ();
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11));
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var trimmedLine = label.Layout.GetLine (50);
if (trimmedLine != null) {
label.Text = value.Substring (0, trimmedLine.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例6: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
string value = val.Value;
Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor ();
if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
value = '"' + GetString (val) + '"';
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11));
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var line15 = label.Layout.GetLine (15);
if (line15 != null) {
label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例7: AddLabelTab
/// <summary>
/// Add tab to notebook object
/// </summary>
private void AddLabelTab(ref Gtk.Label lblObj, string title)
{
// Create and add tab for Thanks info
ScrolledWindow sw = new ScrolledWindow();
Viewport vp = new Viewport();
sw.AddWithViewport(vp);
lblObj = new Label();
lblObj.SetPadding(4,4);
lblObj.SetAlignment((float)0, (float)0);
vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
vp.Add(lblObj);
tabInfo.AppendPage(sw, new Gtk.Label(title));
}
示例8: MonoDevelopStatusBar
internal MonoDevelopStatusBar ()
{
mainContext = new MainStatusBarContextImpl (this);
activeContext = mainContext;
contexts.Add (mainContext);
Frame originalFrame = (Frame)Children [0];
// originalFrame.WidthRequest = 8;
// originalFrame.Shadow = ShadowType.In;
// originalFrame.BorderWidth = 0;
BorderWidth = 0;
Spacing = 0;
// Feedback button
if (FeedbackService.Enabled) {
CustomFrame fr = new CustomFrame (0, 0, 1, 1);
Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource ("balloon.png");
HBox b = new HBox (false, 3);
b.PackStart (new Gtk.Image (px));
b.PackStart (new Gtk.Label ("Feedback"));
Gtk.Alignment al = new Gtk.Alignment (0f, 0f, 1f, 1f);
al.RightPadding = 5;
al.LeftPadding = 3;
al.Add (b);
feedbackButton = new MiniButton (al);
//feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
fr.Add (feedbackButton);
PackStart (fr, false, false, 0);
feedbackButton.Clicked += HandleFeedbackButtonClicked;
feedbackButton.ButtonPressEvent += HandleFeedbackButtonButtonPressEvent;
;
feedbackButton.ClickOnRelease = true;
FeedbackService.FeedbackPositionGetter = delegate {
int x, y;
feedbackButton.GdkWindow.GetOrigin (out x, out y);
x += feedbackButton.Allocation.Width;
y -= 6;
return new Gdk.Point (x, y);
};
}
// Dock area
DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;
wb.DockFrame.ShadedContainer.Add (this);
Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar (PositionType.Bottom);
dockBar.NoShowAll = true;
PackStart (dockBar, false, false, 0);
// Status panels
progressBar = new ProgressBar ();
progressBar.PulseStep = 0.1;
progressBar.SizeRequest ();
progressBar.HeightRequest = 1;
statusBox = new HBox (false, 0);
statusBox.BorderWidth = 0;
statusLabel = new Label ();
statusLabel.SetAlignment (0, 0.5f);
statusLabel.Wrap = false;
int w, h;
Gtk.Icon.SizeLookup (IconSize.Menu, out w, out h);
statusLabel.HeightRequest = h;
statusLabel.SetPadding (0, 0);
EventBox eventMessageBox = new EventBox ();
messageBox = new HBox ();
messageBox.PackStart (progressBar, false, false, 0);
messageBox.PackStart (statusLabel, true, true, 0);
eventMessageBox.Add (messageBox);
statusBox.PackStart (eventMessageBox, true, true, 0);
eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;
textStatusBarPanel.BorderWidth = 0;
textStatusBarPanel.ShadowType = ShadowType.None;
textStatusBarPanel.Add (statusBox);
var eventCaretBox = new EventBox ();
var caretStatusBox = new HBox ();
modeLabel = new Label (" ");
caretStatusBox.PackEnd (modeLabel, false, false, 8);
cursorLabel = new CaretStatusLabel (" ");
caretStatusBox.PackEnd (cursorLabel, false, false, 0);
caretStatusBox.GetSizeRequest (out w, out h);
caretStatusBox.WidthRequest = w;
caretStatusBox.HeightRequest = h;
eventCaretBox.Add (caretStatusBox);
statusBox.PackEnd (eventCaretBox, false, false, 0);
statusIconBox = new HBox ();
statusIconBox.BorderWidth = 0;
statusIconBox.Spacing = 3;
statusBox.PackEnd (statusIconBox, false, false, 4);
//.........这里部分代码省略.........
示例9: AddHelpPane
void AddHelpPane()
{
VBox desc = new VBox (false, 0);
descTitleLabel = new Label ();
descTitleLabel.SetAlignment(0, 0);
descTitleLabel.SetPadding (5, 2);
descTitleLabel.UseMarkup = true;
desc.PackStart (descTitleLabel, false, false, 0);
ScrolledWindow textScroll = new ScrolledWindow ();
textScroll.HscrollbarPolicy = PolicyType.Never;
textScroll.VscrollbarPolicy = PolicyType.Automatic;
desc.PackEnd (textScroll, true, true, 0);
//TODO: Use label, but wrapping seems dodgy.
descTextView = new TextView ();
descTextView.WrapMode = WrapMode.Word;
descTextView.WidthRequest = 1;
descTextView.HeightRequest = 70;
descTextView.Editable = false;
descTextView.LeftMargin = 5;
descTextView.RightMargin = 5;
Pango.FontDescription font = Style.FontDescription.Copy ();
font.Size = (font.Size * 8) / 10;
descTextView.ModifyFont (font);
textScroll.Add (descTextView);
descFrame = desc;
vpaned.Pack2 (descFrame, false, true);
descFrame.ShowAll ();
UpdateHelp ();
}
示例10: UpdateGraphicObjects
private void UpdateGraphicObjects()
{
// Set dialog icon
AboutDialog.Icon = Gdk.Pixbuf.LoadFromResource("themonospot.png");
vpTitle.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
AboutDialog.Title = GlobalData.GetLanguageKeyValue("ABOUTWINTITLE");
ScrolledWindow sw = new ScrolledWindow();
Viewport vp = new Viewport();
sw.Add(vp);
Label lblContent = new Label();
lblContent.SetPadding(4,4);
lblContent.SetAlignment((float)0, (float)0);
vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
lblContent.Markup =
"<b>Themonospot Gtk</b>\r\n" +
" " + GlobalData.GuiDescription + "\r\n\r\n" +
"Copyright " + GlobalData.GuiCopyright + "\r\n\r\n" +
"<b>Website</b>\r\n" +
" www.integrazioneweb.com/themonospot\r\n\r\n" +
"<b>Developers</b>\r\n" +
" Armando Basile <i>([email protected])</i>\r\n" +
" Giuseppe Coviello <i>([email protected])</i>\r\n\r\n" +
"<b>Special thanks to</b>\r\n" +
" Moitah <i>([email protected])</i>\r\n" +
" Insomniac <i>([email protected])</i>\r\n" +
" Rigel.va\r\n" +
" Mubumba <i>([email protected])</i>\r\n\r\n" +
"<b>Bugs report</b>\r\n" +
" https://github.com/armando-basile/themonospot/issues\r\n";
vp.Add(lblContent);
tabInfo.AppendPage(sw, new Label(GlobalData.GetLanguageKeyValue("ABOUTTABINFO")));
string components = "<b>base component: </b>" + GlobalData.BaseRelease + "\r\n";
for (int j=0; j<GlobalData.BasePlugins.Count; j++)
{
components += "<b>" + GlobalData.BasePlugins[j].FileName + ": </b>" +
GlobalData.BasePlugins[j].Release + "\r\n";
}
sw = new ScrolledWindow();
vp = new Viewport();
sw.Add(vp);
lblContent = new Label();
lblContent.SetPadding(4,4);
lblContent.SetAlignment((float)0, (float)0);
lblContent.Markup = components;
vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
vp.Add(lblContent);
tabInfo.AppendPage(sw, new Label(GlobalData.GetLanguageKeyValue("ABOUTTABCOMPONENTS")));
tabInfo.ShowAll();
imgLogo.Pixbuf = Gdk.Pixbuf.LoadFromResource("themonospot.png");
vpLogo.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
lblTitle.Markup = "<b>Themonospot [Gtk]</b>\r\n" +
GlobalData.GuiRelease;
lblTitle.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
Gdk.Geometry geo = new Gdk.Geometry();
geo.MinHeight = 380;
geo.MinWidth = 500;
AboutDialog.SetGeometryHints(tabInfo, geo, Gdk.WindowHints.MinSize);
// wait for gui processes
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
}
示例11: MonoDevelopStatusBar
internal MonoDevelopStatusBar()
{
mainContext = new MainStatusBarContextImpl (this);
activeContext = mainContext;
contexts.Add (mainContext);
Frame originalFrame = (Frame)Children[0];
// originalFrame.WidthRequest = 8;
// originalFrame.Shadow = ShadowType.In;
// originalFrame.BorderWidth = 0;
BorderWidth = 0;
DefaultWorkbench wb = (DefaultWorkbench) IdeApp.Workbench.RootWindow;
wb.DockFrame.ShadedContainer.Add (this);
Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar (PositionType.Bottom);
dockBar.NoShowAll = true;
PackStart (dockBar, false, false, 0);
progressBar = new ProgressBar ();
progressBar.PulseStep = 0.1;
progressBar.SizeRequest ();
progressBar.HeightRequest = 1;
statusBox = new HBox (false, 0);
statusBox.BorderWidth = 0;
statusLabel = new Label ();
statusLabel.SetAlignment (0, 0.5f);
statusLabel.Wrap = false;
int w, h;
Gtk.Icon.SizeLookup (IconSize.Menu, out w, out h);
statusLabel.HeightRequest = h;
statusLabel.SetPadding (0, 0);
EventBox eventMessageBox = new EventBox ();
messageBox = new HBox ();
messageBox.PackStart (progressBar, false, false, 0);
messageBox.PackStart (statusLabel, true, true, 0);
eventMessageBox.Add (messageBox);
statusBox.PackStart (eventMessageBox, true, true, 0);
eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;
textStatusBarPanel.BorderWidth = 0;
textStatusBarPanel.ShadowType = ShadowType.None;
textStatusBarPanel.Add (statusBox);
Label fillerLabel = new Label ();
fillerLabel.WidthRequest = 8;
statusBox.PackEnd (fillerLabel, false, false, 0);
modeLabel = new Label (" ");
statusBox.PackEnd (modeLabel, false, false, 8);
cursorLabel = new Label (" ");
statusBox.PackEnd (cursorLabel, false, false, 0);
statusIconBox = new HBox ();
statusIconBox.BorderWidth = 0;
statusIconBox.Spacing = 3;
statusBox.PackEnd (statusIconBox, false, false, 4);
this.PackStart (textStatusBarPanel, true, true, 0);
ShowReady ();
Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild)this[textStatusBarPanel];
boxChild.Position = 0;
boxChild.Expand = boxChild.Fill = true;
// boxChild = (Gtk.Box.BoxChild)this[originalFrame];
// boxChild.Padding = 0;
// boxChild.Expand = boxChild.Fill = false;
this.progressBar.Fraction = 0.0;
this.ShowAll ();
statusIconBox.HideAll ();
originalFrame.HideAll ();
progressBar.Visible = false;
StatusBarContext completionStatus = null;
// todo: Move this to the CompletionWindowManager when it's possible.
CompletionWindowManager.WindowShown += delegate {
CompletionListWindow wnd = CompletionWindowManager.Wnd;
if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1) {
if (completionStatus == null)
completionStatus = CreateContext ();
completionStatus.ShowMessage (string.Format (GettextCatalog.GetString ("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo (Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
}
};
CompletionWindowManager.WindowClosed += delegate {
if (completionStatus != null) {
completionStatus.Dispose ();
completionStatus = null;
}
};
}
示例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: AddColumn
/// <summary>
/// Adds a new column, whereby the column is represented as a GTK label
/// After the last column has been added, you must confirm
/// with UpdateColumns()
/// </summary>
/// <param name="name">Name.</param>
/// <param name="width">Width.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
public void AddColumn(int tag, string name, int width, bool visible, Pango.FontDescription fd = null)
{
Label label = new Label(name)
{
UseMarkup = true,
Visible = true
};
label.SetAlignment(0, 0.5f);
label.SetPadding(2, 2);
AddColumn(name, label, tag, width, fd != null ? NewLayout(fd) : DefaultLayout);
}
示例14: PropertyGrid
internal PropertyGrid(EditorManager editorManager)
: base(false, 0)
{
this.editorManager = editorManager;
tips = new Tooltips ();
#region Toolbar
toolbar = new Toolbar ();
toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.IconSize = IconSize.SmallToolbar;
base.PackStart (toolbar, false, false, 0);
catButton = new RadioToolButton (new GLib.SList (IntPtr.Zero));
catButton.IconWidget = new Image (new Gdk.Pixbuf (null, "AspNetEdit.UI.PropertyGrid.SortByCat.png"));
catButton.SetTooltip (tips, "Sort in categories", null);
catButton.Toggled += new EventHandler (toolbarClick);
toolbar.Insert (catButton, 0);
alphButton = new RadioToolButton (catButton, Stock.SortAscending);
alphButton.SetTooltip (tips, "Sort alphabetically", null);
alphButton.Clicked += new EventHandler (toolbarClick);
toolbar.Insert (alphButton, 1);
catButton.Active = true;
SeparatorToolItem sep = new SeparatorToolItem();
toolbar.Insert (sep, 2);
#endregion
vpaned = new VPaned ();
descFrame = new Frame ();
descFrame.Shadow = ShadowType.In;
desc = new VBox (false, 0);
descFrame.Add (desc);
descTitle = new Label ();
descTitle.SetAlignment(0, 0);
descTitle.SetPadding (5, 5);
descTitle.UseMarkup = true;
desc.PackStart (descTitle, false, false, 0);
textScroll = new ScrolledWindow ();
textScroll.HscrollbarPolicy = PolicyType.Never;
textScroll.VscrollbarPolicy = PolicyType.Automatic;
desc.PackEnd (textScroll, true, true, 0);
//TODO: Use label, but wrapping seems dodgy.
descText = new TextView ();
descText.WrapMode = WrapMode.Word;
descText.WidthRequest = 1;
descText.HeightRequest = 100;
descText.Editable = false;
descText.LeftMargin = 5;
descText.RightMargin = 5;
textScroll.Add (descText);
scrolledWindow = new ScrolledWindow ();
scrolledWindow.HscrollbarPolicy = PolicyType.Automatic;
scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
vpaned.Pack1 (scrolledWindow, true, true);
vpaned.Pack2 (descFrame, false, true);
AddPropertyTab (new DefaultPropertyTab ());
AddPropertyTab (new EventPropertyTab ());
base.PackEnd (vpaned);
Populate ();
}