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


C# Gtk.AppendText方法代码示例

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


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

示例1: FillComboBoxEntry

        /// <summary>
        /// Fills the combo box entry.
        /// </summary>
        /// <param name='combo'>
        /// Combo.
        /// </param>
        /// <param name='items'>
        /// Items.
        /// </param>
        /// <param name='currentValue'>
        /// Current value.
        /// </param>
        /// <param name='editable'>
        /// Editable.
        /// </param>
        public static void FillComboBoxEntry(Gtk.ComboBoxEntry combo, List<string> items, string currentValue,bool isDecimal,bool editable)
        {
            combo.Model = new ListStore(typeof(string));

            var resultItems = new List<string>();
            if (editable)
            {
                    // searching for value
                    var present = false;
                    foreach (var value in items)
                    {
                        if (
                                (isDecimal && (SupportMethods.ToDecimal(value) == SupportMethods.ToDecimal(currentValue)))
                                ||
                               	(!isDecimal && (value == currentValue))
                           )
                        {
                            present = true;
                            break;
                        }
                    }

                // adding missing to first pos
                if (!present)
                {
                    resultItems.Add(currentValue);
                }

                foreach (var value in items)
                    resultItems.Add(value);
            } else
            {
                    resultItems.Add(currentValue);
            }

            var index = 0;
            foreach (var value in resultItems)
            {
                combo.AppendText(value);

                if (
                                (isDecimal && (SupportMethods.ToDecimal(value) == SupportMethods.ToDecimal(currentValue)))
                                ||
                               	(!isDecimal && (value == currentValue))
                    )
                {
                    combo.Active = index;
                }
                index++;
            }
        }
开发者ID:petrj,项目名称:MediaConvertGUI,代码行数:66,代码来源:SupportMethods.cs

示例2: FillComboBox

        /// <summary>
        /// Fills the combo box.
        /// </summary>
        /// <param name='combo'>
        /// Combo.
        /// </param>
        /// <param name='items'>
        /// Items.
        /// </param>
        /// <param name='editable'>
        /// Editable.
        /// </param>
        /// <param name='currentValue'>
        /// Current value.
        /// </param>
        public static void FillComboBox(Gtk.ComboBox combo, Type enumType, bool editable, int currentValue)
        {
            // clear combo
            combo.Model = new ListStore(typeof(string));

            // adding all items
            var index=0;
                foreach (var item in Enum.GetNames(enumType))
                {
                    if (editable || (index == currentValue))
                    {
                        combo.AppendText(item);

                        if (!editable) combo.Active = 0;
                        else
                        if (index == currentValue) combo.Active = index;

                    }
                    index++;

                }
        }
开发者ID:petrj,项目名称:MediaConvertGUI,代码行数:37,代码来源:SupportMethods.cs

示例3: FillComboboxWithStrings

 private void FillComboboxWithStrings(Gtk.ComboBox box, string[] strings)
 {
     ((Gtk.ListStore)(box.Model)).Clear();
     for (int i=0;i<strings.Length;i++){
         box.AppendText(strings[i]);
     }
     box.Active=0;
     box.Sensitive=(strings.Length>1);
 }
开发者ID:BackupTheBerlios,项目名称:gnomeartng-svn,代码行数:9,代码来源:Main.cs

示例4: LoadHostList

    protected void LoadHostList(Gtk.ComboBox HostList)
    {
        ClearList(HostList);

        try
        {
            string[] hostsArr = System.IO.Directory.GetDirectories("/sys/class/scsi_host");
            foreach(string hostName in hostsArr)
            {
                if(!System.IO.File.Exists(hostName + "/scan")) continue;
                HostList.AppendText(System.IO.Path.GetFileName(hostName));
            }
            HostList.Active = 0;
        }
        catch { }
    }
开发者ID:volgruk,项目名称:GPartimage-ng,代码行数:16,代码来源:MainWindow.cs

示例5: LoadDevList

    protected void LoadDevList(Gtk.ComboBox DeviceList)
    {
        ClearList(DeviceList);

        try
        {
            string[] devArr = System.IO.Directory.GetFiles("/dev");
            foreach(string devPath in devArr)
            {
                string devName = System.IO.Path.GetFileName(devPath);
                if(devName.Length < 3) continue;
                if(devName.Substring(0,2) != "sd") continue;
                DeviceList.AppendText(devName);
            }
            DeviceList.Active = 0;
        }
        catch { }
    }
开发者ID:volgruk,项目名称:GPartimage-ng,代码行数:18,代码来源:MainWindow.cs


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