当前位置: 首页>>代码示例>>C#>>正文


C# ComboBox.SetSizeRequest方法代码示例

本文整理汇总了C#中Gtk.ComboBox.SetSizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.SetSizeRequest方法的具体用法?C# ComboBox.SetSizeRequest怎么用?C# ComboBox.SetSizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.ComboBox的用法示例。


在下文中一共展示了ComboBox.SetSizeRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
		}
开发者ID:Meticulus,项目名称:tactical,代码行数:45,代码来源:string_setting_viewer.cs


注:本文中的Gtk.ComboBox.SetSizeRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。