The GH_Canvas is the control that handles all mouse and paint events for a single loaded document.
Constructors
GH_Canvas
#public GH_Canvas()
Fields
Properties
CursorCanvasPosition
#Gets the location of the cursor in Canvas coordinates.
public PointF CursorCanvasPosition { get; }
CursorControlPosition
#Gets the location of the cursor in Control coordinates.
public Point CursorControlPosition { get; }
DisplayVoronoiWarning
#Gets or sets whether the Voronoi Over-dose warning message is displayed. This property is set once at Grasshopper startup to True.
Graphics
#Gets the graphics object with which this Canvas is redrawn. This object only exists during redraws, if you need the Graphics object for this canvas outside of updates, call GetGraphicsObject() instead.
IsActiveInteraction
#Gets a value indicating whether or not there is an interaction object loaded in this canvas.
MarkovSuggestions
#ModifiersEnabled
#Gets or sets the modifiers enabled flag. When modifiers are disabled, only zooming and panning is still allowed.
TooltipDelay
#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.
ValidGraphics
#Gets or sets the Valid Graphics flag. Even if the flag is set to true, though, the property may still return false if there is a problem with the internal graphics object.
ZoomFadeHigh
#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.
ZoomFadeLow
#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.
Methods
AutoSaveDocument
#CreateMRUPanels
#Create new MRU panels. This function only does something if there is no document loaded in the canvas.
public void CreateMRUPanels()
GenerateHiResImage
#Generate a collection of hi-res images of the document.
Returns: List of file paths that indicate the individual images.
GenerateHiResImageTile
#Generate a single tile in a Hi-Res image export.
public Bitmap GenerateHiResImageTile()
Returns: A list of image tiles.
GetCanvasScreenBuffer
#Get a bitmap that resembles the current state of the canvas.
public Bitmap GetCanvasScreenBuffer()
Returns: A Format24bppRgb bitmap similar to the current canvas display.
GetGraphicsObject
#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.
Returns: A non-drawing Graphics object on success or null on failure..
InstantiateNewObject
#OnViewportChanged
#Ensure the canvas and document viewport data are synchronised and raises the ViewportChanged event.
public void OnViewportChanged()
ReevaluateMarkovSuggestions
#public void ReevaluateMarkovSuggestions()
RemoveAllTagArtists
#Remove all IGH_TagArtists from this canvas. Do not use this method unless you want to screw over everyone else.
public void RemoveAllTagArtists()
RemoveTagArtist
#Remove all IGH_TagArtists from this canvas that match a certain ID.
Returns: The number of IGH_TagArtist instances removed.
RemoveTagArtist
#Remove a specific tag artist from this canvas. If the instance occurs multiple times in the TagArtist list, all instances will be removed.
Returns: The number of IGH_TagArtist instances removed.
ScheduleRegen
#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 void ScheduleRegen()
delay
Number of milliseconds to wait until repainting the canvas. intervals equal to or less than zero will be ignored.
SetSmartTextRenderingHint
#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 void SetSmartTextRenderingHint()
ShowComponentSearchBox
#Display the component Search dialog at the current mouse location. The dialog cannot be shown if ModifiersEnabled=False.
Returns: True on success, false on failure.
ShowComponentSearchBox
#Display the component Search dialog at the given coordinate. The dialog cannot be shown if ModifiersEnabled=False.
public bool ShowComponentSearchBox()
Point
at
Location (in screen space) for the center of the search box.
Returns: True on success, false on failure.
ShowSearchDialog
#Display the Find dialog. If a Find dialog is already active for this canvas, nothing will happen.
public void ShowSearchDialog()
centerOnCursor
If true, the dialog will be centered on the cursor, otherwise it will be put in the upper left corner of the canvas.
UpdateDocumentPreview
#Call this method to update the preview thumbnail for the currently loaded document. If no document is currently loaded, nothing will happen.
public void UpdateDocumentPreview()
Events
CanvasPaintBegin
#Raised before a new paint operation starts. This event is always raised, even if the Canvas isn't visible.
CanvasPaintEnd
#Raised after a paint operation completes. This event is always raised, even if the Canvas isn't visible.
CanvasPostPaintWidgets
#Raised after widgets are drawn. This is the final event in the Drawing pipeline.
Document_ModifiedChanged
#Document_ObjectsAdded
#Document_ObjectsDeleted
#Document_SettingsChanged
#DocumentObjectMouseDown
#This event is raised whenever the left mouse button is pressed while over a Document object.
DocumentObjectsDeleted
#[EditorBrowsable(EditorBrowsableState.Never)]
public event GH_Canvas.DocumentObjectsDeletedEventHandler DocumentObjectsDeleted
ViewportChanged
#This event is raised whenever the viewport properties are modified, for example when the pan or zoom values are affected.
WidgetListCreated
#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.