Eyeshot issues with DevExpress controls

Issue 1: RibbonForm

When using Eyeshot control inside a DevExpress RibbonForm, sometimes the Eyeshot control disappears due to missing
Paint messages.

This problem was discussed in this thread 

http://www.devexpress.com/Support/Center/p/B131736.aspx

and can be resolved by adding the following overridden property to the RibbonForm

protected override bool SupportAdvancedTitlePainting 
{ 
   get { return false; } 
}

 

Issue 2: MDI

When creating MDI forms, especially with Hardware Acceleration disabled (as is the case when using a Virtual Machine or a Terminal Server connection) and in Tabbed layout, the Eyeshot graphics may be clipped (see picture below).

Capture.PNG

To fix it is necessary to force a resize of the control, by modifying the Form containing the Eyeshot control like this:

protected override void OnShown(EventArgs e) 
{  
    base.OnShown(e);  
    ResizeVP();  
}  

public void ResizeVP() 
{  
    singleViewportLayout1.Visible = false;  
    Size mySize = singleViewportLayout1.Size;  
    singleViewportLayout1.Size = new Size(mySize.Width - 1, mySize.Height - 1); 
    Application.DoEvents();  
    singleViewportLayout1.Size = mySize;  
    singleViewportLayout1.Visible = true;  
}

 

If the Eyeshot control is inside a UserControl, then it is necessary to force the resize of the control by subscribing TabbedView's events like showed here below:

public Form1()
{
     InitializeComponent();

     tabbedView1.DocumentActivated += tabbedView1_DocumentActivated;
     tabbedView1.Paint += tabbedView1_Paint;
}

private bool refreshVP = false;

void tabbedView1_Paint(object sender, PaintEventArgs e)
{
      if (refreshVP) 
      {
            var documents = ((DevExpress.XtraBars.Docking2010.Views.Tabbed.TabbedView)sender).Documents;

            foreach (var doc in documents)
            {
                if (doc.Control is MyUserControl)
                {                    
                    ((MyUserControl)doc.Control).ResizeVP();
                }
            }

            refreshVP = false;
       }
}

private void tabbedView1_DocumentActivated(object sender, DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs e)
{
     refreshVP = true;
}

  

Issue 3: MDI on NVidia

With NVidia cards it may happen that when closing a Document of a TabbedView with Eyeshot control inside, even if the control is properly disposed and its graphics resources are freed on the tabbed view remains the frozen graphics of the Eyeshot control. This does not go away until a new Eyeshot control is created (for instance adding a new tab page). It even goes outside the Form borders if it's resized.

To avoid this issue you can subscribe to the DocumentClosing event of the tabbed view, and right before closing do a resize to 1x1 dimension of the Eyeshot control:

private void Form1_Load(object sender, EventArgs e) 
{ 
    // ... 
    tabbedView1.DocumentClosing += new DevExpress.XtraBars.Docking2010.Views.DocumentCancelEventHandler(tabbedView1_DocumentClosing); 
} 

void tabbedView1_DocumentClosing(object sender, DevExpress.XtraBars.Docking2010.Views.DocumentCancelEventArgs e) 
{             
    // MyUserControl is the user control with the Eyeshot control inside 
    devDept.Eyeshot.ViewportLayout vp = ((MyUserControl)e.Document.Control).viewportLayout1; 
    vp.Size = new Size(1, 1); 
}
Have more questions? Submit a request

3 Comments

  • 0
    Avatar
    Mustafa Tan

    That fixed it. Thank you

  • 0
    Avatar
    Deni Frigo

    I can not find the Sub OnShown (EventArgs e) in vb.net

    can you help me

    Deni Frigo

  • 0
    Avatar
    M Pellizzari

    Encountered "issue 3" while using a ViewportLayout in a WindowsForms project.

    VL is embedded in a stock TableLayoutPanel, shown inside a dialog form.

    The only working solution was adding a new invisible ViewportLayout to the parent form controls after the dialog had been closed.

Please sign in to leave a comment.