本文整理汇总了C#中Label.ModifyFont方法的典型用法代码示例。如果您正苦于以下问题:C# Label.ModifyFont方法的具体用法?C# Label.ModifyFont怎么用?C# Label.ModifyFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label.ModifyFont方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Nim
public Nim()
: base("Play Nim!")
{
SetDefaultSize(250, 230);
SetPosition(WindowPosition.Center);
DeleteEvent += delegate { Application.Quit(); } ;
ModifyBg(StateType.Normal, new Gdk.Color(0,0,0));
VBox vbox = new VBox(false, 2);
Label indicator_text = new Label(indicator);
Pango.FontDescription fontdesc= Pango.FontDescription.FromString("Times New Roman 15");
indicator_text.ModifyFont(fontdesc);
/*
MenuBar mb = new MenuBar();
Menu filemenu = new Menu();
MenuItem file = new MenuItem("File");
file.Submenu = filemenu;
mb.Append(file);
vbox.PackStart(mb, false, false, 0);
*/
Table table = new Table(3,15,true);
table.Attach(indicator_text,0,15,0,1);
for( uint x=1; x<16; x++){
uint y=x-1;
table.Attach(new Button(String.Format("{0}",x)),y,x,1,2);
}
/*
table.Attach(new Button("Cls"), 0,1,0,1);
table.Attach(new Button("Bck"), 1,2,0,1);
table.Attach(new Label(), 2,3,0,1);
table.Attach(new Button("Close"),3,4,0,1);
table.Attach(new Button("7"), 0,1,1,2);
table.Attach(new Button("8"), 1,2,1,2);
table.Attach(new Button("9"), 2,3,1,2);
table.Attach(new Button("/"), 3,4,1,2);
table.Attach(new Button("4"), 0,1,2,3);
table.Attach(new Button("5"), 1,2,2,3);
table.Attach(new Button("6"), 2,3,2,3);
table.Attach(new Button("*"), 3,4,2,3);
table.Attach(new Button("1"), 0,1,3,4);
table.Attach(new Button("2"), 1,2,3,4);
table.Attach(new Button("3"), 2,3,3,4);
table.Attach(new Button("-"), 3,4,3,4);
table.Attach(new Button("0"), 0,1,4,5);
table.Attach(new Button("."), 1,2,4,5);
table.Attach(new Button("="), 2,3,4,5);
table.Attach(new Button("+"), 3,4,4,5);
*/
// vbox.PackStart(new Entry(), false, false, 0);
vbox.PackEnd(table, true, true,0);
Add(vbox);
ShowAll();
}
示例2: OnTogglebuttonToggled
protected void OnTogglebuttonToggled(object sender, System.EventArgs e)
{
if (addNewOperation_togglebutton.Active)
{
Menu menu = new Menu();
int w, h;
menu.GetSizeRequest(out w, out h);
int menu_width = left_vbox.Allocation.Width;
menu.SetSizeRequest(menu_width, h);
Dictionary<MenuItem, Type> stage_operation_types = new Dictionary<MenuItem, Type>();
for (int i = 0; i < mStageOperationTypes.Length; i++)
{
string name = StageOperationDescriptionAttribute.GetName(mStageOperationTypes[i]);
if (name == null) name = mStageOperationTypes[i].Name;
string description = StageOperationDescriptionAttribute.GetDescription(mStageOperationTypes[i]);
MenuItem item = new MenuItem();
VBox item_vbox = new VBox();
item_vbox.BorderWidth = 4;
item_vbox.Show();
Label lbl_name = new Label();
lbl_name.Text = name;
lbl_name.Justify = Justification.Left;
lbl_name.Xalign = 0;
// Setting the name font
double name_size_k = 1.1;
Pango.FontDescription name_fd = FontHelpers.ScaleFontSize(lbl_name, name_size_k);
name_fd.Weight = Pango.Weight.Bold;
lbl_name.ModifyFont(name_fd);
item_vbox.Add(lbl_name);
lbl_name.Show();
if (description != null && description != "")
{
Label lbl_desc = new Label(description);
lbl_desc.LineWrapMode = Pango.WrapMode.Word;
lbl_desc.LineWrap = true;
lbl_desc.Wrap = true;
// Setting the description font
double desc_size_k = 0.9;
Pango.FontDescription desc_fd = FontHelpers.ScaleFontSize(lbl_desc, desc_size_k);
lbl_desc.ModifyFont(desc_fd);
item_vbox.Add(lbl_desc);
lbl_desc.Show();
item_vbox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
lbl_desc.WidthRequest = args.Allocation.Width - 10;
};
}
item.Child = item_vbox;
stage_operation_types.Add(item, mStageOperationTypes[i]);
item.Activated += delegate(object s, EventArgs ea) {
mStage.CreateAndAddNewItem(stage_operation_types[(MenuItem)s]).Active = true;
GtkScrolledWindow.HscrollbarPolicy = PolicyType.Never;
GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
ArrangeVBoxes();
};
menu.Append(item);
item_vbox.CheckResize();
//lbl_desc.WidthRequest = ww;
}
menu.Deactivated += delegate {
addNewOperation_togglebutton.Active = false;
};
menu.ShowAll();
menu.Popup(null, null, delegate (Menu m, out int x, out int y, out bool push_in) {
int x1, y1, x0, y0;
GdkWindow.GetOrigin(out x0, out y0);
left_vbox.TranslateCoordinates(this, 0, 0, out x1, out y1);
x = x0 + x1;
y = y0 + y1;
push_in = false;
}, 0, 0);
}
}
示例3: InitializeGui
public void InitializeGui()
{
m_MainPanel = new Fixed();
m_OutConnectionStatus = new Label("Jaco is not connected.");
m_GeneralPanel = new Fixed();
m_TxtSerial = new Label("Jaco serial # :");
m_TxtModel = new Label("Jaco model :");
m_TxtSoftwareVersion = new Label("Software version :");
m_TxtClientID = new Label("Client ID :");
m_TxtClientName = new Label("Client name :");
m_TxtClientOrganization = new Label("Client organization :");
m_OutSerial = new Label("????");
m_OutModel = new Label("????");
m_OutSoftwareVersion = new Label("????");
m_InClientID = new Entry("");
m_InClientName = new Entry("");
m_InClientOrganization = new Entry("");
m_BTNUpdateGeneral = new Button("Update Jaco");
m_BTNUpdateGeneral.Clicked += new EventHandler(BTN_UpdateClick);
m_BTNReadGeneral = new Button("Read from Jaco");
m_BTNReadGeneral.Clicked += new EventHandler (BTN_ReadClick);
m_ConfigurationPanel = new Fixed();
m_TxtSensitivity = new Label("Control's sensitivity :");
m_TxtMaxSpeed = new Label("Permitted max speed :");
m_TxtDrinkingHeight = new Label("Drinking height :");
m_TxtDrinkingDistance = new Label("Drinking distance :");
m_TxtLaterality = new Label("Laterality :");
m_TxtFingersInverted = new Label("Fingers inverted :");
m_TxtRetractAngle = new Label("Retracted position angle :");
m_InSensitivity = new Entry("");
m_InMaxSpeed = new Entry("");
m_InDrinkingHeight = new Entry("");
m_InDrinkingDistance = new Entry("");
m_RadioRightHanded = new RadioButton("Righthanded");
m_RadioLeftHanded = new RadioButton("Lefthanded");
m_RadioLeftHanded.Group = m_RadioRightHanded.Group;
m_CheckFingersInverted = new CheckButton("Invert fingers");
m_InRetractAngle = new Entry("");
m_BTNUpdateConfig = new Button("Update Jaco");
m_BTNUpdateConfig.Clicked += new EventHandler(BTN_UpdateClick);
m_BTNReadConfig = new Button("Read from Jaco");
m_BTNReadConfig.Clicked += new EventHandler(BTN_ReadClick);
m_DiagnosisPanel = new Fixed();
m_TxtAxis1Version = new Label("Axis 1 version :");
m_TxtAxis2Version = new Label("Axis 2 version :");
m_TxtAxis3Version = new Label("Axis 3 version :");
m_TxtAxis4Version = new Label("Axis 4 version :");
m_TxtAxis5Version = new Label("Axis 5 version :");
m_TxtAxis6Version = new Label("Axis 6 version :");
m_TxtFinger1Version = new Label("Finger 1 version :");
m_TxtFinger2Version = new Label("Finger 2 version :");
m_TxtFinger3Version = new Label("Finger 3 version :");
m_TxtMainCANVersion = new Label("Main CAN version :");
m_TxtExtCANVersion = new Label("Ext CAN Version :");
m_OutAxis1Version = new Label("????");
m_OutAxis2Version = new Label("????");
m_OutAxis3Version = new Label("????");
m_OutAxis4Version = new Label("????");
m_OutAxis5Version = new Label("????");
m_OutAxis6Version = new Label("????");
m_OutFinger1Version = new Label("????");
m_OutFinger2Version = new Label("????");
m_OutFinger3Version = new Label("????");
m_OutMainCANVersion = new Label("????");
m_OutExtCANVersion = new Label("????");
m_TxtInfo = new Label("");
m_InFileReprogram = new FileChooserButton("Select a file", FileChooserAction.Open);
m_InFileReprogram.WidthRequest = 440;
m_BTNReprogram = new Button("Reprogram Jaco");
m_BTNReprogram.Clicked += new EventHandler(BTN_ReprogramClick);
m_BTNReadDiagnosis = new Button("Read from Jaco");
m_BTNReadDiagnosis.Clicked += new EventHandler(BTN_ReadClick);
m_MainTitle = new Label("Kinova software example");
Pango.FontDescription fontMaintTile = Pango.FontDescription.FromString("Garamond 30");
m_MainTitle.ModifyFont(fontMaintTile);
m_TabGeneral = new Label("General");
m_TabConfiguration = new Label("Configuration");
m_TabDiagnosis = new Label("Diagnosis");
m_MainTab = new Notebook();
m_MainTab.WidthRequest = 500;
m_MainTab.HeightRequest = 500;
m_MainTab.AppendPage(m_GeneralPanel, m_TabGeneral);
m_MainTab.AppendPage(m_ConfigurationPanel, m_TabConfiguration);
m_MainTab.AppendPage(m_DiagnosisPanel, m_TabDiagnosis);
}
示例4: Create
public Widget Create()
{
var licenseInfo = LicenseManager.CurrentLicenseInfo;
LicenseManager.LicenseChanged += OnLicenseChanged;
vbox = new VBox { Spacing = 6 };
hbox1 = new HBox { Spacing = 16, Margin = 10};
vbox11 = new VBox { Spacing = 6 };
vbox12 = new VBox { Spacing = 6 };
hbox2 = new HBox { Spacing = 6, MarginBottom = 10, MarginRight = 10 };
vbox21 = new VBox { Spacing = 6, MarginLeft = 10};
hbox211 = new HBox { Spacing = 4 };
hbox212 = new HBox { Spacing = 6 };
WidgetHelper.AddWidget(hbox1, vbox11, 0);
WidgetHelper.AddWidget(hbox1, vbox12, 1);
WidgetHelper.AddWidget(hbox2, vbox21, 0, true);
WidgetHelper.AddWidget(vbox21, hbox211, 0);
WidgetHelper.AddWidget(vbox21, hbox212, 1);
WidgetHelper.AddWidget(vbox, hbox1, 1, true);
WidgetHelper.AddWidget(vbox, hbox2, 2);
licenseStatusLabel = new Label { LabelProp = "Статус лицензии: " + licenseInfo.LicenseMode.ToDescription(), Halign = Align.Start, Margin = 10 };
licenseStatusLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox, licenseStatusLabel, 0);
remotePlaceNameLabel = new Label { LabelProp = "GLOBAL Удаленное рабочее место (количество)" };
remotePlaceNameLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox11, remotePlaceNameLabel, 0);
fireFightingNameLabel = new Label { LabelProp = "GLOBAL Пожаротушение" };
fireFightingNameLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox11, fireFightingNameLabel, 1);
guardNameLabel = new Label { LabelProp = "GLOBAL Охрана" };
guardNameLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox11, guardNameLabel, 2);
accessNameLabel = new Label { LabelProp = "GLOBAL Доступ" };
accessNameLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox11, accessNameLabel, 3);
videoNameLabel = new Label { LabelProp = "GLOBAL Видео" };
videoNameLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox11, videoNameLabel, 4);
opcServerNameLabel = new Label { LabelProp = "GLOBAL OPC Сервер" };
opcServerNameLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox11, opcServerNameLabel, 5);
remotePlaceValueLabel = new Label { LabelProp = licenseInfo.RemoteClientsCount.ToString() };
remotePlaceValueLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox12, remotePlaceValueLabel, 0);
fireFightingValueLabel = new Label { LabelProp = licenseInfo.HasFirefighting ? "Да" : "Нет" };
fireFightingValueLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox12, fireFightingValueLabel, 1);
guardValueLabel = new Label { LabelProp = licenseInfo.HasGuard ? "Да" : "Нет" };
guardValueLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox12, guardValueLabel, 2);
accessValueLabel = new Label { LabelProp = licenseInfo.HasSKD ? "Да" : "Нет" };
accessValueLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox12, accessValueLabel, 3);
videoValueLabel = new Label { LabelProp = licenseInfo.HasVideo ? "Да" : "Нет" };
videoValueLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox12, videoValueLabel, 4);
opcServerValueLabel = new Label { LabelProp = licenseInfo.HasOpcServer ? "Да" : "Нет" };
opcServerValueLabel.ModifyFont(FontDescription.FromString("Arial 12"));
WidgetHelper.AddWidget(vbox12, opcServerValueLabel, 5);
keyLabel = new Label { LabelProp = "Ключ:" };
WidgetHelper.AddWidget(hbox211, keyLabel, 0);
keyEntry = new Entry
{
Text = LicenseManager.InitialKey.ToString(),
IsEditable = false,
CanFocus = false
};
WidgetHelper.AddWidget(hbox211, keyEntry, 1, true);
fileLabel = new Label
{
Name = "fileLabel",
LabelProp = "Файл:"
};
WidgetHelper.AddWidget(hbox212, fileLabel, 0);
filePathEntry = new Entry();
WidgetHelper.AddWidget(hbox212, filePathEntry, 1, true);
//.........这里部分代码省略.........
示例5: ComposeLines
void ComposeLines(Algorithm.Diff.Range range, char style, int otherStart, Table table, uint startRow, bool axn, uint col, bool wrap, Pango.FontDescription font, bool lineNumbers) {
int off1 = lineNumbers ? 1 : 0;
int off2 = off1 + (axn ? 1 : 0);
for (uint i = 0; i < range.Count; i++) {
if (lineNumbers) {
string lineNo = (range.Start + i + 1).ToString();
if (otherStart != -1 && range.Start != otherStart)
lineNo += "/" + (otherStart + i + 1).ToString();
Label label = new Label(lineNo);
label.ModifyFont( font );
label.Yalign = 0;
table.Attach(label, col,col+1, startRow+i,startRow+i+1, AttachOptions.Shrink, AttachOptions.Shrink, 1, 1);
}
if (axn) {
Label actionlabel = new Label(style.ToString());
table.Attach(actionlabel, (uint)(col+off1),(uint)(col+off1+1), startRow+i,startRow+i+1, AttachOptions.Shrink, AttachOptions.Shrink, 1, 1);
}
RangeEventBox line = new RangeEventBox(new RangeRenderer((string)range[(int)i], style, wrap, font));
table.Attach(line, (uint)(col+off2),(uint)(col+off2+1), startRow+i,startRow+i+1);
}
}