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


C# IWindowsFormsEditorService.DropDownControl方法代码示例

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


在下文中一共展示了IWindowsFormsEditorService.DropDownControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 (value == null)
            {
                value = Hues.GetHue(0);
            }

            if (value.GetType() == typeof(Hue))
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (editorService == null)
                {
                    return value;
                }

                HuePickerControl control = new HuePickerControl((Hue)value);
                control.ValueChanged += new HuePickerControl.ValueChangedEventHandler(this.ValueSelected);
                editorService.DropDownControl(control);

                if (returnValue != null)
                {
                    control.Dispose();
                    return returnValue;
                }

                control.Dispose();
            }

            return value;
        }
开发者ID:jeffboulanger,项目名称:runuogdk,代码行数:31,代码来源:HueEditor.cs

示例5: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            try
            {
                Box1.Items.Clear();
                if(ItemList != null)
                {
                    Box1.Items.AddRange(ItemList);
                }else
                {
                    Box1.Items.Clear();
                }
                Box1.Height = Box1.PreferredHeight;
                srvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if(srvc != null)
                {
                    srvc.DropDownControl(Box1);
                    ItemList = null;
                    return Box1.SelectedItem.ToString();
                }
            }
            catch
            {
            }

            return value;
        }
开发者ID:visla,项目名称:PDFReporter,代码行数:27,代码来源:ComboBoxPropertyEditor.cs

示例6: 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

示例7: 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

示例8: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null
                && context.Instance != null
                && provider != null)
            {
                ElementStyle es = value as ElementStyle;

                _EditorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

                if (_EditorService != null)
                {
                    ListBox lb = new ListBox();
                    List<DevComponents.Schedule.TimeZoneInfo> timeZonesList = DevComponents.Schedule.TimeZoneInfo.GetSystemTimeZones();
                    int selectedIndex = -1;
                    for (int i = 0; i < timeZonesList.Count; i++)
                    {
                        DevComponents.Schedule.TimeZoneInfo timeZoneInfo = timeZonesList[i];
                        lb.Items.Add(timeZoneInfo.Id);
                        if (timeZoneInfo.Id.Equals((string)value))
                            selectedIndex = i;
                    }
                    lb.SelectedIndex = selectedIndex;
                    lb.SelectedIndexChanged += new EventHandler(this.SelectedChanged);
                    _EditorService.DropDownControl(lb);
                    return lb.SelectedItem;
                }
            }

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

示例9: EditValue

        /// <summary>
        /// Edits a value based on some user input which is collected from a character control.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _dialogProvider = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            List<int> layerList = new List<int>();
            LayoutLegend legend = context.Instance as LayoutLegend;
            LayoutMap map = null;
            if (legend != null)
                map = legend.Map;
            if (map == null)
                return layerList;

            CheckedListBox lb = new CheckedListBox();
            
            List<int> originalList = value as List<int>;
            if (originalList != null)
            {
                for (int i = map.MapControl.Layers.Count - 1; i >= 0 ; i--)
                    lb.Items.Add(map.MapControl.Layers[i].LegendText, originalList.Contains(i));
            }
            
            _dialogProvider.DropDownControl(lb);

            for (int i = 0; i < lb.Items.Count; i ++)
            {
                if (lb.GetItemChecked(i))
                    layerList.Add(lb.Items.Count - 1 -i);
            }

            return layerList;
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:37,代码来源:LayoutLayerEditor.cs

示例10: 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

示例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)
                {
                    HatchStyle hs = HatchStyle.Weave;

                    //if(itdc.PropertyDescriptor.GetValue(itdc.Instance) is HatchStyle)
                    if(value is HatchStyle)
                    {
                        hs = (HatchStyle)itdc.PropertyDescriptor.GetValue(itdc.Instance);
                        pd = itdc.PropertyDescriptor;
                        oInstance = itdc.Instance;
                    }

                    //EditorHatchStyleUI ehsui = new EditorHatchStyleUI(hs, Color.White, Color.Black); //FIX THIS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                    EditorHatchStyleUI ehsui = new EditorHatchStyleUI(HatchStyle.Trellis, Color.White, Color.Black);
                    ehsui.IWFES = iwfes;
                    ehsui.ITDC = itdc;
                    ehsui.HatchStyle = (HatchStyle)value;
                    ehsui.HatchStyleChanged += new EditorHatchStyleUI.MWHatchStyleEventHandler(ValueChanged);

                    iwfes.DropDownControl(ehsui);
                    value = ehsui.HatchStyle;
                }
            }

            return value;
        }
开发者ID:Kristd,项目名称:backup,代码行数:39,代码来源:EditorHatchStyle.cs

示例12: EditValue

        /// <summary>
        /// Called when we want to edit the value of the property.  Brings up the a drop down list box of masks.
        /// </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)
            {
                GUIControl controlContext = context.Instance as GUIControl;

                ListBox listBox = new ListBox();
                listBox.Items.Add("None");
                AddControls(listBox, controlContext.ParentView.Controls);

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

                edSvc.DropDownControl(listBox);

                //no valid item selected; return previous value
                if (listBox.SelectedIndex == -1 || listBox.SelectedItem == null)
                    return value;

                //"None" selected
                if (listBox.SelectedIndex == 0)
                    return -1;

                return (listBox.SelectedItem as GUIMask).ID;
            }

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

示例13: 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

示例14: EditValue

		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) 
		{

			if (context!=null && context.Instance!=null && provider!=null) 
			{
				m_EdSvc=(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
				if(m_EdSvc!=null) 
				{
					ShortcutsListBox lst=null;
					if(context.Instance is BaseItem)
						lst=new ShortcutsListBox(((BaseItem)context.Instance).Shortcuts);
                    else if (context.Instance is ButtonX)
                        lst = new ShortcutsListBox(((ButtonX)context.Instance).Shortcuts);
					else if(context.Instance is DotNetBarManager)
						lst=new ShortcutsListBox(((DotNetBarManager)context.Instance).AutoDispatchShortcuts);
					else if(context.Instance!=null)
						System.Windows.Forms.MessageBox.Show("Unknow control using shortcuts. Cannot edit shortcuts. ["+context.Instance.ToString()+"]");
					else
						System.Windows.Forms.MessageBox.Show("Unknow control using shortcuts. Cannot edit shortcuts. [context instance null]");
					if(lst!=null)
					{
						m_EdSvc.DropDownControl(lst);
						value=lst.Shortcuts();
						((ShortcutsCollection)value).Parent=context.Instance as BaseItem;
					}
				}
			}

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

示例15: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            wfes = (IWindowsFormsEditorService) provider.GetService(typeof (IWindowsFormsEditorService));
            if ((wfes == null) || (context == null))
                return null;

            ImageList imageList = GetImageList(context.Instance);
            if ((imageList == null) || (imageList.Images.Count == 0))
                return -1;

            m_imagePanel = new ImageListPanel();

            m_imagePanel.BackgroundColor = Color.FromArgb(241, 241, 241);
            m_imagePanel.BackgroundOverColor = Color.FromArgb(102, 154, 204);
            m_imagePanel.HLinesColor = Color.FromArgb(182, 189, 210);
            m_imagePanel.VLinesColor = Color.FromArgb(182, 189, 210);
            m_imagePanel.BorderColor = Color.FromArgb(0, 0, 0);
            m_imagePanel.EnableDragDrop = true;
            m_imagePanel.Init(imageList, 12, 12, 6, (int) value);

            // add listner for event
            m_imagePanel.ItemClick += OnItemClicked;

            // set m_selectedIndex to -1 in case the dropdown is closed without selection
            m_selectedIndex = -1;
            // show the popup as a drop-down
            wfes.DropDownControl(m_imagePanel);

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


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