/// <summary> /// Draws the respecting Icon for this cell /// </summary> private void DrawIcon() { try { var container = new CellErrorInfoContainer(); container.SuspendLayout(); container.ElementHost.Child = new CellErrorInfo { DataContext = this, Visibility = Visibility.Visible, Opacity = 1.00 }; container.ElementHost.Child.UpdateLayout(); var vsto = Globals.Factory.GetVstoObject(Worksheet); controlName = Guid.NewGuid().ToString(); container.Visible = false; container.ResumeLayout(true); control = vsto.Controls.AddControl(container, Worksheet.Range[ShortLocation], controlName); control.Visible = false; control.Width = control.Height + 4; control.Placement = XlPlacement.xlMoveAndSize; control.AutoLoad = true; container.Visible = true; } catch (Exception ex) { Console.Out.WriteLine(ex.ToString()); } }
/// <summary> /// Draws the respecting Icon for this cell /// </summary> public void DrawIcon() { if (control == null) { try { var container = new CellErrorInfoContainer(); container.SuspendLayout(); container.ElementHost.Child = new CellErrorInfo { DataContext = this, Visibility = Visibility.Visible }; container.ResumeLayout(true); var vsto = Globals.Factory.GetVstoObject(Worksheet); controlName = Guid.NewGuid().ToString(); control = vsto.Controls.AddControl(container, Worksheet.Range[ShortLocation], controlName); control.Width = 13; control.Height = 13; } catch (Exception e) { Debug.WriteLine(e); } } }