示例#1
0
        protected override void OnDropDownOpened(EventArgs e)
        {
            base.OnDropDownOpened(e);

            DropDownForm.UpdatePerferedSize(Size);

            var    expression   = Expression;
            object selectedItem = null;

            foreach (var item in _listBox.Items)
            {
                var valueItem = item as ScriptValueList.ValueItem;
                if (valueItem == null)
                {
                    continue;
                }
                var itemExpression =
                    ScriptValueHelper.TextToObject(valueItem.Text, typeof(ScriptStringValue), valueItem.IsExpression).ToString();
                if (expression == itemExpression)
                {
                    selectedItem = item;
                    break;
                }
            }
            _listBox.SelectedItem = selectedItem;
        }
示例#2
0
        private void UpdateDropDown()
        {
            DropDownForm.Items.Clear();
            foreach (object v in _enumValues)
            {
                DropDownForm.Items.Add(new DropDownListBox.Item(v.ToString(), v));
            }

            DropDownForm.UpdatePerferedSize(Size);
        }
示例#3
0
        /// <summary>
        /// Constructor</summary>
        public PropertyEditingControl()
        {
            m_editButton = new EditButton();
            m_textBox = new TextBox();

            // force creation of the window handles on the GUI thread
            // see http://forums.msdn.microsoft.com/en-US/clr/thread/fa033425-0149-4b9a-9c8b-bcd2196d5471/
            #pragma warning disable 219
            IntPtr handle;
            #pragma warning restore 219
            handle = m_editButton.Handle;
            handle = m_textBox.Handle;

            base.SuspendLayout();

            m_editButton.Left = base.Right - 18;
            m_editButton.Size = new Size(18, 18);
            m_editButton.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            m_editButton.Visible = false;

            m_editButton.Click += editButton_Click;
            m_editButton.MouseDown += editButton_MouseDown;

            m_textBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
            m_textBox.BorderStyle = BorderStyle.None;

            m_textBox.LostFocus += textBox_LostFocus;

            // forward textbox events as if they originated with this control
            m_textBox.DragOver += textBox_DragOver;
            m_textBox.DragDrop += textBox_DragDrop;
            m_textBox.MouseHover += textBox_MouseHover;
            m_textBox.MouseLeave += textBox_MouseLeave;

            m_textBox.Visible = false;

            Controls.Add(m_editButton);
            Controls.Add(m_textBox);

            base.ResumeLayout();
            m_textBox.SizeChanged += (sender, e) => Height = m_textBox.Height + 1;
            m_dropDownForm = new DropDownForm(this);
        }
示例#4
0
        /// <summary>
        /// Constructor</summary>
        public PropertyEditingControl()
        {
            m_editButton = new EditButton();
            m_textBox    = new TextBox();

            // force creation of the window handles on the GUI thread
            // see http://forums.msdn.microsoft.com/en-US/clr/thread/fa033425-0149-4b9a-9c8b-bcd2196d5471/
            #pragma warning disable 219
            IntPtr handle;
            #pragma warning restore 219
            handle = m_editButton.Handle;
            handle = m_textBox.Handle;

            base.SuspendLayout();

            m_editButton.Left    = base.Right - 18;
            m_editButton.Size    = new Size(18, 18);
            m_editButton.Anchor  = AnchorStyles.Right | AnchorStyles.Top;
            m_editButton.Visible = false;

            m_editButton.Click     += editButton_Click;
            m_editButton.MouseDown += editButton_MouseDown;

            m_textBox.Anchor      = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
            m_textBox.BorderStyle = BorderStyle.None;

            m_textBox.LostFocus += textBox_LostFocus;

            // forward textbox events as if they originated with this control
            m_textBox.DragOver   += textBox_DragOver;
            m_textBox.DragDrop   += textBox_DragDrop;
            m_textBox.MouseHover += textBox_MouseHover;
            m_textBox.MouseLeave += textBox_MouseLeave;

            m_textBox.Visible = false;

            Controls.Add(m_editButton);
            Controls.Add(m_textBox);

            base.ResumeLayout();
            m_textBox.SizeChanged += (sender, e) => Height = m_textBox.Height + 1;
            m_dropDownForm         = new DropDownForm(this);
        }
示例#5
0
            public void DropDownControl(Control control)
            {
                _Canceled       = false;
                _DropDownHolder = new DropDownForm {
                    Bounds = control.Bounds
                };
                _DropDownHolder.SetControl(control);
                Control parentForm = GetParentForm(_Picker);

                if (parentForm != null && (parentForm is Form))
                {
                    _DropDownHolder.Owner = (Form)parentForm;
                }
                PositionDropDownHolder();
                _DropDownHolder.Show();
                DoModalLoop();
                _Canceled = _DropDownHolder.Canceled;
                _DropDownHolder.Dispose();
                _DropDownHolder = null;
            }
示例#6
0
        /// <summary>
        /// Drops down editor control</summary>
        /// <param name="control">The control to drop down</param>
        public void DropDownControl(Control control)
        {
            if (m_dropDownForm == null)
            {
                m_dropDownForm = new DropDownForm(this);
            }
            m_dropDownForm.SetControl(control);

            if (m_editData != null)
            {
                Point location = new Point(m_editData.Bounds.Left, m_editData.Bounds.Bottom);
                location = PointToScreen(location);
                int       width  = Math.Max(control.Width, m_editData.Bounds.Width);
                int       height = control.Height;
                Rectangle bounds;
                bounds = new Rectangle(location.X, location.Y, width, height);

                m_dropDownForm.Bounds = bounds;
            }
            else
            {
                Point rightBottom = new Point(base.Right, base.Bottom);
                rightBottom = base.Parent.PointToScreen(rightBottom);
                Rectangle bounds = new Rectangle(
                    rightBottom.X - control.Width, rightBottom.Y, control.Width, control.Height);

                m_dropDownForm.Bounds = bounds;
            }

            Applications.SkinService.ApplyActiveSkin(control);
            m_dropDownForm.Visible = true;

            control.Focus();

            while (m_dropDownForm.Visible)
            {
                Application.DoEvents();
                MsgWaitForMultipleObjects(0, 0, true, 250, 255);
            }
        }
示例#7
0
            public void DropDownControl(Control control)
            {
                if (_dropDownHolder == null)
                {
                    _dropDownHolder = new DropDownForm();
                }

                _canceled = false;

                // Initialize the hosting form for the control.
                _dropDownHolder.Bounds = control.Bounds;
                _dropDownHolder.SetControl(control);

                // Lookup a parent form for the Picker control and make the dropdown form to be owned
                // by it. This prevents to show the dropdown form icon when the user presses the At+Tab system
                // key while the dropdown form is displayed.
                Control pickerForm = GetParentForm(_picker);

                if ((pickerForm != null) && (pickerForm is Form))
                {
                    _dropDownHolder.Owner = (Form)pickerForm;
                }

                // Ensure the whole drop-down UI is displayed on the screen and show it.
                PositionDropDownHolder();

                // Show the window but don't activate it
                _dropDownHolder.Show(); // ShowDialog would disable clicking outside the dropdown area!

                // Wait for the user to select a new color (in which case the ColorUI calls our CloseDropDown
                // method) or cancel the selection (no CloseDropDown called, the Cancel flag is set to True).
                DoModalLoop();

                // Remember the cancel flag
                _canceled = _dropDownHolder.Canceled;
//                _dropDownHolder.Dispose();
//              _dropDownHolder = null;
            }
示例#8
0
 public DropDownContainer(Control dropDownItem)
 {
     DropDownForm        = new DropDownForm(dropDownItem);
     DropDownForm.Height = 0;
 }
示例#9
0
 public void DropDownControl(Control control)
 {
     _Canceled = false;
     _DropDownHolder = new DropDownForm {Bounds = control.Bounds};
     _DropDownHolder.SetControl(control);
     Control parentForm = GetParentForm(_Picker);
     if (parentForm != null && (parentForm is Form))
     {
         _DropDownHolder.Owner = (Form) parentForm;
     }
     PositionDropDownHolder();
     _DropDownHolder.Show();
     DoModalLoop();
     _Canceled = _DropDownHolder.Canceled;
     _DropDownHolder.Dispose();
     _DropDownHolder = null;
 }
            public void DropDownControl(Control control)
            {
                if (_dropDownHolder == null)
                    _dropDownHolder = new DropDownForm(_inPlaceCtrl, _inPlaceCtrl.Resizable);

                _canceled = false;

                _dropDownHolder.SetControl(control);

                // Initialize the hosting form for the control.
#if _DOTNET2
                Rectangle rect = new Rectangle(0, 0, control.PreferredSize.Width, control.Bounds.Height);
#else
                Rectangle rect = control.Bounds;
#endif
                rect.Inflate(1,1);
                if (_inPlaceCtrl.Resizable)
                    rect.Height += DropDownForm.ResizeGripHeight + 1;
                _dropDownHolder.Bounds = rect;

                control.Dock = DockStyle.Fill;
                control.Resize += new EventHandler(OnUIControlResize);

                _dropDownHolder.Width = Math.Max(_inPlaceCtrl.Width + 1, _dropDownHolder.Width);

                // Lookup a parent form for the Picker control and make the dropdown form to be owned
                // by it. This prevents to show the dropdown form icon when the user presses the At+Tab system 
                // key while the dropdown form is displayed.
                Control pickerForm = GetParentForm(_inPlaceCtrl);
                if ((pickerForm != null) && (pickerForm is Form))
                    _dropDownHolder.Owner = (Form)pickerForm;

                // Ensure the whole drop-down UI is displayed on the screen and show it.
                PositionDropDownHolder();

                Win32Calls.ShowWindow(new System.Runtime.InteropServices.HandleRef(this._dropDownHolder, this._dropDownHolder.Handle), 8);
                _dropDownHolder.Visible = true;
                control.Focus();
                _dropDownHolder.Refresh();
                _dropDownHolder.Invalidate(true);

                ((PropertyGrid)_inPlaceCtrl.Parent.Parent).SetDropDownTopWindow(_dropDownHolder);

                // Wait for the user to select a new value (in which case the UITypeEditor calls our CloseDropDown
                // method) or cancel the selection (no CloseDropDown called, the Cancel flag is set to True).
                DoModalLoop();

                ((PropertyGrid)_inPlaceCtrl.Parent.Parent).SetDropDownTopWindow(null);

                // Remember the cancel flag
                _canceled = _dropDownHolder.Canceled;
            }
 private void SetDropDownContainer(DropDownForm container)
 {
     _editorContainer = container;
 }
            public void DropDownControl(Control control)
            {
                if (_dropDownHolder == null)
                    _dropDownHolder = new DropDownForm();

                _canceled = false;

                // Initialize the hosting form for the control.
                _dropDownHolder.Bounds = control.Bounds;
                _dropDownHolder.SetControl(control);

                // Lookup a parent form for the Picker control and make the dropdown form to be owned
                // by it. This prevents to show the dropdown form icon when the user presses the At+Tab system 
                // key while the dropdown form is displayed.
                Control pickerForm = GetParentForm(_picker);
                if ((pickerForm != null) && (pickerForm is Form))
                    _dropDownHolder.Owner = (Form)pickerForm;

                // Ensure the whole drop-down UI is displayed on the screen and show it.
                PositionDropDownHolder();

                // Show the window but don't activate it
                _dropDownHolder.Show(); // ShowDialog would disable clicking outside the dropdown area!

                // Wait for the user to select a new color (in which case the ColorUI calls our CloseDropDown
                // method) or cancel the selection (no CloseDropDown called, the Cancel flag is set to True).
                DoModalLoop();

                // Remember the cancel flag
                _canceled = _dropDownHolder.Canceled;
//                _dropDownHolder.Dispose();
  //              _dropDownHolder = null;
            }