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


C# ComboBoxEntry.SetCellDataFunc方法代码示例

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


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

示例1: NewProjectWizzard_New

        public NewProjectWizzard_New(Window parent)
        {
            if (parent != null)
                this.TransientFor =parent;
            else
                this.TransientFor = MainClass.MainWindow;

            this.Build();

            atrApplication = new FileTemplate.Attribute();
            atrApplication.Name = "application";
            atrApplication.Type = "text";

            this.DefaultHeight = 390 ;
            this.Title = MainClass.Languages.Translate("moscrif_ide_title_f1");
            ntbWizzard.ShowTabs = false;

            Pango.FontDescription customFont = lblNewProject.Style.FontDescription.Copy();//  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
            customFont.Size = customFont.Size+(int)(customFont.Size/2);
            customFont.Weight = Pango.Weight.Bold;
            lblNewProject.ModifyFont(customFont);

            storeTyp = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (string),typeof(ProjectTemplate),typeof (bool));
            storeOrientation = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (string));

            storeOutput = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf));

            nvOutput.Model = storeOutput;
            nvOutput.AppendColumn ("", new Gtk.CellRendererText (), "text", 0);
            nvOutput.AppendColumn ("", new Gtk.CellRendererText (), "text", 1);
            nvOutput.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 2);
            nvOutput.Columns[1].Expand = true;

            ivSelectTyp.Model = storeTyp;
            ivSelectTyp.SelectionMode = SelectionMode.Single;
            ivSelectTyp.Orientation = Orientation.Horizontal;

            CellRendererText rendererSelectTyp = new CellRendererText();
            rendererSelectTyp.Ypad =0;
            ivSelectTyp.PackEnd(rendererSelectTyp,false);
            ivSelectTyp.SetCellDataFunc(rendererSelectTyp, new Gtk.CellLayoutDataFunc(RenderTypProject));
            ivSelectTyp.PixbufColumn = COL_PIXBUF;
            ivSelectTyp.TooltipColumn = COL_DISPLAY_TEXT;
            ivSelectTyp.AddAttribute(rendererSelectTyp, "sensitive", 5);

            Gdk.Pixbuf icon0 = MainClass.Tools.GetIconFromStock("project.png",IconSize.LargeToolbar);
            storeTyp.AppendValues ("New Empty Project", "Create empty application", icon0, "", null,true);

            DirectoryInfo[] diTemplates = GetDirectory(MainClass.Paths.FileTemplateDir);
            foreach (DirectoryInfo di in diTemplates) {

                string name = di.Name;

                string iconFile = System.IO.Path.Combine(di.FullName,"icon.png");
                string descFile = System.IO.Path.Combine(di.FullName,"description.xml");
                if(!File.Exists(iconFile) || !File.Exists(descFile))
                    continue;

                string descr = name;
                ProjectTemplate pt = null;

                if(File.Exists(descFile)){
                    pt = ProjectTemplate.OpenProjectTemplate(descFile);
                    if((pt!= null))
                        descr = pt.Description;
                }
                Gdk.Pixbuf icon = new Gdk.Pixbuf(iconFile);
                DirectoryInfo[] templates = di.GetDirectories();
                bool sensitive = true;

                if(templates.Length<1)
                    sensitive = false;
                else
                    sensitive = true;

                storeTyp.AppendValues (name, descr, icon, di.FullName,pt,sensitive);
            }

            ivSelectTyp.SelectionChanged+= delegate(object sender, EventArgs e)
            {
                Gtk.TreePath[] selRow = ivSelectTyp.SelectedItems;
                if(selRow.Length<1){
                    lblHint.Text = " ";
                    btnNext.Sensitive = false;
                    return;
                }

                Gtk.TreePath tp = selRow[0];
                TreeIter ti = new TreeIter();
                storeTyp.GetIter(out ti,tp);

                if(tp.Equals(TreeIter.Zero))return;

                //string typ = storeTyp.GetValue (ti, 3).ToString();
                string text1 = (string) storeTyp.GetValue (ti, 0);
                string text2 = (string) storeTyp.GetValue (ti, 1);
                bool sensitive = Convert.ToBoolean(storeTyp.GetValue (ti, 5));
                if(!sensitive){
                    ivSelectTyp.SelectPath(selectedTypPrj);
                    return;
//.........这里部分代码省略.........
开发者ID:moscrif,项目名称:ide,代码行数:101,代码来源:NewProjectWizzard_New.cs


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