Lock and display shaded a detailview

Hi, I’m tring to change a detail view to shaded mode then lock it (disable zooming). I’m using vb.net, my detailViewObject is defined like this:

 Dim detailview As Rhino.DocObjects.DetailViewObject = pageview.GetDetailViews(0)

Any idea on how to do that?

To shade a viewport, you can do something like this:

RhinoView view = .....
const string englishName = @"Shaded";
DisplayModeDescription display_mode_description = DisplayModeDescription.FindByName(englishName);
if (null != display_mode_description)
{
  view.ActiveViewport.DisplayMode = display_mode_description;
  view.Redraw();
}

To lock a detail’s projection, set IsProjectionLocked to True. Here is an example.

Nice, thanks for your help. For information, this is what I did in vb.net:

 Dim pageview As Rhino.Display.RhinoPageView = TryCast(view, Rhino.Display.RhinoPageView)
  Dim detailview As Rhino.DocObjects.DetailViewObject = pageview.GetDetailViews(0)
    
        'Change the viewport to shadowed
pageview.SetActiveDetail(detailview.Attributes.ObjectId)
        Dim display_mode_description As Rhino.Display.DisplayModeDescription = Rhino.Display.DisplayModeDescription.FindByName("Shaded")
        Try
                 view.ActiveViewport.DisplayMode = display_mode_description
                 view.Redraw()
        Catch ex As Exception
        End Try
    
       'Lock the detail viewport
       detailview.DetailGeometry.IsProjectionLocked = True
       detailview.CommitChanges()
       detailview.CommitViewportChanges()

Hey,
I am doing the same thing but in C#, I cannot seem to lock the views of a layout.
If anyone can spot the issue here I would be very appreciative. I feel like I have basically the same code as what is shown above.

public static void LockAllDetails(RhinoDoc doc, RhinoPageView layout, bool locked)
        {
            layout.SetPageAsActive();
            doc.Views.ActiveView = layout;
            foreach (Rhino.DocObjects.DetailViewObject detail in layout.GetDetailViews())
            {
                // lock each detail in a loop //
                layout.SetActiveDetail(detail.Id);
                detail.DetailGeometry.IsProjectionLocked = true; // should be changed to locked //
                detail.CommitChanges();
                detail.CommitViewportChanges();
            }
            layout.SetPageAsActive();
            doc.Views.ActiveView = layout;
            doc.Views.Redraw();

        }

Thanks,
5chmidt