[DesignerGenerated] public class GH_Canvas : Control
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

ScheduleInactive

#
Defines the delay used to indicate the absence of a schedule.
public const int ScheduleInactive = -1

ThumbnailHeight

#
public static readonly int ThumbnailHeight

ThumbnailWidth

#
public static readonly int ThumbnailWidth

Properties

ActiveInteraction

#
Gets or sets the currently active interaction object.
public IGH_MouseInteraction ActiveInteraction { get; set; }

ActiveObject

#
Gets or sets the currently active object.
public IGH_DocumentObject ActiveObject { get; set; }

ActiveWidget

#
Gets or sets the currently active widget.
public IGH_Widget ActiveWidget { get; set; }

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.
public static bool DisplayVoronoiWarning { get; set; }

Document

#
Gets or sets the document currently loaded in this canvas.
public GH_Document Document { get; set; }

DrawingMode

#
Gets the current drawing mode for this canvas.
public GH_CanvasMode DrawingMode { get; }

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.
[Browsable(false)] public Graphics Graphics { get; }

HasControlWithFocus

#
Gets whether or not this canvas has a child control on it with focus.
public bool HasControlWithFocus { get; }

IsActiveInteraction

#
Gets a value indicating whether or not there is an interaction object loaded in this canvas.
public bool IsActiveInteraction { get; }

IsActiveObject

#
Gets a value indicating whether or not an object is currently activated.
public bool IsActiveObject { get; }

IsActiveWidget

#
Gets a value indicating whether or not a widget is currently activated.
public bool IsActiveWidget { get; }

IsDocument

#
Gets a value indicating whether or not a document is currently loaded in this canvas.
public bool IsDocument { get; }

MarkovSuggestions

#
public List<IGH_ObjectProxy> MarkovSuggestions { get; }

ModifiersEnabled

#
Gets or sets the modifiers enabled flag. When modifiers are disabled, only zooming and panning is still allowed.
public bool ModifiersEnabled { get; set; }

Painter

#
Gets the painter object that handles most of the drawing logic for this canvas.
public GH_Painter Painter { get; }

Painting

#
Gets whether this canvas is currently busy painting itself.
public bool Painting { get; }

RecordPreviewBoundary

#
public bool RecordPreviewBoundary { get; set; }

TagArtistIDs

#
Gets all the TagArtist IDs in this Canvas.
public List<Guid> TagArtistIDs { get; }

ThumbnailSize

#
Gets the thumbnail size for documents.
public static Size ThumbnailSize { get; }

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.
public int TooltipDelay { get; }

Validator

#
Provides access to all the validators associated with this canvas.
public IGH_CanvasValidator Validator { get; }

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.
[Browsable(false)] public bool ValidGraphics { get; set; }

Viewport

#
Gets the viewport that determines the panning and zooming for this canvas.
public GH_Viewport Viewport { get; }

Widgets

#
Gets a list of all the widgets on this canvas.
public List<IGH_Widget> Widgets { get; }

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.
public static int ZoomFadeHigh { get; }

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.
public static int ZoomFadeLow { get; }

ZoomFadeMedium

#
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.
public static int ZoomFadeMedium { get; }

Methods

AddTagArtist

#
Add a Tag Artist instance to this canvas.
public void AddTagArtist(
artist
Tag artist to add
)

AddValidator

#
Add a new drop validator to the canvas.
public void AddValidator(
validator
Validator to add.
)

AutoSaveDocument

#
public void AutoSaveDocument()

CanvasOldSchoolMenu

#
public ToolStripDropDownMenu CanvasOldSchoolMenu()

CreateMRUPanels

#
Create new MRU panels. This function only does something if there is no document loaded in the canvas.
public void CreateMRUPanels()

CreatePreview

#
Render this canvas to a thumbnail preview.
public Bitmap CreatePreview(
Size
size
)

DestroyMRUPanels

#
Destroy any MRU panels that might be in existence.
public void DestroyMRUPanels()

Dispose

#
protected override void Dispose(
disposing
)
Control.Dispose

GenerateHiResImage

#
Generate a collection of hi-res images of the document.
public List<string> GenerateHiResImage(
Rectangle
rec,
BoundingBox rectangle of export.
settings,
Hi-res settings.
ref Size
totalSize
)
List of file paths that indicate the individual images.

GenerateHiResImageTile

#
Generate a single tile in a Hi-Res image export.
public Bitmap GenerateHiResImageTile(
vp,
Viewport override
Color
bg
Background color override.
)
A list of image tiles.

GetCanvasScreenBuffer

#
Get a bitmap that resembles the current state of the canvas.
public Bitmap GetCanvasScreenBuffer(
modeOverride
The mode to apply during the off-screen rendering.
)
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.
public Graphics GetGraphicsObject(
setupDisplayTransform
If true, the display transform will be added to the graphics object.
)
A non-drawing Graphics object on success or null on failure..

HideMRUPanels

#
Hide all existing MRU panels by sliding them out of view.
public void HideMRUPanels()

InstantiateNewObject

#
public bool InstantiateNewObject(
id,
PointF
at,
update
)

InstantiateNewObject

#
public bool InstantiateNewObject(
id,
init_code,
PointF
at,
update
)

OnPaint

#
protected override void OnPaint()
Control.OnPaint

OnPaintBackground

#
protected override void OnPaintBackground()

OnViewportChanged

#
Ensure the canvas and document viewport data are synchronised and raises the ViewportChanged event.
public void OnViewportChanged()

ReevaluateMarkovSuggestions

#
public void ReevaluateMarkovSuggestions()

Regen

#
[EditorBrowsable(EditorBrowsableState.Never)] public void Regen()
obsoleteThis method is obsolete, use Refresh() instead. Or better yet, use Invalidate().

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.
public int RemoveTagArtist(
artistId
ID of IGH_TagArtists to remove.
)
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.
public int RemoveTagArtist(
artist
TagArtist to remove.
)
The number of IGH_TagArtist instances removed.

RemoveValidator

#
Remove a drop validator from the canvas.
public void RemoveValidator(
validator
Validator to remove.
)

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.
public bool ShowComponentSearchBox()
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.
)
True on success, false on failure.

ShowMRUPanels

#
Show any hidden MRU panels by sliding them back into view.
public void ShowMRUPanels()

ShowNavigationPane

#
Displays the quick-navigation popup pane at the cursor.
public void ShowNavigationPane()

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.
)

StartAutoPan

#
Start the auto-panning timer.
public void StartAutoPan()

StopAutoPan

#
Stop the auto-panning timer.
public void StopAutoPan()

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

CanvasPaintBackground

#
Raised after the background has been drawn.
public event GH_Canvas.CanvasPaintBackgroundEventHandler CanvasPaintBackground

CanvasPaintBegin

#
Raised before a new paint operation starts. This event is always raised, even if the Canvas isn't visible.
public event GH_Canvas.CanvasPaintBeginEventHandler CanvasPaintBegin

CanvasPaintEnd

#
Raised after a paint operation completes. This event is always raised, even if the Canvas isn't visible.
public event GH_Canvas.CanvasPaintEndEventHandler CanvasPaintEnd

CanvasPostPaintGroups

#
Raised after group drawing completes.
public event GH_Canvas.CanvasPostPaintGroupsEventHandler CanvasPostPaintGroups

CanvasPostPaintObjects

#
Raised after object drawing completes.
public event GH_Canvas.CanvasPostPaintObjectsEventHandler CanvasPostPaintObjects

CanvasPostPaintOverlay

#
Raised after object overlay drawing completes.
public event GH_Canvas.CanvasPostPaintOverlayEventHandler CanvasPostPaintOverlay

CanvasPostPaintWidgets

#
Raised after widgets are drawn. This is the final event in the Drawing pipeline.
public event GH_Canvas.CanvasPostPaintWidgetsEventHandler CanvasPostPaintWidgets

CanvasPostPaintWires

#
Raised after wire drawing completes.
public event GH_Canvas.CanvasPostPaintWiresEventHandler CanvasPostPaintWires

CanvasPrePaintGroups

#
Raised before group drawing starts.
public event GH_Canvas.CanvasPrePaintGroupsEventHandler CanvasPrePaintGroups

CanvasPrePaintObjects

#
Raised before object drawing starts.
public event GH_Canvas.CanvasPrePaintObjectsEventHandler CanvasPrePaintObjects

CanvasPrePaintOverlay

#
Raised before object overlay drawing starts.
public event GH_Canvas.CanvasPrePaintOverlayEventHandler CanvasPrePaintOverlay

CanvasPrePaintWidgets

#
Raised before Widgets are drawn.
public event GH_Canvas.CanvasPrePaintWidgetsEventHandler CanvasPrePaintWidgets

CanvasPrePaintWires

#
Raised before wire drawing starts.
public event GH_Canvas.CanvasPrePaintWiresEventHandler CanvasPrePaintWires

Document_ModifiedChanged

#
public event GH_Canvas.Document_ModifiedChangedEventHandler Document_ModifiedChanged

Document_ObjectsAdded

#
public event GH_Canvas.Document_ObjectsAddedEventHandler Document_ObjectsAdded

Document_ObjectsDeleted

#
public event GH_Canvas.Document_ObjectsDeletedEventHandler Document_ObjectsDeleted

Document_SettingsChanged

#
public event GH_Canvas.Document_SettingsChangedEventHandler Document_SettingsChanged

DocumentChanged

#
This event is raised whenever a different document is loaded into this canvas.
public event GH_Canvas.DocumentChangedEventHandler DocumentChanged

DocumentObjectMouseDown

#
This event is raised whenever the left mouse button is pressed while over a Document object.
public event GH_Canvas.DocumentObjectMouseDownEventHandler DocumentObjectMouseDown

DocumentObjectsDeleted

#

ModifiersChanged

#
This event is raised whenever the ModifiersEnabled property changes.
public event GH_Canvas.ModifiersChangedEventHandler ModifiersChanged

ViewportChanged

#
This event is raised whenever the viewport properties are modified, for example when the pan or zoom values are affected.
public event GH_Canvas.ViewportChangedEventHandler ViewportChanged

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.
public static event GH_Canvas.WidgetListCreatedEventHandler WidgetListCreated