• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IWindowsFormsEditorService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IWindowsFormsEditorService的典型用法代码示例。如果您正苦于以下问题:C# IWindowsFormsEditorService类的具体用法?C# IWindowsFormsEditorService怎么用?C# IWindowsFormsEditorService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IWindowsFormsEditorService类属于命名空间,在下文中一共展示了IWindowsFormsEditorService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EditValue

        public override object EditValue( ITypeDescriptorContext context, IServiceProvider provider, object value )
        {
            if( context != null && provider != null )
            {
                editorService = (IWindowsFormsEditorService)provider.GetService( typeof( IWindowsFormsEditorService ) );
                if( editorService != null )
                {
                    // Create a new trackbar and set it up.
                    TrackBar trackBar = new TrackBar();
                    trackBar.ValueChanged += new EventHandler( this.ValueChanged );
                    trackBar.MouseLeave += new EventHandler( this.MouseLeave );
                    trackBar.Minimum = 0;
                    trackBar.Maximum = 100;
                    trackBar.TickStyle = TickStyle.None;

                    // Get the low/high values.
                    PropertyDescriptor prop = context.PropertyDescriptor;
                    RangeAttribute ra = prop.Attributes[typeof( RangeAttribute )] as RangeAttribute;
                    valueLow = ra.Low;
                    valueHigh = ra.High;

                    // Set the corresponding trackbar value.
                    double percent = ( System.Convert.ToDouble( value ) - valueLow ) / ( valueHigh - valueLow );
                    trackBar.Value = (int)( 100 * percent );

                    // Show the control.
                    editorService.DropDownControl( trackBar );

                    // Here is the output value.
                    value = valueLow + ( (double)trackBar.Value / 100 ) * ( valueHigh - valueLow );
                }
            }

            return value;
        }
开发者ID:roice3,项目名称:Honeycombs,代码行数:35,代码来源:TrackBarValueEditor.cs


示例2: EditValue

        /// <summary>
        /// Displays a list of available values for the specified component than sets the value.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
        /// <param name="provider">A service provider object through which editing services may be obtained.</param>
        /// <param name="value">An instance of the value being edited.</param>
        /// <returns>The new value of the object. If the value of the object hasn't changed, this method should return the same object it was passed.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                // This service is in charge of popping our ListBox.
                _service = ((IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)));

                if (_service != null && value is DropDownListProperty)
                {
                    var property = (DropDownListProperty) value;

                    var list = new ListBox();
                    list.Click += ListBox_Click;

                    foreach (string item in property.Values)
                    {
                        list.Items.Add(item);
                    }

                    // Drop the list control.
                    _service.DropDownControl(list);

                    if (list.SelectedItem != null && list.SelectedIndices.Count == 1)
                    {
                        property.SelectedItem = list.SelectedItem.ToString();
                        value =  property;
                    }
                }
            }

            return value;
        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:39,代码来源:DropDownListPropertyEditor.cs


示例3: EditValue

        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context != null && provider != null)
            {
                edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    lb = new ListBox();
                    lb.Items.AddRange(new object[] {
                        "Sunday",
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday",
                        "Saturday"});
                    lb.SelectedIndexChanged += new System.EventHandler(lb_SelectedIndexChanged);
                    edSvc.DropDownControl(lb);
                }
                return text;

            }

            return base.EditValue(context, provider, value);
        }
开发者ID:harpreetoxyent,项目名称:pnl,代码行数:25,代码来源:EIBSchedular.cs


示例4: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null
                && context.Instance != null
                && provider != null)
            {
                edSvc = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService));

                if (edSvc != null)
                {
                    // Create a CheckedListBox and populate it with all the enum values
                    FontListbox = new ListBox
                                  {DrawMode = DrawMode.OwnerDrawFixed, BorderStyle = BorderStyle.None, Sorted = true};
                    FontListbox.MouseDown += OnMouseDown;
                    FontListbox.DoubleClick += ValueChanged;
                    FontListbox.DrawItem += LB_DrawItem;
                    FontListbox.ItemHeight = 20;
                    FontListbox.Height = 200;
                    FontListbox.Width = 180;

                    ICollection fonts = new FontEnum().EnumFonts();
                    foreach (string font in fonts)
                    {
                        FontListbox.Items.Add(font);
                    }
                    edSvc.DropDownControl(FontListbox);
                    if (FontListbox.SelectedItem != null)
                        return FontListbox.SelectedItem.ToString();
                }
            }

            return value;
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:33,代码来源:FontEnum.cs


示例5: BookmarkScreen

 public BookmarkScreen(IWindowsFormsEditorService wfes, PlaylistItem plItem) : this()
 {
     _wfes = wfes;
     _showFilePath = false;
     _canAddToCurrent = false;
     this.PlaylistItem = plItem;
 }
开发者ID:rraguso,项目名称:protone-suite,代码行数:7,代码来源:BookmarkScreen.cs


示例6: TextureViewControl

 public TextureViewControl(
     TextureInfo texture,
     IWindowsFormsEditorService editorService)
 {
     // This call is required by the designer.
     InitializeComponent();
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:7,代码来源:TextureViewControl.cs


示例7: EditValue

        /// <summary>
        /// When editing an image index value, let the user choose an image from
        /// a popup that displays all the images in the associated <see cref="ImageSet"/>
        /// </summary>
        /// <param name="context">designer context</param>
        /// <param name="provider">designer service provider</param>
        /// <param name="value">image index item</param>
        /// <returns>
        /// An image index (selected from the popup) or -1 if the user canceled the
        /// selection
        /// </returns>
        public override object EditValue(ITypeDescriptorContext context,IServiceProvider provider,object value)
        {
            wfes = (IWindowsFormsEditorService)
                provider.GetService(typeof(IWindowsFormsEditorService));

            if((wfes == null) || (context == null))
                return null ;

            // Get the image set
            ImageSet imageSet = GetImageSet(context.Instance) ;

            // anything to show?
            if ((imageSet == null) || (imageSet.Count==0))
                return -1 ;

            // Create an image panel that is close to square
            Size dims = ImagePanel.CalculateBestDimensions(imageSet.Count,ImagePanel.PanelSizeHints.MinimizeBoth) ;
            imagePanel = new ImagePanel((Bitmap) imageSet.Preview,imageSet.Count,dims.Height,dims.Width) ;
            // set the current image index value as the default selection
            imagePanel.DefaultImage = (int) value ;
            // no grid
            imagePanel.GridColor = Color.Empty ;
            // listen for an image to be selected
            imagePanel.ImageSelected += new EventHandler(imagePanel_ImageSelected);

            // show the popup as a drop-down
            wfes.DropDownControl(imagePanel) ;

            // return the selection (or the original value if none selected)
            return (selectedIndex != -1) ? selectedIndex : (int) value ;
        }
开发者ID:svn2github,项目名称:fiddler-plus,代码行数:42,代码来源:ImageMapEditor.cs


示例8: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null
                && context.Instance != null
                && provider != null)
            {
                edSvc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                if (edSvc != null)
                {
                    ListBox lb = new ListBox();
                    lb.SelectedIndexChanged += new EventHandler(this.SelectedChanged);
                    MetroColorGeneratorParameters currentParams = (MetroColorGeneratorParameters)value;
                    MetroColorGeneratorParameters[] metroThemes = MetroColorGeneratorParameters.GetAllPredefinedThemes();
                    string selectedTheme = null;
                    foreach (MetroColorGeneratorParameters mt in metroThemes)
                    {
                        lb.Items.Add(mt.ThemeName);
                        if (currentParams.BaseColor == mt.BaseColor && currentParams.CanvasColor == mt.CanvasColor)
                        {
                            lb.SelectedItem = mt.ThemeName;
                            selectedTheme = mt.ThemeName;
                        }
                    }

                    edSvc.DropDownControl(lb);
                    if (lb.SelectedItem != null && selectedTheme != (string)lb.SelectedItem)
                    {
                        return metroThemes[lb.SelectedIndex];
                    }
                }
            }

            return value;
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:35,代码来源:MetroColorThemeEditor.cs


示例9: GuidEditorListBox

		public GuidEditorListBox(IWindowsFormsEditorService editorService)
		{
			this.editorService = editorService;
			Items.Add("New Guid");
			Size = new Size(Width, ItemHeight);
			BorderStyle = BorderStyle.None;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:GuidEditorListBox.cs


示例10: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // Default behavior
            if ((context == null) ||
                (provider == null) || (context.Instance == null)) {
                return base.EditValue(context, provider, value);
            }

            ModelElement modelElement = (context.Instance as ModelElement);
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null) {
                FrmFeatureModelDiagramSelector form = new FrmFeatureModelDiagramSelector(modelElement.Store);
                if (edSvc.ShowDialog(form) == DialogResult.OK) {
                    using (Transaction transaction = modelElement.Store.TransactionManager.BeginTransaction("UpdatingFeatureModelFileValue")) {

                        if (modelElement is FeatureShape) {
                            FeatureShape featureShape = modelElement as FeatureShape;
                            (featureShape.ModelElement as Feature).DefinitionFeatureModelFile = form.SelectedFeatureModelFile;
                        } else if (modelElement is FeatureModelDSLDiagram) {
                            FeatureModelDSLDiagram featureModelDslDiagram = modelElement as FeatureModelDSLDiagram;
                            (featureModelDslDiagram.ModelElement as FeatureModel).ParentFeatureModelFile = form.SelectedFeatureModelFile;
                        }

                        transaction.Commit();
                    }
                }
            }

            // Default behavior
            return base.EditValue(context, provider, value);
        }
开发者ID:ngm,项目名称:feature-model-dsl,代码行数:31,代码来源:FeatureModelDiagramTypeEditor.cs


示例11: EditValue

        /// <summary>
        /// This takes care of the actual value-change of the property.
        /// </summary>
        /// <param name="itdc">Standard ITypeDescriptorContext object.</param>
        /// <param name="isp">Standard IServiceProvider object.</param>
        /// <param name="value">The value as an object.</param>
        /// <returns>The new value as an object.</returns>
        public override object EditValue(ITypeDescriptorContext itdc, IServiceProvider isp, object value)
        {
            if(itdc != null && itdc.Instance != null && isp != null)
            {
                iwfes = (IWindowsFormsEditorService)isp.GetService(typeof(IWindowsFormsEditorService));

                if(iwfes != null)
                {
                    MWCommon.TextDir td = MWCommon.TextDir.Normal;

                    if(value is MWCommon.TextDir)
                    {
                        td = (MWCommon.TextDir)itdc.PropertyDescriptor.GetValue(itdc.Instance);
                        pd = itdc.PropertyDescriptor;
                        oInstance = itdc.Instance;
                    }

                    EditorTextDirUI etdui = new EditorTextDirUI();
                    etdui.IWFES = iwfes;
                    etdui.ITDC = itdc;
                    etdui.TextDir = (MWCommon.TextDir)value;
                    etdui.TextDirChanged += new EditorTextDirUI.TextDirEventHandler(this.ValueChanged);

                    iwfes.DropDownControl(etdui);
                    value = etdui.TextDir;
                }
            }

            return value;
        }
开发者ID:mzkabbani,项目名称:XMLParser,代码行数:37,代码来源:EditorTextDir.cs


示例12: EditValue

        public override object EditValue(ITypeDescriptorContext ctx, IServiceProvider provider, object value)
        {
            // initialize editor service
            _edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (_edSvc == null)
                return value;

            // size the grid
            _flex.ClientSize = new Size(
                Math.Min(800, _flex.Cols[_flex.Cols.Count - 1].Right),
                Math.Min(250, _flex.Rows[_flex.Rows.Count - 1].Bottom));

            // initialize selection
            int col = _flex.Cols[_keyColumn].Index;
            _flex.Col = col;
            _flex.Row = (value is string)
                ? _flex.FindRow((string)value, _flex.Cols.Fixed, col, false, true, true)
                : -1;

            // show the grid
            _flex.Visible = true;
            _cancel = false;
            _edSvc.DropDownControl(_flex);

            if (_ValueSelected)
            {
                // get return value from selected item on the grid
                if (!_cancel && _flex.Row > -1)
                    value = _flex[_flex.Row, _keyColumn];
            }

            // done
            return value;
        }
开发者ID:rahulbishnoi,项目名称:LabM,代码行数:34,代码来源:MultiColumnEditor.cs


示例13: EditValue

        /// <summary>
        ///   Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method.
        /// </summary>
        /// 
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// 
        /// <returns>
        ///   The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
        /// </returns>
        /// 
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                this.editorService = (IWindowsFormsEditorService)provider
                    .GetService(typeof(IWindowsFormsEditorService));

                this.CollectionType = context.PropertyDescriptor.ComponentType;
                this.CollectionItemType = detectCollectionType();

                if (editorService != null)
                {
                    NumericCollectionEditorForm form = new NumericCollectionEditorForm(this, value);

                    context.OnComponentChanging();

                    if (editorService.ShowDialog(form) == DialogResult.OK)
                    {
                        context.OnComponentChanged();
                    }
                }
            }

            return value;
        }
开发者ID:CanerPatir,项目名称:framework,代码行数:37,代码来源:NumericCollectionEditor.cs


示例14: EditValue

        /// <summary>
        /// ʹ��GetEditStyle������ָʾ�ı༭����ʽ�༭ָ�������ֵ
        /// </summary>
        /// <param name="context">�����ڻ�ȡ������������Ϣ�� ITypeDescriptorContext</param>
        /// <param name="provider">IServiceProvider��ͨ�������ܻ�ñ༭����</param>
        /// <param name="value">���ڱ༭��ֵ��ʵ��</param>
        /// <returns>�µĶ���ֵ������ö����ֵ��δ���ģ�����Ӧ�����봫�ݸ����Ķ�����ͬ�Ķ���</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)       //�༭����Ķ���Ϊ��
            {
                editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }

            if (editorService != null)      //�༭�������Ͳ�Ϊ��
            {
                if (this.listBox == null)
                {
                    this.listBox = new ListBox();
                    this.listBox.Dock = DockStyle.Fill;
                    this.listBox.MouseClick += new MouseEventHandler(listBox_MouseClick);
                }
                this.listBox.Items.Clear();
                foreach (string str in CassViewGenerator.chooseString.Split(','))
                {
                    this.listBox.Items.Add(str);
                }
                this.listBox.SelectedItem = value;
                editorService.DropDownControl(this.listBox);
            }
            if (this.listBox.SelectedItem != null)
            {
                return this.listBox.SelectedItem.ToString();
            }
            else
            {
                return null;
            }
        }
开发者ID:alloevil,项目名称:A-embedded-image-processing-platform--,代码行数:39,代码来源:EditControl.cs


示例15: FontPropertyEditor

        public FontPropertyEditor(FontItem  font,
            IWindowsFormsEditorService editorServiceParam )
        {
            editorService = editorServiceParam;
            InitializeComponent();

            this.View = System.Windows.Forms.View.Tile;

            //Default Font
            ListViewItem itemDefault = new ListViewItem();
            itemDefault.Tag = new FontItem("DEFAULT",font.projectParent);
            itemDefault.Text = "Default Font";
            this.Items.Add(itemDefault);

            // Add three font files to the private collection.
            for (int i = 0; i < font.projectParent.AvailableFont.Count; i++)
            {
                ListViewItem item = new ListViewItem();
                item.Tag = font.projectParent.AvailableFont[i];
                item.Font = new Font(font.projectParent.AvailableFont[i].NameForIphone, 14);
                item.Text = font.projectParent.AvailableFont[i].NameForIphone;
                this.Items.Add(item);

            }

            //this.Invalidate();
        }
开发者ID:nadar71,项目名称:Krea,代码行数:27,代码来源:FontPropertyEditor.cs


示例16: EditValue

        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (service != null)
                {
                    ListBox list = new ListBox();
                    list.Click += new EventHandler(list_Click);
                    foreach (Cause c in causeList)
                    {
                        list.Items.Add(c);
                    }

                    service.DropDownControl(list);

                    if (list.SelectedItem != null && list.SelectedIndices.Count == 1)
                    {
                        value = list.SelectedItem;
                    }
                }
            }
            return value;
        }
开发者ID:LightningDevStudios,项目名称:CircuitCrawlerEditor,代码行数:25,代码来源:UITypeEditors.cs


示例17: EditValue

 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     if (edSvc != null && value != null)
     {
         double tmp = 0;
         double.TryParse(value.ToString(), out tmp);
         tmp = tmp * 10;
         using (var dlg = new SlideDialog())
         {
             dlg.FormScale = Convert.ToDouble("0.1");
             dlg.MinValue = 0;
             dlg.MaxValue = 10;
             dlg.CurrentValue = (int)tmp;
             dlg.Text = MultilingualUtility.GetString("Alpha");
             if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 Property.Value = (dlg.CurrentValue * dlg.FormScale).ToString();
                 return Property.Value;
             }
             return value.ToString();
         }
     }
     return Property.DefaultValue;
 }
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:25,代码来源:AlphaEditor.cs


示例18: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            }
            if (editorService != null)
            {
                if (value == null)
                {
                    time = DateTime.Now.ToString("HH:mm");
                }

                DateTimePicker picker = new DateTimePicker();
                picker.Format = DateTimePickerFormat.Custom;
                picker.CustomFormat = "HH:mm";
                picker.ShowUpDown = true;

                if (value != null)
                {
                    picker.Value = DateTime.Parse((string)value);
                }

                editorService.DropDownControl(picker);
                value = picker.Value.ToString("HH:mm");
            }
            return value;
        }
开发者ID:rexxar-tc,项目名称:EssentialsPlugin,代码行数:28,代码来源:UIEditors.cs


示例19: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null
                && context.Instance != null
                && provider != null)
            {
                m_EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                if (m_EditorService != null)
                {
                    TextMarkupEditor editor = new TextMarkupEditor();
                    editor.buttonOK.Click += new EventHandler(MarkupEditorButtonClick);
                    editor.buttonCancel.Click += new EventHandler(MarkupEditorButtonClick);
                    
                    if(value!=null)
                        editor.inputText.Text = value.ToString();

                    m_EditorService.DropDownControl(editor);

                    if (editor.DialogResult == DialogResult.OK)
                    {
                        string text = editor.inputText.Text;
                        editor.Dispose();
                        return text;
                    }
                    editor.Dispose();
                }
            }

            return value;
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:31,代码来源:TextMarkupUIEditor.cs


示例20: EditValue

        /// <summary>
        /// Called when we want to edit the value of a property.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                UI.Actions.MessageAction messageAction = context.Instance as UI.Actions.MessageAction;
                if (messageAction != null)
                {
                    ListBox listBox = new ListBox();
                    foreach (UI.Message message in messageAction.Scene.Messages)
                    {
                        listBox.Items.Add(message);
                    }

                    listBox.SelectedItem = messageAction.Scene.GetMessage((int)value);
                    listBox.SelectedIndexChanged += ((s, e) => { edSvc.CloseDropDown(); });

                    edSvc.DropDownControl(listBox);

                    return listBox.SelectedItem != null ? (listBox.SelectedItem as UI.Message).ID : -1;
                }
            }

            return value;
        }
开发者ID:RasterCode,项目名称:OtterUI,代码行数:32,代码来源:UIMessageEditor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IWindsorContainer类代码示例发布时间:2022-05-24
下一篇:
C# IWindowManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap