public override void DestroyControlPane(Control pane) { //TODO: uncommet //ns.mainPan.onClosing(null); pane.Dispose(); }
private void AddDataControl(System.Type type) { if (m_owner == null) { return; } System.Windows.Forms.Control control = m_owner.Control; if (control != null) { control.Dispose(); } IDesignerHost h = (IDesignerHost)GetService(typeof(IDesignerHost)); DesignerTransaction dt = h.CreateTransaction("Add DataControl"); IComponentChangeService c = (IComponentChangeService)GetService(typeof(IComponentChangeService)); control = (System.Windows.Forms.Control)h.CreateComponent(type); c.OnComponentChanging(m_owner, null); m_owner.Control = control; c.OnComponentChanged(m_owner, null, null, null); dt.Commit(); m_owner.ResetLayout(); }
//TODO: Seems to fail on the build machine - commented out temporarily //[Test, TestCaseSource("PathNameTestData")] public void CalculatePreferedSizes(TestData tc) { FolderListItem item = new FolderListItem(tc.Path, FolderListItem.AllowSearch.None, false){MaxWidth = 50}; Control parent = new Control {Font = new Font(FontFamily.GenericMonospace, 10)}; item.Parent = parent; Assert.That(item.PreferredSize.Width, Is.EqualTo(tc.ExpectedWidth), "Width"); Assert.That(item.Path, Is.EqualTo(tc.Path), "Path"); parent.Dispose(); }
private void UnregisterControl(DiagramDocument circuitNode, Control control) { //it's OK if the CircuitEditingContext was already removed or wasn't added to IContextRegistry. _contextRegistry.RemoveContext(circuitNode.As<DiagramEditingContext>()); _hostService.UnregisterControl(control); control.Visible = false; control.Dispose(); _controls.Remove(circuitNode); }
//[ExpectedException(typeof(InvalidOperationException))] public void UIElementCannotBeWrappedAgainAfterWrapperDisposal() { Wf.Control wrapper = catalog.Wrap(uiElement); wrapper.Dispose(); Wf.Control wrapper2 = null; //Wf.Control wrapper2 = catalog.Wrap(uiElement); Assert.That(() => wrapper2 = catalog.Wrap(uiElement), Throws.TypeOf <InvalidOperationException>()); }
public void DisposedTest () { Control c = new Control (); // Test Disposed Event c.Disposed += new EventHandler (Event_Handler1); eventhandled = false; c.Dispose (); Assert.AreEqual (true, eventhandled, "#A7"); }
private void ClearTableLayoutTable(TableLayoutPanel pn) { while (pn.Controls.Count > 0) { System.Windows.Forms.Control subControl = pn.Controls[0]; pn.Controls.Remove(subControl); subControl.Dispose(); } }
public void FreeControl(Control control) { try { control.Dispose(); while (control.Controls.Count > 0) control.Controls[0].Dispose(); control = null; } catch (Exception ex) { CaughtException(ex); } }
// Node protected override void Activate() { Control = CreateControl(); try { _control.CausesValidation = false; InitializeControl(); InternalUpdateSource(); base.Activate(); } catch { if (_control != null) { _control.Dispose(); _control = null; } throw; } }
public void Dispose() { _Graphics = null; F = null; _TargetControl.Dispose(); _TargetControl = null; _SpriteBatch.Dispose(); _SpriteBatch = null; _Device.Dispose(); _Device = null; }
/// <summary> /// Release resource /// </summary> public virtual void RecursiveDispose(System.Windows.Forms.Control parentControl) { if (parentControl.Controls.Count > 0) { foreach (System.Windows.Forms.Control childControl in parentControl.Controls) { RecursiveDispose(childControl); } if (parentControl is AppUserControlBase) { (parentControl as AppUserControlBase).Dispose(); } parentControl.Dispose(); } else { if (parentControl is AppUserControlBase) { (parentControl as AppUserControlBase).Dispose(); } parentControl.Dispose(); } }
private void ClearPanelControls(int startRowIdx) { tableLayoutPanel.SuspendLayout(); try { for (int row = startRowIdx; row < tableLayoutPanel.RowCount; row++) { for (int column = 0; column < tableLayoutPanel.ColumnCount; column++) { if (row == 0 && column == 0) { continue; } System.Windows.Forms.Control ctrl = tableLayoutPanel.GetControlFromPosition(column, row); if (ctrl == null) { continue; } if (ctrl is TableLayoutPanel) { ClearTableLayoutTable(ctrl as TableLayoutPanel); } if (ctrl is PictureBox) { ctrl.Click -= RemoveControl_Click; } tableLayoutPanel.Controls.Remove(ctrl); ctrl.Dispose(); } } _rowCount = startRowIdx; tableLayoutPanel.RowCount = startRowIdx != 0 ? startRowIdx : 1; if (startRowIdx == 0) { tableLayoutPanel.Visible = false; } } finally { tableLayoutPanel.ResumeLayout(); } }
public void Dispose() { _dutyManagerService = default; isDisposing = true; StreamerClient = default; ScreenRenderer.Dispose(); ScreenRenderer = default; _hostControl.Dispose(); _hostControl = default; HostControlWrapper.SizeChanged -= ChangeRenderSize; HostControlWrapper.Dispose(); HostControlWrapper = default; }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } if (m_popedContainer != null) { System.Windows.Forms.Control _content = m_popedContainer; m_popedContainer = null; _content.Dispose(); } } base.Dispose(disposing); }
protected override void Activate() { Control = CreateControl(); try { UpdateColor(); SetParent(); InternalUpdateTitle(); InitializeControl(); base.Activate(); } catch { if (_control != null) { _control.Dispose(); _control = null; } throw; } }
public void GetChildAtPointTest () { Control c = null, d = null; TransparentControl e = null; try { c = new Control (); c.Name = "c1"; c.SetBounds (0, 0, 100, 100); d = new Control (); d.Name = "d1"; d.SetBounds (10, 10, 40, 40); c.Controls.Add (d); e = new TransparentControl (); e.Name = "e1"; e.SetBounds (55, 55, 10, 10); Control l = c.GetChildAtPoint (new Point (15, 15)); Assert.AreEqual (d.Name, l.Name, "Child1"); Assert.IsFalse (e.Name == l.Name, "Child2"); l = c.GetChildAtPoint (new Point (57, 57)); Assert.AreEqual (null, l, "Child3"); l = c.GetChildAtPoint (new Point (10, 10)); Assert.AreEqual (d.Name, l.Name, "Child4"); // GetChildAtPointSkip is not implemented and the following test is breaking for Net_2_0 profile #if NET_2_0 c.Controls.Add (e); e.Visible = false; l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible); Assert.IsNull (l, "Child5"); e.Visible = true; l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Invisible); Assert.AreSame (e.Name, l.Name, "Child6"); e.Enabled = false; l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Disabled); Assert.IsNull (l, "Child7"); e.Enabled = true; l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Disabled); Assert.AreSame (e.Name, l.Name, "Child8"); e.BackColor = Color.Transparent; l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Transparent); Assert.IsNull (l, "Child9"); e.BackColor = Color.Green; l = c.GetChildAtPoint (new Point (57, 57), GetChildAtPointSkip.Transparent); Assert.AreSame (e.Name, l.Name, "Child10"); #endif // NET_2_0 } finally { if (c != null) c.Dispose (); if (d != null) d.Dispose (); } }
public void FromHandleTest () { Control c1 = null; Control c2 = null; try { c1 = new Control (); c2 = new Control (); c1.Name = "parent"; c2.Name = "child"; c1.Controls.Add(c2); // Handle Assert.AreEqual (c1.Name, Control.FromHandle (c1.Handle).Name, "Handle1"); Assert.IsNull (Control.FromHandle (IntPtr.Zero), "Handle2"); // ChildHandle Assert.AreEqual (c1.Name, Control.FromChildHandle (c1.Handle).Name, "Handle3"); Assert.IsNull (Control.FromChildHandle (IntPtr.Zero), "Handle4"); } finally { if (c1 != null) c1.Dispose (); if (c2 != null) c2.Dispose (); } }
public void FindFormTest () { Form f = new Form (); f.ShowInTaskbar = false; f.Name = "form"; Control c = null; try { f.Controls.Add (c = new Control ()); Assert.AreEqual (f.Name, c.FindForm ().Name, "Find1"); f.Controls.Remove (c); GroupBox g = new GroupBox (); g.Name = "box"; f.Controls.Add (g); g.Controls.Add (c); Assert.AreEqual (f.Name, f.FindForm ().Name, "Find2"); g.Controls.Remove (c); Assert.IsNull(c.FindForm (), "Find3"); } finally { if (c != null) c.Dispose (); if (f != null) f.Dispose (); } }
public void NegativeHeightTest () { Control c = new Control (); IntPtr handle = c.Handle; c.Resize += new EventHandler(NegativeHeightTest_ResizeHandler); c.Tag = -2; c.Height = 2; c.Height = -2; Assert.AreEqual (0, (int) c.Tag, "#1"); c.Dispose (); Assert.AreEqual (handle, handle, "Removes warning."); }
public void Draw() { // Scale if needed. if (ScaleX != 1f || ScaleY != 1f) UnityEngine.GUI.matrix = UnityEngine.Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(0, Vector3.up), new Vector3(ScaleX, ScaleY, 1)); GUI.color = Color.white; _paintEventArgs.Graphics.FillRate = 0; for (int i = 0; i < Forms.Count; i++) if (Forms[i].Visible) Forms[i].RaiseOnPaint(_paintEventArgs); for (int i = 0; i < ModalForms.Count; i++) if (ModalForms[i].Visible) ModalForms[i].RaiseOnPaint(_paintEventArgs); for (int i = 0; i < Contexts.Count; i++) if (Contexts[i].Visible) Contexts[i].RaiseOnPaint(_paintEventArgs); FillRate = _paintEventArgs.Graphics.FillRate; if (_dragRender != null && _dragndrop) { System.Drawing.Graphics g = new System.Drawing.Graphics(); Control _dragRenderControl = new Control(); g.Control = _dragRenderControl; _dragRender.Invoke(g); _dragRenderControl.Dispose(); } // ToolTip. ToolTip.OnPaint(_paintEventArgs); var cursor = Cursor.CurrentSystem ?? Cursor.Current; cursor.Draw(_paintEventArgs.Graphics, new Drawing.Rectangle( Control.MousePosition.X, Control.MousePosition.Y, (int)(cursor.Size.Width / ScaleX), (int)(cursor.Size.Height / ScaleY))); }
protected void Remove(Control palent, Control self) { if (self != null){ _controlCounter--; if (palent != null){ // ownerがnullの場合は、非表示(デバッグモード) palent.Controls.Remove(self); self.Dispose(); } } //RemoveListener(); // リスナーも削除する }
public override void DestroyControlPane(System.Windows.Forms.Control pane) => pane.Dispose();
void SessionThreadStart() { Monitor.Enter(sessionThread); { try { sessionThreadControl = new Control(); sessionThreadControl.CreateControl(); session = TtlLiveSingleton.Get(); dataTimer = new Timer(); dataTimer.Interval = 100; dataTimer.Tick += new EventHandler(dataTimer_Tick); notificationTimer = new Timer(); notificationTimer.Interval = 100; notificationTimer.Tick += new EventHandler(notificationTimer_Tick); notificationTimer.Start(); } catch (Exception ex) { sessionThreadInitException = ex; TtlLiveSingleton.Dispose(); } Monitor.Pulse(sessionThread); } Monitor.Exit(sessionThread); //Create a message pump for this thread Application.Run(applicationContext); //Dispose of all stuff on this thread dataTimer.Stop(); dataTimer.Dispose(); notificationTimer.Stop(); notificationTimer.Dispose(); TtlLiveSingleton.Dispose(); sessionThreadControl.Dispose(); return; }
private void OnExit() { m_form.Dispose(); }
public void UIElementCannotBeWrappedAgainAfterWrapperDisposal() { Wf.Control wrapper = catalog.Wrap(uiElement); wrapper.Dispose(); Wf.Control wrapper2 = catalog.Wrap(uiElement); }
private void CleanAlbumControls(System.Windows.Forms.Control control) { control.Dispose(); panel.Controls.Remove(control); }
private void DisposeControl(Control Control) { if (Control.InvokeRequired) { var d = new DisposeControlDelegate(DisposeControl); this.Invoke(d, Control); } else { Control.Dispose(); } }
void CreateControl () { try { f = new Form (); f.ShowInTaskbar = false; c = new Control (); f.Controls.Add (c); Console.WriteLine ("f.Handle = {0}", f.Handle); Console.WriteLine ("c.Handle = {0}", c.Handle); control_context = new ApplicationContext (f); Monitor.Enter (m); Console.WriteLine ("pulsing"); Monitor.Pulse (m); Monitor.Exit (m); Console.WriteLine ("control thread running"); Application.Run (control_context); c.Dispose (); Console.WriteLine ("dying"); threadDied = true; Monitor.Enter (m); Console.WriteLine ("pulsing again"); Monitor.Pulse (m); Monitor.Exit (m); } catch (Exception e) { Console.WriteLine (e); } }
public void WM_PARENTNOTIFY_Test () { WMTester tester; Control child; int child_handle; tester = new WMTester (); child = new Control (); tester.Controls.Add (child); tester.Visible = true; child.Visible = true; child_handle = child.Handle.ToInt32 (); ArrayList msgs; Message m1; msgs = tester.Find (WndMsg.WM_PARENTNOTIFY); Assert.AreEqual (1, msgs.Count, "#1"); m1 = (Message) msgs [0]; Assert.AreEqual (WndMsg.WM_CREATE, ((WndMsg) LowOrder (m1.WParam)), "#2"); //Assert.AreEqual (child.Identifier??, HighOrder (m1.WParam), "#3"); Assert.AreEqual (child_handle, m1.LParam.ToInt32 (), "#4"); child.Dispose (); msgs = tester.Find (WndMsg.WM_PARENTNOTIFY); Assert.AreEqual (2, msgs.Count, "#5"); m1 = (Message) msgs [1]; Assert.AreEqual (WndMsg.WM_DESTROY, ((WndMsg) LowOrder (m1.WParam)), "#6"); //Assert.AreEqual (child.Identifier??, HighOrder (m1.WParam), "#7"); Assert.AreEqual (child_handle, m1.LParam.ToInt32 (), "#8"); tester.Dispose (); }
public void TestPublicMethods () { // Public Methods that force Handle creation: // - CreateControl () // - CreateGraphics () // - GetChildAtPoint () // - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created // - PointToClient () // - PointToScreen () // - RectangleToClient () // - RectangleToScreen () Control c = new Control (); c.BringToFront (); Assert.IsFalse (c.IsHandleCreated, "A1"); c.Contains (new Control ()); Assert.IsFalse (c.IsHandleCreated, "A2"); c.CreateControl (); Assert.IsTrue (c.IsHandleCreated, "A3"); c = new Control (); Graphics g = c.CreateGraphics (); g.Dispose (); Assert.IsTrue (c.IsHandleCreated, "A4"); c = new Control (); c.Dispose (); Assert.IsFalse (c.IsHandleCreated, "A5"); c = new Control (); //DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None); //Assert.IsFalse (c.IsHandleCreated, "A6"); //Assert.AreEqual (DragDropEffects.None, d, "A6b"); //Bitmap b = new Bitmap (100, 100); //c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100)); //Assert.IsFalse (c.IsHandleCreated, "A7"); //b.Dispose (); c.FindForm (); Assert.IsFalse (c.IsHandleCreated, "A8"); c.Focus (); Assert.IsFalse (c.IsHandleCreated, "A9"); c.GetChildAtPoint (new Point (10, 10)); Assert.IsTrue (c.IsHandleCreated, "A10"); c.GetContainerControl (); c = new Control (); Assert.IsFalse (c.IsHandleCreated, "A11"); c.GetNextControl (new Control (), true); Assert.IsFalse (c.IsHandleCreated, "A12"); #if NET_2_0 c.GetPreferredSize (Size.Empty); Assert.IsFalse (c.IsHandleCreated, "A13"); #endif c.Hide (); Assert.IsFalse (c.IsHandleCreated, "A14"); c.Invalidate (); Assert.IsFalse (c.IsHandleCreated, "A15"); //c.Invoke (new InvokeDelegate (InvokeMethod)); //Assert.IsFalse (c.IsHandleCreated, "A16"); c.PerformLayout (); Assert.IsFalse (c.IsHandleCreated, "A17"); c.PointToClient (new Point (100, 100)); Assert.IsTrue (c.IsHandleCreated, "A18"); c = new Control (); c.PointToScreen (new Point (100, 100)); Assert.IsTrue (c.IsHandleCreated, "A19"); c = new Control (); //c.PreProcessControlMessage ??? //c.PreProcessMessage ??? c.RectangleToClient (new Rectangle (0, 0, 100, 100)); Assert.IsTrue (c.IsHandleCreated, "A20"); c = new Control (); c.RectangleToScreen (new Rectangle (0, 0, 100, 100)); Assert.IsTrue (c.IsHandleCreated, "A21"); c = new Control (); c.Refresh (); Assert.IsFalse (c.IsHandleCreated, "A22"); c.ResetBackColor (); Assert.IsFalse (c.IsHandleCreated, "A23"); c.ResetBindings (); Assert.IsFalse (c.IsHandleCreated, "A24"); c.ResetCursor (); Assert.IsFalse (c.IsHandleCreated, "A25"); c.ResetFont (); Assert.IsFalse (c.IsHandleCreated, "A26"); c.ResetForeColor (); Assert.IsFalse (c.IsHandleCreated, "A27"); c.ResetImeMode (); Assert.IsFalse (c.IsHandleCreated, "A28"); c.ResetRightToLeft (); Assert.IsFalse (c.IsHandleCreated, "A29"); c.ResetText (); Assert.IsFalse (c.IsHandleCreated, "A30"); c.SuspendLayout (); Assert.IsFalse (c.IsHandleCreated, "A31"); c.ResumeLayout (); Assert.IsFalse (c.IsHandleCreated, "A32"); #if NET_2_0 c.Scale (new SizeF (1.5f, 1.5f)); Assert.IsFalse (c.IsHandleCreated, "A33"); #endif c.Select (); Assert.IsFalse (c.IsHandleCreated, "A34"); c.SelectNextControl (new Control (), true, true, true, true); Assert.IsFalse (c.IsHandleCreated, "A35"); c.SetBounds (0, 0, 100, 100); Assert.IsFalse (c.IsHandleCreated, "A36"); c.Update (); Assert.IsFalse (c.IsHandleCreated, "A37"); }
/// <summary> /// Thread safe version to call the <see cref="Component.Dispose()"/> method /// </summary> /// <param name="control">A <see cref="Control"/> that should be disposed.</param> public static void Dispose(Control control) { if (control == null) { throw new ArgumentNullException("control"); } if (control.InvokeRequired) { control.Invoke(new MethodInvoker(control.Dispose)); return; } control.Dispose(); }
public void DeleteIndicatoronPanel(int indexIndicator, Control control) { WorkingEnvironmentFunction.RemoveItemDatatableProperties(indexIndicator, tbControlPanelAssignment); WorkingEnvironmentFunction.UnSubscribeObjectTreeview(controlName, controlCategory, treeViewSolutionList); panelIndicator.Controls.Remove(control); control.Dispose(); WorkingEnvironmentFunction.DisposingObject(this); }
static void DisposeControl(ref Control control) { if (control != null) { control.Dispose(); control = null; } }
internal void HideEditor(Control editor) { editor.Validating -= EditorValidating; editor.Parent = null; editor.Dispose(); _editNode = null; _editor = null; OnEditorHidden(); }
public void PerformInductionMethod(Control control) { try { //if (control == null) return; if (!UserHasAccess(control.Name)) { control.Dispose(); return; } var arrControlHasType = (from dr in dtFormControl.AsEnumerable() where dr.Field<string>(LFormControl.Columns.FormName).Equals(FormName) & dr.Field<string>(LFormControl.Columns.ControlName).Equals(control.Name) & !string.IsNullOrEmpty(Utility.sDbnull(dr.Field<object>(LFormControl.Columns.ControlTypeName))) select dr).ToList(); string[] arrItem_Name = new string[] { }; if (control.Name == "tabTestInfo") { Console.WriteLine(control.Name); } if (arrControlHasType.Count <= 0) { //arrItem_Name = (from ctrl in control.Controls.Cast<Control>() select ctrl.Name).ToArray(); var arrControl = (from ctrl in control.Controls.Cast<Control>() select ctrl).ToList(); //List<Control> listControlName = new List<string>(); //foreach (Control ctrl in control.Controls) //{ // listControlName.Add(ctrl.Name); //} foreach (Control ctrl in arrControl) { PerformInductionMethod(ctrl); } return; } switch (Utility.sDbnull(arrControlHasType[0][LFormControl.Columns.ControlTypeName]).ToUpper()) { case "WIN.TOOLSTRIP": ToolStrip toolStrip = (ToolStrip)control; arrItem_Name = (from item in toolStrip.Items.Cast<ToolStripItem>() where !UserHasAccess(item.Name) select item.Name).ToArray(); foreach (string item_Name in arrItem_Name) { toolStrip.Items[item_Name].Dispose(); } break; case "WIN.CONTEXTMENUSTRIP": if (!arrAllowed_Control_Name.Contains(control.Name)) arrItem_Name = (from item in control.ContextMenuStrip.Items.Cast<ToolStripItem>() where item !=null select item.Name).ToArray(); //else arrItem_Name = (from item in control.ContextMenuStrip.Items.Cast<ToolStripItem>() // where arrControl_Name.Contains(item.Name) & !arrAllowed_Control_Name.Contains(item.Name) // select item.Name).ToArray(); foreach (string item_Name in arrItem_Name) { control.ContextMenuStrip.Items[item_Name].Enabled = false; } break; } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void ShowTopLevel(Control control, object[] propertyObjects, bool modal, Action<Form> shownAction) { //if (TestContext.CurrentContext.Test.Properties["_CATEGORIES"]) ThrowIfPropertyObjectsContainsActionDueToLikelyMisuse(propertyObjects); GuiTestHelper.Initialize(); formShown = shownAction; if (control.TopLevelControl == control) { ShowTopLevelControl(control, modal); } else { ShowControlInTestForm(control, modal, propertyObjects); } // clear all controls shown as non-modal after modal control closes if (!modal) { var testName = TestContext.CurrentContext.Test.FullName; if (string.IsNullOrEmpty(nonModalControlsTestName)) { nonModalControlsTestName = testName; } else { if (nonModalControlsTestName != testName) { var errorMessage = string.Format("Did you forget to call WindowsFormsTestHelper.CloseAll() at the end of the following test: {0}?", nonModalControlsTestName); nonModalControlsTestName = testName; // reset for the next test throw new InvalidOperationException(errorMessage); } } nonModalControls.Add(this); } else { CloseAll(); Close(); Dispose(); control.Dispose(); } }
public virtual void DisposeControl(Control comp, DiagramView view) { if ((comp != null) && (view != null)) { if (view.EditControl != this) { view.RemoveDiagramControl(this, comp); comp.Dispose(); } else { comp.Visible = false; } } }
private void WriteTo(IndentedTextWriter writer, Layout selectedLayout) { if (selectedLayout == null || !selectedLayout.hasLayout()) return; var xscale = specs.desiredWidth/selectedLayout.Dimensions.Width; var yscale = specs.desiredHeight/selectedLayout.Dimensions.Height; var scale = Math.Min(xscale, yscale); var papersize = Enum.GetName(typeof (papersize), specs.size); var orientation = specs.desiredWidth > specs.desiredHeight ? "landscape" : "portrait"; writer.WriteLine("% This TeX file was generated by SBML2TikZ Version: {0}", Assembly.GetExecutingAssembly().GetName().Version); writer.WriteLine("\\documentclass{article}"); writer.WriteLine("\\usepackage{tikz}"); writer.WriteLine("\\usepackage{pgf}"); writer.WriteLine("\\usepackage[total={{{0}pt,{1}pt}}, centering, {2}, {3}]{{geometry}}", specs.desiredWidth, specs.desiredHeight, papersize, orientation); writer.WriteLine("\\pagestyle{empty}"); writer.WriteLine("\\begin{document}"); writer.WriteLine("\\begin{center}"); writer.WriteLine("\\begin{{tikzpicture}}[xscale = {0}, yscale = -{1}]", xscale, yscale); writer.WriteLine("{"); // _layout._EmlRenderInformation is a list of LocalRenderInformation // Each LocalRenderInformation has lists of GradientDefinitions, ColorDefinitions & LineEndings // It also contains a list of Styles // Each Style can be applied to items that share a role with its rolelist or a type with its typelist // Presently we do not need to worry about GlobalRenderInformation as it is dealt with by the // RenderInformation.GetStyleForObject, although this may be revised // if there are more than one renderinformation objects, we need to ask the user to pick one // in order to use some of the classes in the EmlRenderExtension we need a Graphics object var dummyControl = new Control(); try { var g = dummyControl.CreateGraphics(); DefineColorsAndGradients(selectedLayout._EmlRenderInformation[0].ColorDefinitions, selectedLayout._EmlRenderInformation[0].GradientDefinitions, selectedLayout._EmlRenderInformation[0], writer); foreach (var glyph in selectedLayout.CompartmentGlyphs) { glyphToTex(glyph, selectedLayout, writer, g, scale); } foreach (var glyph in selectedLayout.ReactionGlyphs) { glyphToTex(glyph, selectedLayout, writer, g, scale); } foreach (var glyph in selectedLayout.SpeciesGlyphs) { glyphToTex(glyph, selectedLayout, writer, g, scale); } foreach (var glyph in selectedLayout.TextGlyphs) { glyphToTex(glyph, selectedLayout, writer, g, scale); } foreach (var glyph in selectedLayout.AdditionalGraphicalObjects) { glyphToTex(glyph, selectedLayout, writer, g, scale); } writer.WriteLine("}"); writer.WriteLine("\\end{tikzpicture}"); writer.WriteLine("\\end{center}"); writer.WriteLine("\\end{document}"); } finally { //TODO: you are creating a control, to obtain a graphics handle, but then dispose the control, // so this handle is invalid! dummyControl.Dispose(); } }
/// <summary> /// Unregisters the Control from the IContextRegistry and IControlHostService and disposes /// it and sets the circuitNode's ViewingContext's Control property to null.</summary> private void UnregisterControl(DomNode circuitNode, Control control) { //it's OK if the CircuitEditingContext was already removed or wasn't added to IContextRegistry. m_contextRegistry.RemoveContext(circuitNode.As<CircuitEditingContext>()); m_controlHostService.UnregisterControl(control); control.Visible = false; control.Dispose(); m_circuitNodeControls.Remove(circuitNode); circuitNode.Cast<ViewingContext>().Control = null; }
public void ReadValueTest () { Control c = new Control (); c.BindingContext = new BindingContext (); c.CreateControl (); ChildMockItem item = new ChildMockItem (); item.ObjectValue = "A"; Binding binding = new Binding ("Tag", item, "ObjectValue"); binding.ControlUpdateMode = ControlUpdateMode.Never; c.DataBindings.Add (binding); Assert.AreEqual (null, c.Tag, "#A1"); item.ObjectValue = "B"; Assert.AreEqual (null, c.Tag, "#B1"); binding.ReadValue (); Assert.AreEqual ("B", c.Tag, "#C1"); item.ObjectValue = "C"; binding.ReadValue (); Assert.AreEqual ("C", c.Tag, "#D1"); c.Dispose(); }
private static void GuiControlAsync(Control ctrl, string cmd, string arg) { cmd = cmd.ToLowerInvariant(); switch (cmd) { case Keyword_Text: if (ctrl is TextBox) arg = NormaliseEol(arg); ctrl.Text = arg; break; case "": { if (ctrl is ProgressBar || ctrl is TrackBar || ctrl is NumericUpDown) { int argAsInt; if (int.TryParse(arg, out argAsInt)) SafeSetProperty(ctrl, "Value", argAsInt); } else { if (ctrl is DateTimePicker) { DateTime argAsDateTime = ToDateTime(arg); if (!(string.IsNullOrEmpty(arg))) SafeSetProperty(ctrl, "Value", argAsDateTime); else SafeSetProperty(ctrl, "Value", DateTime.Now); } else { if (ctrl is ComboBox) { if (SubStr(arg, 1, 1) == "|") ((ComboBox) ctrl).Items.Clear(); arg = SubStr(arg, 2, StrLen(arg) - 1); string[] argAsStringArray = arg.Split('|'); foreach (string s in argAsStringArray) ((ComboBox) ctrl).Items.Add(s); } else { if (ctrl is PictureBox) { if (File.Exists(arg)) { try { SafeSetProperty(ctrl, "ImageLocation", arg); } catch (Exception) { } } } else { if (ctrl is WebBrowser) { ((WebBrowser) ctrl).Navigate(arg); } else { if (ctrl is ListBox) { if (SubStr(arg, 1, 1) == "|") ((ListBox) ctrl).Items.Clear(); arg = SubStr(arg, 2, StrLen(arg) - 1); string[] argAsStringArray = arg.Split('|'); foreach (string s in argAsStringArray) ((ListBox) ctrl).Items.Add(s); } else { arg = NormaliseEol(arg); SafeSetProperty(ctrl, "Text", arg); } } } } } } } break; case Keyword_Move: case Keyword_MoveDraw: GuiControlMove(arg, ctrl); break; case Keyword_Focus: ctrl.Focus(); break; case Keyword_Enable: ctrl.Enabled = true; break; case Keyword_Disable: ctrl.Enabled = false; break; case Keyword_Hide: ctrl.Visible = false; break; case Keyword_Show: ctrl.Visible = true; break; case Keyword_Delete: ctrl.Parent.Controls.Remove(ctrl); ctrl.Dispose(); break; case Keyword_Choose: // UNDONE: choose item for gui control break; case Keyword_Font: // TODO: change control font break; default: int n; if (cmd.StartsWith(Keyword_Enable) && int.TryParse(cmd.Substring(Keyword_Enable.Length), out n) && (n == 1 || n == 0)) ctrl.Enabled = n == 1; if (cmd.StartsWith(Keyword_Disable) && int.TryParse(cmd.Substring(Keyword_Disable.Length), out n) && (n == 1 || n == 0)) ctrl.Enabled = n == 0; GuiApplyExtendedStyles(ctrl, arg); break; } }
internal void HideEditor(Control editor) { editor.Validating -= new CancelEventHandler(EditorValidating); editor.Parent = null; editor.Dispose(); _editNode = null; OnEditorHided(); }
public void RemoveNotification(Control control) { pnlDialog.Controls.Remove(control); notifications.Remove(control); control.Dispose(); if (notifications.HasNext) { pnlDialog.Visible = true; Control active = notifications.Next; active.Visible = true; ResizeNotificationByControl(active); } else { pnlDialog.Visible = false; } btnDialogNextControl.Visible = notifications.Count > 1; }
public override void DestroyControlPane(Control pane) { ns.mainPan.onClosing(null); pane.Dispose(); }