RhinoViewport.Size Property

RhinoViewportSize Property

Get or set the height and width of the viewport (in pixels)

Namespace:  Rhino.Display
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 5.0
Syntax
public Size Size { get; set; }
Public Property Size As Size
	Get
	Set

Property Value

Type: Size
Examples
using Rhino;
using Rhino.Commands;

namespace examples_cs
{
  public class ViewportResolutionCommand : Command
  {
    public override string EnglishName { get { return "csViewportResolution"; } }

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
      var active_viewport = doc.Views.ActiveView.ActiveViewport;
      RhinoApp.WriteLine("Name = {0}: Width = {1}, Height = {2}", 
        active_viewport.Name, active_viewport.Size.Width, active_viewport.Size.Height);
      return Result.Success;
    }
  }
}
Imports Rhino
Imports Rhino.Commands

Namespace examples_vb
  Public Class ViewportResolutionCommand
    Inherits Command
    Public Overrides ReadOnly Property EnglishName() As String
      Get
        Return "vbViewportResolution"
      End Get
    End Property

    Protected Overrides Function RunCommand(doc As RhinoDoc, mode As RunMode) As Result
      Dim activeViewport = doc.Views.ActiveView.ActiveViewport
      RhinoApp.WriteLine([String].Format("Name = {0}: Width = {1}, Height = {2}", activeViewport.Name, activeViewport.Size.Width, activeViewport.Size.Height))
      Return Result.Success
    End Function
  End Class
End Namespace
Python
from scriptcontext import doc

activeViewport = doc.Views.ActiveView.ActiveViewport
print "Name = {0}: Width = {1}, Height = {2}".format(
    activeViewport.Name, activeViewport.Size.Width, activeViewport.Size.Height)
See Also