Click or drag to resize

GH_Canvas Class

The GH_Canvas is the control that handles all mouse and paint events for a single loaded document.
Inheritance Hierarchy

Namespace:  Grasshopper.GUI.Canvas
Assembly:  Grasshopper (in Grasshopper.dll)
Syntax
public class GH_Canvas : Control

The GH_Canvas type exposes the following members.

Constructors
  NameDescription
Public methodGH_Canvas
Initializes a new instance of the GH_Canvas class
Top
Properties
  NameDescription
Public propertyActiveInteraction
Gets or sets the currently active interaction object.
Public propertyActiveObject
Gets or sets the currently active object.
Public propertyActiveWidget
Gets or sets the currently active widget.
Public propertyCursorCanvasPosition
Gets the location of the cursor in Canvas coordinates.
Public propertyCursorControlPosition
Gets the location of the cursor in Control coordinates.
Public propertyStatic memberDisplayVoronoiWarning
Gets or sets whether the Voronoi Over-dose warning message is displayed. This property is set once at Grasshopper startup to True.
Public propertyDocument
Gets or sets the document currently loaded in this canvas.
Public propertyDrawingMode
Gets the current drawing mode for this canvas.
Public propertyHasControlWithFocus
Gets whether or not this canvas has a child control on it with focus.
Public propertyIsActiveInteraction
Gets a value indicating whether or not there is an interaction object loaded in this canvas.
Public propertyIsActiveObject
Gets a value indicating whether or not an object is currently activated.
Public propertyIsActiveWidget
Gets a value indicating whether or not a widget is currently activated.
Public propertyIsDocument
Gets a value indicating whether or not a document is currently loaded in this canvas.
Public propertyMarkovSuggestions
Public propertyModifiersEnabled
Gets or sets the modifiers enabled flag. When modifiers are disabled, only zooming and panning is still allowed.
Public propertyStatic memberNavigationPanDown
Gets or sets the special key for panning down.
Public propertyStatic memberNavigationPanLeft
Gets or sets the special key for panning left.
Public propertyStatic memberNavigationPanPixels
Gets or sets the number of pixels for each pan operation.
Public propertyStatic memberNavigationPanRight
Gets or sets the special key for panning right.
Public propertyStatic memberNavigationPanUp
Gets or sets the special key for panning up.
Public propertyStatic memberNavigationZoomFactor
Gets or sets the zoom factor for navigation zoom operations.
Public propertyStatic memberNavigationZoomIn
Gets or sets the special key for zooming in.
Public propertyStatic memberNavigationZoomOut
Gets or sets the special key for zooming in.
Public propertyPainter
Gets the painter object that handles most of the drawing logic for this canvas.
Public propertyPainting
Gets whether this canvas is currently busy painting itself.
Public propertyRecordPreviewBoundary
Public propertyTagArtistIDs
Gets all the TagArtist IDs in this Canvas.
Public propertyStatic memberThumbnailSize
Gets the thumbnail size for documents.
Public propertyTooltipDelay
Gets the delay (in milliseconds) required for a tooltip popup. This delay is a user setting stored under the Canvas:TooltipDelay field of the core settings.
Public propertyValidator
Provides access to all the validators associated with this canvas.
Public propertyViewport
Gets the viewport that determines the panning and zooming for this canvas.
Public propertyWidgets
Gets a list of all the widgets on this canvas.
Public propertyStatic memberZoomFadeHigh
Gets the ZUI fade alpha value for the high zoom level threshold. This static field gets set on every Canvas paint start. The high threshold is typically used for ZUI elements that only appear when zoomed in.
Public propertyStatic memberZoomFadeLow
Gets the ZUI fade alpha value for the low zoom level threshold. This static field gets set on every Canvas paint start. The low threshold is typically used for fading of icons and object names.
Public propertyStatic memberZoomFadeMedium
Gets the ZUI fade alpha value for the medium zoom level threshold. This static field gets set on every Canvas paint start. The medium threshold is typically used for non-informative UI elements such as highlights.
Top
Methods
  NameDescription
Public methodAddTagArtist
Add a Tag Artist instance to this canvas.
Public methodAddValidator
Add a new drop validator to the canvas.
Public methodAutoSaveDocument
Public methodCanvasOldSchoolMenu
Public methodCreateMRUPanels
Create new MRU panels. This function only does something if there is no document loaded in the canvas.
Public methodCreatePreview
Render this canvas to a thumbnail preview.
Public methodDestroyMRUPanels
Destroy any MRU panels that might be in existence.
Protected methodDispose
Releases the unmanaged resources used by the GH_Canvas and optionally releases the managed resources
(Overrides ControlDispose(Boolean).)
Public methodGenerateHiResImage
Generate a collection of hi-res images of the document.
Public methodGenerateHiResImageTile
Generate a single tile in a Hi-Res image export.
Public methodGetCanvasScreenBuffer
Get a bitmap that resembles the current state of the canvas.
Public methodGetGraphicsObject
Gets a graphics object for this control. You are not allowed to draw with this object, use it only for visibility testing and such. If you're inside a canvas update, use the Graphics() property instead. You must dispose of the Graphics object returned by this method or resources will be leaked.
Public methodHideMRUPanels
Hide all existing MRU panels by sliding them out of view.
Public methodInstantiateNewObject(Guid, PointF, Boolean)
Public methodInstantiateNewObject(Guid, String, PointF, Boolean)
Public methodNavigate
Perform a single navigation step.
Protected methodOnPaint (Overrides ControlOnPaint(PaintEventArgs).)
Protected methodOnPaintBackground (Overrides ControlOnPaintBackground(PaintEventArgs).)
Public methodOnViewportChanged
Ensure the canvas and document viewport data are synchronised and raises the ViewportChanged event.
Public methodReevaluateMarkovSuggestions
Public methodRemoveAllTagArtists
Remove all IGH_TagArtists from this canvas. Do not use this method unless you want to screw over everyone else.
Public methodRemoveTagArtist(Guid)
Remove all IGH_TagArtists from this canvas that match a certain ID.
Public methodRemoveTagArtist(IGH_TagArtist)
Remove a specific tag artist from this canvas. If the instance occurs multiple times in the TagArtist list, all instances will be removed.
Public methodRemoveValidator
Remove a drop validator from the canvas.
Public methodScheduleRegen
Schedule a regen to occur after the specified number of milliseconds have elapsed. If a Regen is called in this time frame, the schedule will be cleared. Only a single schedule can be active at any time, so any call to ScheduleRegen will clear existing schedules.
Public methodSetSmartTextRenderingHint
When this method is called during a redraw, the TextRenderingHint of the associated graphics object will be set to either GH_CrispText or GH_SmoothText depending on zoom level.
Public methodShowComponentSearchBox
Display the component Search dialog at the current mouse location. The dialog cannot be shown if ModifiersEnabled=False.
Public methodShowComponentSearchBox(Point)
Display the component Search dialog at the given coordinate. The dialog cannot be shown if ModifiersEnabled=False.
Public methodShowMRUPanels
Show any hidden MRU panels by sliding them back into view.
Public methodShowNavigationPane
Displays the quick-navigation popup pane at the cursor.
Public methodShowSearchDialog
Display the Find dialog. If a Find dialog is already active for this canvas, nothing will happen.
Public methodStartAutoPan
Start the auto-panning timer.
Public methodStopAutoPan
Stop the auto-panning timer.
Public methodUpdateDocumentPreview
Call this method to update the preview thumbnail for the currently loaded document. If no document is currently loaded, nothing will happen.
Top
Events
  NameDescription
Public eventCanvasPaintBackground
Raised after the background has been drawn.
Public eventCanvasPaintBegin
Raised before a new paint operation starts. This event is always raised, even if the Canvas isn't visible.
Public eventCanvasPaintEnd
Raised after a paint operation completes. This event is always raised, even if the Canvas isn't visible.
Public eventCanvasPostPaintGroups
Raised after group drawing completes.
Public eventCanvasPostPaintObjects
Raised after object drawing completes.
Public eventCanvasPostPaintOverlay
Raised after object overlay drawing completes.
Public eventCanvasPostPaintWidgets
Raised after widgets are drawn. This is the final event in the Drawing pipeline.
Public eventCanvasPostPaintWires
Raised after wire drawing completes.
Public eventCanvasPrePaintGroups
Raised before group drawing starts.
Public eventCanvasPrePaintObjects
Raised before object drawing starts.
Public eventCanvasPrePaintOverlay
Raised before object overlay drawing starts.
Public eventCanvasPrePaintWidgets
Raised before Widgets are drawn.
Public eventCanvasPrePaintWires
Raised before wire drawing starts.
Public eventDocument_ModifiedChanged
Public eventDocument_ObjectsAdded
Public eventDocument_ObjectsDeleted
Public eventDocument_SettingsChanged
Public eventDocumentChanged
This event is raised whenever a different document is loaded into this canvas.
Public eventDocumentObjectMouseDown
This event is raised whenever the left mouse button is pressed while over a Document object.
Public eventModifiersChanged
This event is raised whenever the ModifiersEnabled property changes.
Public eventStatic memberNavigationSettingsChanged
Raised whenever any of the shared navigation properties changed.
Public eventViewportChanged
This event is raised whenever the viewport properties are modified, for example when the pan or zoom values are affected.
Public eventStatic memberWidgetListCreated
This event is raised once for every GH_Canvas object that is created anew. The event is Shared (static) because it is raised inside the constructor of a GH_Canvas object and therefor cannot be registered on an instance.
Top
Fields
  NameDescription
Public fieldStatic memberScheduleInactive
Defines the delay used to indicate the absence of a schedule.
Public fieldStatic memberThumbnailHeight
Public fieldStatic memberThumbnailWidth
Top
Extension Methods
  NameDescription
Public Extension MethodToEto (Defined by EtoExtensions.)
Top
See Also