protected void RunButton() { if (ReadOnly) { return; } _ownerPropertyEnum.Property.InPlaceCtrlInAction = this; PropertyValue unitValue = _ownerPropertyEnum.Property.GetValue(PropertyUnitLook.UnitValue); _editorContainer.SetContent(_ownerPropertyEnum, unitValue.DisplayString, PropertyUnitLook.UnitValue); if (_editorContainer.ContentControl == null) { return; } _editorContainer.MustBeClosed += new EventHandler(OnDropDownContentMustBeClosed); Win32Calls.SetWindowLong(_editorContainer.Handle, -8, (int)Parent.Handle); Rectangle workingArea = Screen.FromControl(this).WorkingArea; Point offset = Parent.PointToScreen(new Point(0, 0)); Rectangle bounds = Bounds; // No listbox smaller than the value column if (_editorContainer.Width < Size.Width) { _editorContainer.Width = Size.Width; } // No listbox left truncated Point origin = new Point(bounds.Right - _editorContainer.Size.Width + offset.X, bounds.Bottom + 1 + offset.Y); if (origin.X < workingArea.Left) { origin.X = workingArea.Left; } // No listbox bottom truncated if (origin.Y + _editorContainer.Height > workingArea.Bottom) { origin.Y = bounds.Top - _editorContainer.Height + offset.Y; } _editorContainer.Location = origin; _editorContainer.ContentControl.Dock = DockStyle.Fill; // Show the window but don't activate it Win32Calls.ShowWindow(new HandleRef(_editorContainer, _editorContainer.Handle), Win32Calls.SW_SHOWNA); _editorContainer.Visible = true; _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(_editorContainer); _editorContainer.DoModalLoop(); }
protected void RunButton() { if (ReadOnly) return; _ownerPropertyEnum.Property.InPlaceCtrlInAction = this; // TODO: Passer la valeur actuelle au lieu de Text qd realtimechange==false et TypeConverter->exception ? _editorContainer = new PropInPlaceContainer(); _editorContainer.SetContent(_ownerPropertyEnum, Text); if (_editorContainer.ContentControl == null) return; _editorContainer.MustBeClosed += new EventHandler(OnDropDownContentMustBeClosed); Win32Calls.SetWindowLong(_editorContainer.Handle, -8, (int)Parent.Handle); Rectangle workingArea = Screen.FromControl(this).WorkingArea; Point offset = Parent.PointToScreen(new Point(0, 0)); Rectangle bounds = Bounds; // No listbox smaller than the value column if (_editorContainer.Width < Size.Width) _editorContainer.Width = Size.Width; // No listbox left truncated Point origin = new Point(bounds.Right - _editorContainer.Size.Width + offset.X, bounds.Bottom + 1 + offset.Y); if (origin.X < workingArea.Left) origin.X = workingArea.Left; // No listbox bottom truncated if (origin.Y + _editorContainer.Height > workingArea.Bottom) { _editorContainer.ResizeTop = true; origin.Y = bounds.Top - _editorContainer.Height + offset.Y; } else _editorContainer.ResizeTop = false; _editorContainer.Location = origin; // The previous call to ResizeTop resets the DockPadding to 0 if the container is not resizable _editorContainer.ContentControl.Dock = DockStyle.Fill; // Show the window but don't activate it Win32Calls.ShowWindow(new HandleRef(_editorContainer, _editorContainer.Handle), Win32Calls.SW_SHOWNA); _editorContainer.Visible = true; _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(_editorContainer); _editorContainer.DoModalLoop(); }
protected void RunButton() { if (ReadOnly) { return; } _ownerPropertyEnum.Property.InPlaceCtrlInAction = this; // TODO: Passer la valeur actuelle au lieu de Text qd realtimechange==false et TypeConverter->exception ? _editorContainer = new PropInPlaceContainer(); _editorContainer.SetContent(_ownerPropertyEnum, Text); if (_editorContainer.ContentControl == null) { return; } _editorContainer.MustBeClosed += new EventHandler(OnDropDownContentMustBeClosed); Win32Calls.SetWindowLong(_editorContainer.Handle, -8, (int)Parent.Handle); Rectangle workingArea = Screen.FromControl(this).WorkingArea; Point offset = Parent.PointToScreen(new Point(0, 0)); Rectangle bounds = Bounds; // No listbox smaller than the value column if (_editorContainer.Width < Size.Width) { _editorContainer.Width = Size.Width; } // No listbox left truncated Point origin = new Point(bounds.Right - _editorContainer.Size.Width + offset.X, bounds.Bottom + 1 + offset.Y); if (origin.X < workingArea.Left) { origin.X = workingArea.Left; } // No listbox bottom truncated if (origin.Y + _editorContainer.Height > workingArea.Bottom) { _editorContainer.ResizeTop = true; origin.Y = bounds.Top - _editorContainer.Height + offset.Y; } else { _editorContainer.ResizeTop = false; } _editorContainer.Location = origin; // The previous call to ResizeTop resets the DockPadding to 0 if the container is not resizable _editorContainer.ContentControl.Dock = DockStyle.Fill; // Show the window but don't activate it Win32Calls.ShowWindow(new HandleRef(_editorContainer, _editorContainer.Handle), Win32Calls.SW_SHOWNA); _editorContainer.Visible = true; _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(_editorContainer); _editorContainer.DoModalLoop(); }