none
UserControl randomly refusing to paint RRS feed

  • Question

  • I have a UserControl that appears on the right side of an email compose window. Normally, this usercontrol works fine. But in the case that it is being run in a Windows 7 environment(originally developed for office 2007 in winXP environment), and the compose email window is launched externally, (from MS Word > Save and Send), the UserControl randomly (about 1/2 occurences) will appear blank. It will still report that the controls within the UserControl are all there, all visible, and all their positions are even correct, but the UserControl pane will appear blank. The 'OnPaint' event handler will also not fire when this occurs.

     

    Given the extremely niche nature of this request, I understand that I will probably never get an answer, but at least sometime in the future, somebody will know that someone on the planet once had this issue.

    Wednesday, April 6, 2011 1:55 AM

Answers

  • I created 4 test projects to try and narrow down what the real issue is.

    In the final project I created, the entire program was empty except for a usercontrol with a 'click me!' button on it that does nothing, and a ribbon(visual designer) class with the following managed code :

     private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
     {
      var insp = this.Context as Inspector;
      taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new UserControl1(), "test", insp);
     }
     
     private void toggleButton1_Click(object sender, RibbonControlEventArgs e)
     {
      CustomTaskPane uc = taskPane;
      uc.Visible = Globals.Ribbons[(Inspector)this.Context].Ribbon1.toggleButton1.Checked;
     }
    

    the pane still randomly does not draw.


    • Marked as answer by Kit C Monday, April 11, 2011 10:42 PM
    Monday, April 11, 2011 10:42 PM

All replies

  • Hi Kit,

    what happens when you resize the Compose-Window? Does it redraw then?


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    Wednesday, April 6, 2011 5:34 AM
    Answerer
  • no, dragging it around and resizing doesn't do anything either. Clicking within the white space also doesn't do anything, so maybe there is more to this than a drawing problem. Unless objects need to be drawn first to interact with them.
    Wednesday, April 6, 2011 9:38 PM
  • Then I would say something is going wrong and the usercontrol raises an exception internaly and is not loaded.
    Try to implement some Error-Logging to see what's happening.

    Try/Catch and logging in in contructor and user_control loaded.

    Maybe you try to access something that is not there on the machine. Maybe it's a path. Are you on a 64bit/32bit machine?

    Greets - Helmut

     


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    Thursday, April 7, 2011 6:03 AM
    Answerer
  • The test PC is win7 32bit running Outlook 2007. winXP 32bit running the same plugin won't have the issue.

     

    Where should I be putting this try catch? when I create a new instance of the UserControl?

    Thursday, April 7, 2011 9:50 PM
  • Hello Kit,

    I would do it in the constructor of the usercontrol

    and in the usercontrol_Load event (if you are using this event)

    Greets - Helmut


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    Thursday, April 7, 2011 9:56 PM
    Answerer
  • I'm a bit puzzled by this, I thought try-catch only caught exceptions from code that run within the scope? Do you mean one of the methods within the constructor is causing it? I would think if there is an error in the UserControl class, the method of catching it would be different.

     

    Well I ran the addin with messageboxes printing all error messages in the catch block, nothing came up when the panes would not paint.

    Thursday, April 7, 2011 10:10 PM
  • Hi Kit,

    yes - I would say it's a code in the USerControl that causes an error.
    I don't know something about the usercontrol.

    Maybe there's a Try/Catch already and some code isn't executed.

    When the control is drawn sometimes and sometimes not - then it's also not an error the environment.
    Maybe it's a timing problem.

    Greets - Helmut


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    Thursday, April 7, 2011 10:37 PM
    Answerer
  • If it isn't too much trouble, can you elaborate about 'timing problem's?

     

    Do you think this issue has nothing to do with the OS?

    Thursday, April 7, 2011 11:30 PM
  • Hi Kit,

    yes I think it has nothing todo with OS or VSTO. I would say the code behind the Usercontrol has a problem.
    I would say it's in the initialisation code of the usercontrol.

    But it's just where I would start to debug and analyze.
    Where doese the data come? How doese it behave when null or wrong data comes?

    Create a very simple usercontrol and show this instead and see if the problem remains.

    This is how I would start investigating.

    Greets - Helmut


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    Friday, April 8, 2011 5:22 AM
    Answerer
  • well, the constructor has a giant try catch around it that pops up a messagebox with exception data is anything is caught, the Load handler is empty, and the designer is purely generated.

    no errors are being reported on blank UserControl.

     

    I'm still trying, but the it feels pretty hopeless
    Monday, April 11, 2011 4:51 AM
  • I created 4 test projects to try and narrow down what the real issue is.

    In the final project I created, the entire program was empty except for a usercontrol with a 'click me!' button on it that does nothing, and a ribbon(visual designer) class with the following managed code :

     private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
     {
      var insp = this.Context as Inspector;
      taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new UserControl1(), "test", insp);
     }
     
     private void toggleButton1_Click(object sender, RibbonControlEventArgs e)
     {
      CustomTaskPane uc = taskPane;
      uc.Visible = Globals.Ribbons[(Inspector)this.Context].Ribbon1.toggleButton1.Checked;
     }
    

    the pane still randomly does not draw.


    • Marked as answer by Kit C Monday, April 11, 2011 10:42 PM
    Monday, April 11, 2011 10:42 PM