# FlexControl class

Namespace: [Grasshopper2.UI.Flex](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.ui.flex.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public class FlexControl : Drawable, IFlexControl
```

Core implementation of the [IFlexControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.iflexcontrol.md) interface.

**Derived types:** [BreadCrumbList](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.canvas.breadcrumblist.md), [Canvas](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.canvas.canvas.md), [ColourPickerControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.colourpicker.colourpickercontrol.md), [ContentGrid](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.contentbrowser.contentgrid.md), [CrystalControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.crystallography.crystalcontrol.md), [CustomPaletteControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.colourpicker.custompalettecontrol.md), [DiffCanvas](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.canvas.diffcanvas.md), [Editor](https://developer.rhino3d.com/api/gh2/type/grasshopper2.types.constraints.editor.md), [FunctionEditorControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.graphing.functioneditorcontrol.md), [GradientControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.gradient.gradientcontrol.md), [GridControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.entrygrid.gridcontrol.md), [HistoryBrowser](https://developer.rhino3d.com/api/gh2/type/grasshopper2.undo.historybrowser.md), [IconPixelPreviewControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.icon.vector.iconpixelpreviewcontrol.md), [IconVectorPreviewControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.icon.vector.iconvectorpreviewcontrol.md), [ParallelPerformanceControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.parallel.parallelperformancecontrol.md), [SkinEditorCanvas](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.skinning.skineditorcanvas.md), [SliderControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.slider.slidercontrol.md), [StatusBar](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.canvas.statusbar.md), [TabControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.tabbedpanel.tabcontrol.md)

## Constructors

- [FlexControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/ctor.md): Sets up the basic stuff.

## Fields

- [DefaultDwellDelay](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/defaultdwelldelay.md): (static) Gets the default dwell delay for Grasshopper tooltips.

## Properties

- [AllowPan](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/allowpan.md): Gets whether this control supports mouse panning.
- [AllowScrollGesture](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/allowscrollgesture.md): Gets or sets whether this control captures two-finger trackpad scroll and mouse-wheel events via its `ScrollGesture`. Set to false for FlexControls hosted in a `Scrollable` so the parent receives the scroll natively (native direction, momentum, rubber-band).
- [AllowZoom](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/allowzoom.md): Gets whether this control supports mouse zooming.
- [AltKeyDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/altkeydown.md): (static) Gets whether the Alt/Option key is down.
- [AutoWindowSelect](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/autowindowselect.md): Gets or sets whether a window selection automatically starts if a primary mousedown goes unhandled.
- [Border](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/border.md): Gets or sets the border drawn around this control.
- [ContentBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/contentbounds.md): Gets or sets the bounding box of the content. Use an empty rectangle to indicate boundless content.
- [ContentToControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/contenttocontrol.md): Gets the transformation matrix from content coordinates to control coordinates.
- [ControlKeyDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/controlkeydown.md): (static) Gets whether the control key is down.
- [ControlToContent](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/controltocontent.md): Gets the transformation matrix from control coordinates to content coordinates.
- [CurrentWindowSelection](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/currentwindowselection.md): Gets the current window selection. This field will only be non-null during a window selection process. If you wish to respond to a completes window selection, handle the WindowSelection event.
- [DrawContentBoundary](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/drawcontentboundary.md): Gets or sets whether the content boundary ought to be drawn when visible.
- [DrawScrollbars](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/drawscrollbars.md): Gets whether this control should display scrollbars when needed. Scrollbars will only be displayed when the content exceeds the inner bounds. If AllowPan is set to False, then scrollbars will never be shown.
- [FloatingButtonRail](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/floatingbuttonrail.md): Gets the rail along which floating buttons are positioned. By default, the rail is equal to the inner bounds offset by the button size. Override this property to define a custom rail, for example if some regions near the control boundary need to remain free of buttons.
- [FloatingButtons](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/floatingbuttons.md): Gets the floating button collection for this control.
- [FocusObject](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/focusobject.md): Gets the object which currently has focus, if any. Focused objects are most likely either IInteractions or IResponsives.
- [IFlexControl.DrawEndTime](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/grasshopper2-ui-flex-iflexcontrol-drawendtime.md)
- [IFlexControl.DrawStartTime](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/grasshopper2-ui-flex-iflexcontrol-drawstarttime.md)
- [InnerBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/innerbounds.md): Gets the area in control coordinates for the content of the control. This area does not include the control border.
- [InnerScreenBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/innerscreenbounds.md): Gets the inner bounds of this control in screen coordinates.
- [IntegerOrigin](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/integerorigin.md): Gets or sets whether this control only allows integer accuracy coordinates for the origin point.
- [IsDragSource](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/isdragsource.md): Gets or sets whether this control is potentially a source for drag+drop operations.
- [IsDropTarget](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/isdroptarget.md): Gets or sets whether this control is potentially a target for drag+drop operations.
- [MaximumZoom](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/maximumzoom.md): Gets or sets the maximum allowed zoom.
- [MinimumZoom](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/minimumzoom.md): Gets or sets the minimum allowed zoom.
- [MouseDwellDelay](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/mousedwelldelay.md): Gets or sets the duration required before a [FlexControl.MouseDwell](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/mousedwell.md) event is raised. Negative or zero length durations mean the [FlexControl.MouseDwell](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/mousedwell.md) event is never raised.
- [OuterBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/outerbounds.md): Gets the bounds of this control in container coordinates.
- [ParentControl](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/parentcontrol.md): Gets or sets the parent control.
- [Projection](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/projection.md): Gets or sets the projection for this control.
- [ResizeBehaviour](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/resizebehaviour.md): Gets or sets the projection behaviour of the content during control resizing events.
- [ResponsivesBackwards](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/responsivesbackwards.md): Enumerate over all registered responsive objects in reverse order.
- [ResponsivesForwards](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/responsivesforwards.md): Enumerate over all registered responsive objects.
- [ScreenBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/screenbounds.md): Gets the bounds of this control in screen coordinates.
- [ShiftKeyDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/shiftkeydown.md): (static) Gets whether the Shift key is down.
- [VisibleFrame](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/visibleframe.md): Gets the rectangle in content coordinates which represents the visible portion. This basically means the InnerBounds mapped into content coordinates.
- [ZoomFeedbackLocation](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/zoomfeedbacklocation.md): Gets or sets the location for zoom change feedback.

## Methods

- [AddSparkle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/addsparkle.md): Add a sparkle to this control.
- [Animate<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/animate.md): Evaluate an animator. This method automatically schedules redraw events if those are needed for smooth animations.
- [AnimatedZoomFactor](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/animatedzoomfactor.md): Gets the normalised factor (0.0, 1.0) which indicates to what extend the display is in the given state.
- [BeginWindowSelect](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/beginwindowselect.md): Start a window selection process.
- [ComputeWrappingBounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/computewrappingbounds.md): Determine the implied wrapping bounds given the control and the screen containing the location. The wrapping bounds are either the bounds of the screen containing the location, or the intersection of the screen containing the location and the bounds of the control if this intersection is not empty.
- [CreateFloatingButtons](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/createfloatingbuttons.md): Override this method to add a set of floating buttons to your control. It will automatically be called at the end of the constructor. You can always choose to add buttons later, but why not Zoidberg?
- [DispatchRotation](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/dispatchrotation.md): Route a rotation gesture through the responsives stack. The default implementation tries the focused object, then the coincident responsives in reverse order. Subclasses (e.g. Canvas) may override to extend the dispatch — typically by adding a document-pick step when the base path returns Ignored.
- [DrawWindowSelectionEdge](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/drawwindowselectionedge.md): (2 overloads) If a window selection is currently in progress, draw the fill of that window selection fence. By calling this method you override the default window selection drawing pipeline, which allows you to have finer control over the layering of the window rectangle background and foreground.
- [DrawWindowSelectionFill](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/drawwindowselectionfill.md): (2 overloads) If a window selection is currently in progress, draw the fill of that window selection fence. By calling this method you override the default window selection drawing pipeline, which allows you to have finer control over the layering of the window rectangle background and foreground.
- [EndWindowSelect](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/endwindowselect.md): If, for any reason, you wish to terminate a window selection process prematurely, call this method.
- [FloatingButtonTooltipOverride](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/floatingbuttontooltipoverride.md): Override this method to provide a custom tooltip for floating buttons.
- [LooksLikeSingleClick](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/lookslikesingleclick.md): Test whether the given mouse event is compatible with a single-click-event given the most recent MouseDown event cache.
- [Map](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/map.md): (2 overloads) Map a point from one coordinate system to another.
- [Navigate](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/navigate.md): (4 overloads) Navigate to a specific content position.
- [OnKeyDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onkeydown.md): Key down handler.
- [OnKeyUp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onkeyup.md): Key up handler.
- [OnLoad](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onload.md): Raises the `Load` event, and recurses to this container's children
- [OnLoadComplete](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onloadcomplete.md): Raises the `LoadComplete` event, and recurses to this container's children
- [OnMouseDoubleClick](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onmousedoubleclick.md): Default mousedoubleclick handler for IControl. The default handling includes event delegation to the entire IInteraction stack.
- [OnMouseDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onmousedown.md): Default mousedown handler for IControl. The default handling includes event delegation to the entire IInteraction stack, as well as the creation of Pan and Zoom interactions if needed.
- [OnMouseLeave](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onmouseleave.md): Default mouseleave handler for IControl. The default handling deals with the hover tracking mechanism.
- [OnMouseMove](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onmousemove.md): Default mousemove handler for IControl. The default handling includes event delegation to the entire IInteraction stack, as well as the updating of any active window selection and hover delay tracking.
- [OnMouseUp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onmouseup.md): Default mouseup handler for IControl. The default handling includes event delegation to the entire IInteraction stack, as well as the terminating of any window selections and the popping of context menus. Furthermore, this method decides whether to provide a Click event for interaction objects.
- [OnMouseWheel](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onmousewheel.md): Default mousewheel handler for IControl. The default handling includes event delegation to the entire IInteraction stack, as well as scroll zooming.
- [OnPaint](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onpaint.md): Runs the drawing pipeline. Do not override this method unless you know *exactly* what you are doing. Handle the Draw(object, ControlDrawEventArgs) event instead.
- [OnPinchGesture](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onpinchgesture.md): Handle a pinch gesture tick. The default implementation applies a zoom to the FlexControl [FlexControl.Projection](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/projection.md) (gated on [FlexControl.AllowZoom](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/allowzoom.md)). Subclasses with their own projection — for example the function editor's FrameF — override this to drive that projection instead.
- [OnPopulateContextMenu](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onpopulatecontextmenu.md): Override this method to populate the context menu, or handle the PopulateContextMenu event. This method will automatically show the menu if it contains any items.
- [OnScrollGesture](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onscrollgesture.md): Handle a scroll gesture tick (two-finger trackpad drag or mouse wheel). The default implementation pans the FlexControl [FlexControl.Projection](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/projection.md) (gated on [FlexControl.AllowPan](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/allowpan.md)). Subclasses with their own projection override this to drive that projection instead.
- [OnSizeChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/onsizechanged.md): Raises the `SizeChanged` event.
- [OnTextInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/ontextinput.md): Text input handler.
- [PopFocus](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/popfocus.md): Pop a responsive object off the focus stack. It doesn't matter if it's at the head of the stack, but if it is, the new head will receive focus.
- [PushFocus](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/pushfocus.md): Push a new responsive object into the top of the focus stack. This does not register the object with this control.
- [RegisterIResponsive](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/registeriresponsive.md): Add a responsive object to this control's awareness. Responsive objects which have been properly registered will automatically have their response methods invoked in case of mouse/keyboard events on the control. The object will not be drawn though, that is the responsibility of the owner.
- [ScheduleRedraw](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/scheduleredraw.md): (2 overloads) Schedule a redraw in the near future. Redraw will happen as quickly as possible, though the message queue will be emptied first.
- [UnregisterIResponsive](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/unregisteriresponsive.md): Remove a responsive object from this control's awareness.
- [UpdateMapping](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/updatemapping.md): Update the mapping matrices. You *must* call this method whenever you change something that might affect the positioning of the content. For example origin, zoom, bounds...

## Events

- [Draw](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/draw.md): This event is raised whenever the control paints itself.
- [MouseDwell](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/mousedwell.md): Raised when the mouse dwells over some pixel without moving for a while.
- [PopulateContextMenu](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/populatecontextmenu.md): Raised whenever the context menu ought to be populated.
- [ProjectionChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/projectionchanged.md): Raised whenever the projection of a control changes.
- [WindowSelection](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.flex.flexcontrol/windowselection.md): Raised whenever a window selection completes.
