Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        private void BtnGrabExtentsClick(object sender, EventArgs e)
        {
            if (_layer != null)
            {
                DynamicVisibilityWidth        = _layer.MapFrame.ViewExtents.Width;
                _layer.DynamicVisibilityWidth = DynamicVisibilityWidth;
                _layer.UseDynamicVisibility   = true;
            }
            else
            {
                DynamicVisibilityWidth = GrabExtents.Width;
            }

            _dialogProvider?.CloseDropDown();
            Hide();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Called when we want to edit the value of a property.  Displays a listbox with the available fonts.
        /// </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)
            {
                ListBox listBox = new ListBox();
                foreach (GUIFont font in GUIProject.CurrentProject.Fonts)
                {
                    listBox.Items.Add(font);
                }

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

                edSvc.DropDownControl(listBox);

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

            return value;
        }
Exemplo n.º 5
0
 private void listBox_Click(object sender, EventArgs e)
 {
     editorSvc?.CloseDropDown();
 }
Exemplo n.º 6
0
 private void listViewEnum_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     m_editorService.CloseDropDown( );
 }
Exemplo n.º 7
0
 /// <summary>
 /// Fires the SymbolSelected event args, and closes a drop down editor if it exists.
 /// </summary>
 protected virtual void OnSymbolSelected()
 {
     _editorService?.CloseDropDown();
     SymbolSelected?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 8
0
        [RefreshProperties(RefreshProperties.All)] public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return(base.EditValue(provider, value));
            }

            oEditorService = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (oEditorService != null)
            {
                // Get the Back reference to the Custom Property
                CustomProperty.CustomPropertyDescriptor oDescriptor = (CustomProperty.CustomPropertyDescriptor)context.PropertyDescriptor;
                CustomProperty cp = (CustomProperty)oDescriptor.CustomProperty;

                // Declare attributes
                UIListboxDatasource    datasource;
                UIListboxValueMember   valuemember;
                UIListboxDisplayMember displaymember;

                // Get attributes
                datasource    = (UIListboxDatasource)context.PropertyDescriptor.Attributes[typeof(UIListboxDatasource)];
                valuemember   = (UIListboxValueMember)context.PropertyDescriptor.Attributes[typeof(UIListboxValueMember)];
                displaymember = (UIListboxDisplayMember)context.PropertyDescriptor.Attributes[typeof(UIListboxDisplayMember)];

                oList.BorderStyle    = BorderStyle.None;
                oList.IntegralHeight = true;

                if (datasource != null)
                {
                    oList.DataSource = datasource.Value;
                }

                if (displaymember != null)
                {
                    oList.DisplayMember = displaymember.Value;
                }

                if (valuemember != null)
                {
                    oList.ValueMember = valuemember.Value;
                }

                if (value != null)
                {
                    if (value.GetType().Name == "String")
                    {
                        oList.Text = (string)value;
                    }
                    else
                    {
                        oList.SelectedItem = value;
                    }
                }


                oList.SelectedIndexChanged += new System.EventHandler(this.SelectedItem);

                oEditorService.DropDownControl(oList);
                if (oList.SelectedIndices.Count == 1)
                {
                    cp.SelectedItem  = oList.SelectedItem;
                    cp.SelectedValue = oSelectedValue;
                    value            = oList.Text;
                }
                oEditorService.CloseDropDown();
            }
            else
            {
                return(base.EditValue(provider, value));
            }

            return(value);
        }
 private void OnListBoxChanged(object sender, EventArgs e)
 {
     edSvc.CloseDropDown();
 }
Exemplo n.º 10
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     SelectedStrings = null;
     _service.CloseDropDown();
 }
Exemplo n.º 11
0
 private void OnListBoxSelectedValueChanged(object sender, EventArgs e)
 {
     _COMPortSettingsEditorService.CloseDropDown();
 }
Exemplo n.º 12
0
 private void CloseControl(object sender, EventArgs e)
 {
     edSvc.CloseDropDown();
 }
Exemplo n.º 13
0
 private void lb_StyleSelected(object sender, EventArgs e)
 {
     edSvc.CloseDropDown();
 }
Exemplo n.º 14
0
 void _calendar_DateChanged(object sender, DateRangeEventArgs e)
 {
     _svc.CloseDropDown();
 }
Exemplo n.º 15
0
 private void OnListBoxClick(object sender, EventArgs args)
 {
     service.CloseDropDown();
 }
 private void OnDblClick(Object sender, EventArgs e)
 {
     es.CloseDropDown();
 }
Exemplo n.º 17
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            //look for a TrackBarEditorData Attribute.
            TrackBarEditorData usedata = null;
            foreach (Attribute iterate in context.PropertyDescriptor.Attributes)
            {
                if (iterate.GetType() == typeof(TrackBarEditorData))
                {
                    usedata = (TrackBarEditorData)iterate;
                    break;
                }

            }
            if (usedata == null) usedata = new TrackBarEditorData(0, 200);
            var returntype = value.GetType(); //type to return.
            Debug.Print(("Type of context.instance-" + context.Instance.GetType().Name));
            if (provider != null)
            {

                mserv = ((IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)));

                if (mserv != null)
                {
                    // This is an internal Microsoft class representing the PropertyGrid entry for our component.
                    PictureBox DropDownBox = new PictureBox();
                    DropDownBox.BorderStyle = BorderStyle.None;
                    DropDownBox.Resize += new EventHandler(DropDownBox_Resize);
                    TrackBar tb = new TrackBar();
                    //set the minimum to min, and maximum to maximum value.
                    tb.Minimum = minvalueset;
                    tb.Maximum=maxvalueset;
                    //scale the value as needed.
                    double currentvalue = (double)(Convert.ChangeType(value, TypeCode.Double)??0);
                    tb.LargeChange = 4096;
                    tb.SmallChange = 256;
                    tb.TickFrequency = 256;
                    tb.TickStyle = TickStyle.BottomRight;

                    //scale it to between Int.MinValue and int.MaxValue.

                    double Percentage = currentvalue/(usedata.Maximum - usedata.Minimum);
                    if (double.IsInfinity(Percentage)) Percentage = 0;
                    int scaled = (int)((((double)maxvalueset - (double)minvalueset) * Percentage) + (double)minvalueset);

                    tb.Value = scaled;

                    // Drop the trackbar

                    mserv.DropDownControl(tb);

                    scaled = tb.Value;
                    //now we need to work backwards.
                    Percentage = ((double)scaled) / ((double)maxvalueset - (double)minvalueset);
                    double usethisvalue = Percentage * (usedata.Maximum - usedata.Minimum) + usedata.Minimum;

                    value = Convert.ChangeType(usethisvalue, returntype);

                    // Close the list control after selection.
                    mserv.CloseDropDown();
                }
            }
            return value;
        }
Exemplo n.º 18
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     edSvc.CloseDropDown();
 }
Exemplo n.º 19
0
 private void lb_Click(object sender, EventArgs e)
 {
     edSvc.CloseDropDown();
 }
Exemplo n.º 20
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     service.CloseDropDown();
 }
Exemplo n.º 21
0
 private void LbSelectedValueChanged(object sender, EventArgs e)
 {
     _dialogProvider.CloseDropDown();
 }
Exemplo n.º 22
0
 private void ListBox1SelectedIndexChanged(object sender, EventArgs e)
 {
     frmsvr.CloseDropDown();
 }
 private void OnListBoxSelectedValueChanged(object sender, EventArgs e)
 {
     // close the drop down as soon as something is clicked
     _editorService.CloseDropDown();
 }
 private void OnDblClick(Object sender, EventArgs e)
 {
     Leave(sender, e);
     es?.CloseDropDown();
 }
Exemplo n.º 25
0
 private void AcAngleChosen(object sender, EventArgs e)
 {
     _dialogProvider.CloseDropDown();
 }
Exemplo n.º 26
0
 void EnumTypeListBox_Click(object sender, EventArgs e)
 {
     Value = base.SelectedItems[0].Tag;
     edSvc.CloseDropDown();
 }
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     value = base.SelectedItem;
     service.CloseDropDown();
 }
Exemplo n.º 28
0
 void OnSelectedIndexChanged(object sender, EventArgs e)
 {
     editorService.CloseDropDown();
 }
Exemplo n.º 29
0
 private void Exit(object sender, EventArgs e)
 {
     _service?.CloseDropDown();
 }
Exemplo n.º 30
0
 private void LstPropertiesDoubleClick(object sender, EventArgs e)
 {
     _editorService.CloseDropDown();
 }
Exemplo n.º 31
0
		[RefreshProperties(RefreshProperties.All)]public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
		{
			if (context == null || provider == null || context.Instance == null)
			{
				return base.EditValue(provider, value);
			}
			
			oEditorService =  (System.Windows.Forms.Design.IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
			if (oEditorService != null)
			{
				
				// Get the Back reference to the Custom Property
				CustomProperty.CustomPropertyDescriptor oDescriptor =  (CustomProperty.CustomPropertyDescriptor) context.PropertyDescriptor;
				CustomProperty cp =  (CustomProperty) oDescriptor.CustomProperty;
				
				// Declare attributes
				UIListboxDatasource datasource;
				UIListboxValueMember valuemember;
				UIListboxDisplayMember displaymember;
				
				// Get attributes
				datasource =  (UIListboxDatasource) context.PropertyDescriptor.Attributes[typeof(UIListboxDatasource)];
				valuemember =  (UIListboxValueMember) context.PropertyDescriptor.Attributes[typeof(UIListboxValueMember)];
				displaymember =  (UIListboxDisplayMember) context.PropertyDescriptor.Attributes[typeof(UIListboxDisplayMember)];
				
				oList.BorderStyle = BorderStyle.None;
				oList.IntegralHeight = true;
				
				if (datasource != null)
				{
					oList.DataSource = datasource.Value;
				}
				
				if (displaymember != null)
				{
					oList.DisplayMember = displaymember.Value;
				}
				
				if (valuemember != null)
				{
					oList.ValueMember = valuemember.Value;
				}
				
				if (value != null)
				{
					if (value.GetType().Name == "String")
					{
						oList.Text =  (string) value;
					}
					else
					{
						oList.SelectedItem = value;
					}
				}
				
				
				oList.SelectedIndexChanged += new System.EventHandler(this.SelectedItem);
				
				oEditorService.DropDownControl(oList);
				if (oList.SelectedIndices.Count == 1)
				{
					cp.SelectedItem = oList.SelectedItem;
					cp.SelectedValue = oSelectedValue;
					value = oList.Text;
				}
				oEditorService.CloseDropDown();
			}
			else
			{
				return base.EditValue(provider, value);
			}
			
			return value;
			
		}
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Globals.IsDialogWindowOpen = false;

            Service.CloseDropDown();
        }
Exemplo n.º 33
0
            /// <summary>
            /// Initializes a new instance of the <see cref="AngleControl"/> class.
            /// </summary>
            /// <param name="initialAngle">The initial angle.</param>
            public PercentControl(float initialAngle, IWindowsFormsEditorService edService)
            {
                this.Value = initialAngle;

                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

                TrackBar trackBar = new TrackBar
                {
                    Dock = DockStyle.Right,
                    LargeChange = 25,
                    Maximum = 100,
                    Minimum = 0,
                    Orientation = Orientation.Vertical,
                    SmallChange = 5,
                    TickFrequency = 10,
                    TickStyle = TickStyle.Both,
                    Value = (int)(initialAngle * 100f)
                };

                base.Controls.Add(trackBar);

                trackBar.ValueChanged += (s, ea) => this.Value = trackBar.Value / 100f;
                
                trackBar.MouseUp += (s, ea) => edService.CloseDropDown();
            }
 private void ListBoxOnSelectedValueChanged(object sender, EventArgs eventArgs)
 {
     _editorService.CloseDropDown();
 }
Exemplo n.º 35
0
 private void ListBox_SelectedValueChanged(object sender, EventArgs e)
 {
     _editorService?.CloseDropDown();
     _editorService = null;
 }
Exemplo n.º 36
0
 protected override void OnClick(EventArgs e)
 {
     base.OnClick(e);
     value = SelectedItem;
     edSvc.CloseDropDown();
 }