Esempio n. 1
0
        public void EditValue_InvalidProvider_ReturnsValue(IServiceProvider provider)
        {
            var editor = new FontEditor();
            var value  = new object();

            Assert.Same(value, editor.EditValue(null, provider, value));
        }
Esempio n. 2
0
        // if the user can type, show drop down when requested
        protected override void OnDropDown(EventArgs e)
        {
            // fire event as usual
            base.OnDropDown(EventArgs.Empty);

            // show editor and get the new value
            object value = _editor.EditValue((IServiceProvider)this, SelectedFont);

            if (value is Font)
            {
                SelectedFont = (Font)_fontConverter.ConvertFromString(_fontConverter.ConvertToString(value));
                SelectAll();
            }

            // hide the standard drop-down
            Win32.PostMessage(Handle, Win32.CB_SHOWDROPDOWN, IntPtr.Zero, IntPtr.Zero);
        }