public static void WriteToConsole() { InitTable(); System.Windows.Forms.Form f = new System.Windows.Forms.Form(); System.Windows.Forms.ListBox lb = new System.Windows.Forms.ListBox(); f.Controls.Add(lb); lb.Dock = System.Windows.Forms.DockStyle.Fill; foreach (string k in streams.Keys) { StreamItem si = streams[k] as StreamItem; string add = k; if (si != null) { add += " [" + si.StreamState + "]"; } if (IsLocked(k, false)) { add = "[locked] " + add; } else if (IsLocked(k, true)) { add = "[ftlocked] " + add; } if (PackageMaintainer.Maintainer.Contains(k)) { add += "[managed]"; } lb.Items.Add(add); } lb.Sorted = true; f.ShowDialog(); f.Dispose(); }
public void Do(System.Windows.Forms.Form from) { closeable.Dispose(); closeable.Close(); NavigableFormUtil.BackwardTo(from, new LoginForm()); }
public static void BackwardTo(System.Windows.Forms.Form from, System.Windows.Forms.Form backTo) { from.Dispose(); from.Close(); backTo.Show(); }
public override void Dispose() { if (mFakeWindow != null) { mFakeDisplayWindow.Dispose(); mFakeWindow.Dispose(); } mDevice.Dispose(); }
protected override void CloseForm() { if (_form == null) { return; } _form.Close(); _form.Dispose(); _form = null; }
/*******************************/ /// <summary> /// Recieves a form and an integer value representing the operation to perform when the closing /// event is fired. /// </summary> /// <param name="form">The form that fire the event.</param> /// <param name="operation">The operation to do while the form is closing.</param> public static void CloseOperation(System.Windows.Forms.Form form, int operation) { switch (operation) { case 0: break; case 1: form.Hide(); break; case 2: form.Dispose(); break; case 3: form.Dispose(); System.Windows.Forms.Application.Exit(); break; } }
private string SpawnMessageBox(string label) { var dialog = new System.Windows.Forms.Form() { Height = 105, Width = 340, StartPosition = System.Windows.Forms.FormStartPosition.CenterParent, FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog, MaximizeBox = false, MinimizeBox = false, }; var textLabel = new System.Windows.Forms.Label() { Left = 0, Top = 0, Width = 320, Text = label, TextAlign = System.Drawing.ContentAlignment.MiddleCenter }; var textBox = new System.Windows.Forms.TextBox() { Left = 10, Top = 20, Width = 300 }; var cancelButton = new System.Windows.Forms.Button() { Text = "Cancel", Left = 70, Width = 80, Top = 40, DialogResult = System.Windows.Forms.DialogResult.Cancel }; var confirmButton = new System.Windows.Forms.Button() { Text = "Ok", Left = 170, Width = 80, Top = 40, DialogResult = System.Windows.Forms.DialogResult.OK }; cancelButton.Click += (s, e) => { dialog.Close(); }; confirmButton.Click += (s, e) => { dialog.Close(); }; dialog.Controls.Add(textBox); dialog.Controls.Add(textLabel); dialog.Controls.Add(cancelButton); dialog.Controls.Add(confirmButton); dialog.CancelButton = cancelButton; dialog.AcceptButton = confirmButton; string userInput; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { userInput = textBox.Text; } else { userInput = null; } dialog.Dispose(); return(userInput); }
public void GetDrugInfo() { using (BaseFunctionForm bf = new Pharmacy.AppClient.UI.BaseFunctionForm()) { if (this.DrugId == Guid.Empty && this.DrugInventoryId != Guid.Empty) { var div = bf.PharmacyDatabaseService.GetDrugInventoryRecord(out msg, this.DrugInventoryId); this.DrugId = div.DrugInfoId; } var di = bf.PharmacyDatabaseService.GetDrugInfo(out msg, this.DrugId); if (di == null) { return; } if (di.BusinessScopeCode.Contains("医疗器械")) { Forms.BaseDataManage.FormInstrument frm = new BaseDataManage.FormInstrument(); frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; frm.entity = di; Common.SetControls.SetControlReadonly(frm, true); frm.ShowDialog(); return; } if (di.BusinessScopeCode.Contains("保健食品")) { Forms.BaseDataManage.FormFood frm = new BaseDataManage.FormFood(); frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; frm.entity = di; Common.SetControls.SetControlReadonly(frm, true); frm.ShowDialog(); return; } UI.UserControls.ucGoodsInfo ucControl = new UserControls.ucGoodsInfo(di); System.Windows.Forms.Form f = new System.Windows.Forms.Form(); f.WindowState = System.Windows.Forms.FormWindowState.Normal; f.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; f.Text = di.ProductGeneralName; f.AutoSize = true; f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; System.Windows.Forms.Panel p = new System.Windows.Forms.Panel(); p.AutoSize = true; p.Controls.Add(ucControl); f.Controls.Add(p); Forms.Common.SetControls.SetControlReadonly(f, true); f.ShowDialog(); f.Dispose(); } }
private void ShowImageDialog(Image image) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); System.Windows.Forms.PictureBox pbox = new System.Windows.Forms.PictureBox(); pbox.Dock = System.Windows.Forms.DockStyle.Fill; pbox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; pbox.Image = image; form.Controls.Add(pbox); form.Size = new Size(300, 300); form.ControlBox = false; pbox.DoubleClick += new EventHandler(pbox_DoubleClick); form.ShowDialog(); form.Dispose(); }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (syncForm != null) { syncForm.Dispose(); } } disposed = true; } }
public void BasicInvokeTest() { SetupForSubmissionTest(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); form.Controls.Add(panel); // needed else DataGrid does not initialize form.Show(); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form, null); LayoutDetails.Instance.SystemLayout = new Layout.LayoutPanel(CoreUtilities.Constants.BLANK, true); LayoutDetails.Instance.SystemLayout.LoadLayout(LayoutPanel.SYSTEM_LAYOUT, false, null); form.Controls.Add(LayoutDetails.Instance.SystemLayout); // we need to force a registeration event (may 2013) after I restructued how the // default tables are created MefAddIns.Addin_Submissions FAKESUBAddIn = new MefAddIns.Addin_Submissions(); FAKESUBAddIn.RegisterType(); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panel.NewLayout(panelname, true, null); LayoutDetails.Instance.AddToList(typeof(FAKE_NoteDataXML_Panel), "testingpanelZZ"); _w.output("herefirst"); NoteDataXML_Submissions Submissions = new NoteDataXML_Submissions(250, 250); Submissions.GuidForNote = "submissions"; Submissions.Caption = "Submissions"; panel.AddNote(Submissions); Submissions.CreateParent(panel); Submissions.UpdateAfterLoad(); panel.SaveLayout(); form.Dispose(); }
public static void Dispose(System.Windows.Forms.Form[] forms) { if (forms == null) { return; } for (int i = 0; i < forms.Length; i++) { System.Windows.Forms.Form ctrl = forms[i]; if (ctrl != null) { ctrl.Dispose(); } } }
/// <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 && (components != null)) { components.Dispose(); } base.Dispose(disposing); // Dispose the used objects of the form cnc and the adsServer object // regular disposing is to late System.Windows.Forms.Form tmpForm = menu.GetForm("FormCnc"); if (tmpForm != null) { tmpForm.Dispose(); } }
/// <summary> /// Displays a Form, with the passed Custom Settings /// </summary> /// <param name="settings"></param> public static void ShowCustomSettings(SimPe.Interfaces.ISettings settings) { System.Windows.Forms.Form f = new System.Windows.Forms.Form(); f.Text = settings.ToString(); f.Width = 400; f.Height = 300; f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; f.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; System.Windows.Forms.PropertyGrid pg = new System.Windows.Forms.PropertyGrid(); f.Controls.Add(pg); pg.Dock = System.Windows.Forms.DockStyle.Fill; pg.SelectedObject = settings.GetSettingsObject(); RemoteControl.ShowSubForm(f); f.Dispose(); }
public void Quicker_UpdateAfterLoadTest() { _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); form.Controls.Add(panel); // needed else DataGrid does not initialize form.Show(); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form, null); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panel.NewLayout(panelname, true, null); LayoutDetails.Instance.AddToList(typeof(FAKE_NoteDataXML_Panel), "testingpanel"); _w.output("herefirst"); // ADD 1 of each type foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) { for (int i = 0; i < 5; i++) { NoteDataInterface note = (NoteDataInterface)Activator.CreateInstance(t); panel.AddNote(note); note.CreateParent(panel); note.UpdateAfterLoad(); } } panel.SaveLayout(); form.Dispose(); }
/// <summary> /// 锁屏 /// </summary> /// <param name="aLock">true:锁屏+关屏;false:禁止鼠标键盘动作+关屏</param> public static void LockWorkStation(bool aLock) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); if (aLock) { // 锁屏+关屏 User32.LockWorkStation(); User32.SendMessage(form.Handle, Const.WM_SYSCOMMAND, Const.SC_MONITORPOWER, Const.MonitorPowerOff); } else { // 禁止鼠标键盘动作+关屏 User32.BlockInput(true); System.Threading.Thread.Sleep(10); User32.SendMessage(form.Handle, Const.WM_SYSCOMMAND, Const.SC_MONITORPOWER, Const.MonitorPowerOff); User32.BlockInput(false); } form.Dispose(); }
public override void Dispose() { lock (_sync) { if (_joystick != null) { _joystick.Dispose(); _joystick = null; } if (_directInput != null) { _directInput.Dispose(); _directInput = null; } } _form.Dispose(); _timer.Dispose(); }
private void button3_Click(object sender, System.EventArgs e) { for (int i = 0; i < (listView1.SelectedItems.Count); i++) { System.Windows.Forms.ListViewItem selitem = listView1.SelectedItems[i]; foreach (var callbackplugin in Classes.ExecutionManager.callbackplugins) { if (callbackplugin.PluginName.Equals(selitem.Text)) { System.Windows.Forms.Form plugsettingfrm = callbackplugin.SettingsWindow; plugsettingfrm.ShowDialog(); // ensure disposed. if (!plugsettingfrm.IsDisposed) { plugsettingfrm.Dispose(); } plugsettingfrm = null; } } } }
void TimerProcess() { // Create device form. deviceForm = new System.Windows.Forms.Form(); deviceForm.Text = "X360CE Force Feedback Form"; deviceForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; deviceForm.MinimizeBox = false; deviceForm.MaximizeBox = false; deviceForm.ShowInTaskbar = false; // Force to create handle. var handle = deviceForm.Handle; // Set timer. _timer.Interval = (int)Frequency; _timer.Start(); // Wait here until all items returns to the pool. TimerSemaphore.Wait(); _timer.Stop(); // Dispose form on the same thread as it was created. deviceForm.Dispose(); }
private void AddOpaqueInkOverlay(double size, Image img) { //add the opaque ink overlay if ((opaqueInk != null) && (opaqueInk.Strokes.Count > 0)) { /// draw the slide data on a temporary graphics object in a temporary form System.Windows.Forms.Form tempForm = new System.Windows.Forms.Form(); Graphics screenGraphics = tempForm.CreateGraphics(); DibGraphicsBuffer dib = new DibGraphicsBuffer(); Graphics tempGraphics = dib.RequestBuffer(screenGraphics, img.Width, img.Height); //Add the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. tempGraphics.DrawImage(img, 0, 0); //System.Drawing.Drawing2D.GraphicsState oldState = tempGraphics.Save(); Microsoft.Ink.Renderer renderer = new Microsoft.Ink.Renderer(); Matrix transformation = new Matrix(); renderer.GetViewTransform(ref transformation); transformation.Scale(((float)img.Width / 500f) * (float)size, ((float)img.Height / 500f) * (float)size); renderer.SetViewTransform(transformation); renderer.Draw(tempGraphics, opaqueInk.Strokes); //tempGraphics.Restore(oldState); Graphics toSave = Graphics.FromImage(img); dib.PaintBuffer(toSave, 0, 0); toSave.Dispose(); tempGraphics.Dispose(); dib.Dispose(); screenGraphics.Dispose(); tempForm.Dispose(); } }
void b_Click(object sender, EventArgs e) { nvc.Clear(); nvc.Add("sysadmin", t1.Text); nvc.Add("admin", t2.Text); nvc.Add("kassa", t3.Text); nvc.Add("tech", t4.Text); try { SaveSettings(); System.Windows.Forms.MessageBox.Show("Данные успешно сохранены!", "Сохранение.", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); if (SettingsChanged != null) { SettingsChanged(this); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("При сохранении параметров произошла ошибка.\r\n" + ex.Message, "Сохранение.", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } p.Dispose(); }
public static string ConvertTwipsToXPixels(string twipsStr) { if (String.IsNullOrEmpty(twipsStr)) { return(""); } System.Windows.Forms.Form dummyForm = new System.Windows.Forms.Form(); System.Drawing.Graphics formGraphics = dummyForm.CreateGraphics(); float dpiy = formGraphics.DpiY; double twips = Double.Parse(twipsStr); if (twips < 0) { twips = 0; // VB6 has huge negative numbers sometimes. idk what this means } int product = (int)Math.Round((twips * (1.0 / 1440.0) * dpiy), 0); formGraphics.Dispose(); dummyForm.Dispose(); return(product.ToString()); }
public static void BackwardToDifferentWindow(System.Windows.Forms.Form from, System.Windows.Forms.Form backTo) { from.Dispose(); }
public void TimelineAndTableAlwaysTogether() { _w.output ("START"); System.Windows.Forms .Form form = new System.Windows.Forms.Form (); _TestSingleTon.Instance._SetupForLayoutPanelTests (); FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panel); form.Show (); //NOTE: For now remember that htis ADDS 1 Extra notes panel.NewLayout ("mynewpanel", true, null); NoteDataXML basicNote = new NoteDataXML (); basicNote.Caption = "note1"; panel.AddNote (basicNote); //basicNote.CreateParent(panel); //panel.MoveNote( // create four panels A and B at root level. C inside A. D inside C FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel (); panelA.Caption = "PanelA"; panelA.GuidForNote = "panela"; FAKE_NoteDataXML_Panel panelB = new FAKE_NoteDataXML_Panel (); panelB.Caption = "PanelB"; panelB.GuidForNote = "panelb"; FAKE_NoteDataXML_Panel panelC = new FAKE_NoteDataXML_Panel (); panelC.Caption = "PanelC"; panelC.GuidForNote = "panelc"; _w.output ("panels made"); panel.AddNote (panelA); // 1 panel.AddNote (panelB); // 2 //panelA.CreateParent(panel); should not need to call this when doing LayoutPanel.AddNote because it calls CreateParent insid eof it basicNote = new NoteDataXML (); basicNote.Caption = "note2"; panelA.AddNote (basicNote); // Panel A has 1 note basicNote.CreateParent (panelA.myLayoutPanel ()); // DO need to call it when adding notes like this (to a subpanel, I think) panel.SaveLayout (); Assert.AreEqual (1, panelA.CountNotes (), "Panel A holds one note"); // So this counts as + 2 // so we have (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6 _w.output ("STARTCOUNT"); Assert.AreEqual (6, panel.CountNotes (), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); _w.output ("ENDCOUNT"); // add timeline into a PANEL // count 1 row NoteDataXML_Timeline MyTimeLine = new NoteDataXML_Timeline(100,100); MyTimeLine.Caption = "My Timeline!"; panelA.AddNote(MyTimeLine); MyTimeLine.CreateParent(panelA.GetPanelsLayout()); panel.SaveLayout(); // I needed this save else it would not work? Assert.AreEqual (8, panel.CountNotes (), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); string guidOfTimeline = MyTimeLine.GuidForNote; string guidOfTimelineTable = guidOfTimeline + "table"; NoteDataXML_Table FoundTable = (NoteDataXML_Table)panel.FindNoteByGuid(guidOfTimelineTable); Assert.NotNull(FoundTable); Assert.AreEqual (1, FoundTable.RowCount()); FoundTable = null; // move the TABLE associated with the timeline OUT to parent // count 1 row panelA.myLayoutPanel ().MoveNote(guidOfTimelineTable, "up"); // And for kicks add another timeline just to see if it messages anytnig up NoteDataXML_Timeline MyTimeLine2 = new NoteDataXML_Timeline(100,1020); MyTimeLine2.Caption = "My Timeline! #2"; panel.AddNote(MyTimeLine2); panel.SaveLayout(); Assert.AreEqual (10, panel.CountNotes (), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); Assert.Null(FoundTable); FoundTable = (NoteDataXML_Table)panel.FindNoteByGuid(guidOfTimelineTable); Assert.NotNull(FoundTable); Assert.AreEqual (1, FoundTable.RowCount()); // move the TABLE into ANOTHER panel // count 1 row _w.output("Moving into panelb now"); panel.MoveNote(guidOfTimelineTable, "panelb"); panel.SaveLayout(); Assert.AreEqual (10, panel.CountNotes (), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); _w.output("done counting"); FoundTable = null; Assert.Null(FoundTable); FoundTable = (NoteDataXML_Table)panel.FindNoteByGuid(guidOfTimelineTable); Assert.NotNull(FoundTable); Assert.AreEqual (1, FoundTable.RowCount()); form.Dispose (); }
/// <summary> /// The Show /// </summary> public void Show() { Printing = false; var startX = 30; var startY = 40; var f = new System.Windows.Forms.Form { FormBorderStyle = System.Windows.Forms.FormBorderStyle.None, ControlBox = false, WindowState = System.Windows.Forms.FormWindowState.Normal, StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen, Size = new System.Drawing.Size(300, 400), Text = "Gantt print dialog", ShowIcon = false }; f.Load += PrintDialog_Load; f.Paint += PrintDialog_Paint; f.LostFocus += PrintDialog_LostFocus; var intA = 0; //title label System.Windows.Forms.Label lbl = new System.Windows.Forms.Label(); lbl.Text = "Chose some format to print focused content"; lbl.AutoSize = true; lbl.Location = new System.Drawing.Point(startX, startY); f.Controls.Add(lbl); System.Windows.Forms.RadioButton radio; System.Windows.Forms.Label txtTit = new System.Windows.Forms.Label(); System.Windows.Forms.TextBox txt = new System.Windows.Forms.TextBox();; System.Windows.Forms.Label lblDedicat = new System.Windows.Forms.Label(); System.Windows.Forms.Button btnPrint = new System.Windows.Forms.Button(); System.Windows.Forms.Button btnClose = new System.Windows.Forms.Button(); System.Windows.Forms.Label cboTit = new System.Windows.Forms.Label(); System.Windows.Forms.ComboBox cboPrinters = new System.Windows.Forms.ComboBox(); var radioTop = 60; //create radio formats for (intA = 2; intA <= 4; intA++) { radio = new System.Windows.Forms.RadioButton { Text = "A" + intA.ToString(), Location = new System.Drawing.Point(startX, radioTop), AutoSize = true }; //change format enumareation on check even radio.CheckedChanged += null; radio.CheckedChanged += RadioFormat_Check; radioTop += 20; f.Controls.Add(radio); } txtTit.Text = "Description (Optional)"; txtTit.Location = new System.Drawing.Point(startX, radioTop + 30); txtTit.AutoSize = true; f.Controls.Add(txtTit); txt.Location = new System.Drawing.Point(startX, radioTop + 50); txt.Width = 240; f.Controls.Add(txt); cboTit.Text = "Choose a printer"; cboTit.Location = new System.Drawing.Point(startX, txt.Location.Y + 30); cboTit.AutoSize = true; f.Controls.Add(cboTit); cboPrinters.Location = new System.Drawing.Point(startX, cboTit.Location.Y + 20); cboPrinters.Width = 200; f.Controls.Add(cboPrinters); LoadPrintersList(cboPrinters); //load printers to combo btnPrint.Text = "&Print"; btnPrint.Location = new System.Drawing.Point(70, txtTit.Location.Y + 120); f.Controls.Add(btnPrint); btnPrint.DialogResult = System.Windows.Forms.DialogResult.Yes; //accept only btnPrint.Click += delegate { Printer = cboPrinters.Text; //get selected printer Notification = txt.Text; //get inserted text by user Printing = true; f.Close(); }; btnClose.Text = "&Close"; btnClose.Location = new System.Drawing.Point(btnPrint.Location.X + btnPrint.Width + 10, btnPrint.Location.Y); btnClose.DialogResult = System.Windows.Forms.DialogResult.None; f.Controls.Add(btnClose); btnClose.Click += delegate { Printing = false; f.Close(); }; f.ShowDialog(); f.Dispose(); }
public void TimelineAndTableAlwaysTogether() { _w.output("START"); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); _TestSingleTon.Instance._SetupForLayoutPanelTests(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); form.Controls.Add(panel); form.Show(); //NOTE: For now remember that htis ADDS 1 Extra notes panel.NewLayout("mynewpanel", true, null); NoteDataXML basicNote = new NoteDataXML(); basicNote.Caption = "note1"; panel.AddNote(basicNote); //basicNote.CreateParent(panel); //panel.MoveNote( // create four panels A and B at root level. C inside A. D inside C FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel(); panelA.Caption = "PanelA"; panelA.GuidForNote = "panela"; FAKE_NoteDataXML_Panel panelB = new FAKE_NoteDataXML_Panel(); panelB.Caption = "PanelB"; panelB.GuidForNote = "panelb"; FAKE_NoteDataXML_Panel panelC = new FAKE_NoteDataXML_Panel(); panelC.Caption = "PanelC"; panelC.GuidForNote = "panelc"; _w.output("panels made"); panel.AddNote(panelA); // 1 panel.AddNote(panelB); // 2 //panelA.CreateParent(panel); should not need to call this when doing LayoutPanel.AddNote because it calls CreateParent insid eof it basicNote = new NoteDataXML(); basicNote.Caption = "note2"; panelA.AddNote(basicNote); // Panel A has 1 note basicNote.CreateParent(panelA.myLayoutPanel()); // DO need to call it when adding notes like this (to a subpanel, I think) panel.SaveLayout(); Assert.AreEqual(1, panelA.CountNotes(), "Panel A holds one note"); // So this counts as + 2 // so we have (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6 _w.output("STARTCOUNT"); Assert.AreEqual(6, panel.CountNotes(), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); _w.output("ENDCOUNT"); // add timeline into a PANEL // count 1 row NoteDataXML_Timeline MyTimeLine = new NoteDataXML_Timeline(100, 100); MyTimeLine.Caption = "My Timeline!"; panelA.AddNote(MyTimeLine); MyTimeLine.CreateParent(panelA.GetPanelsLayout()); panel.SaveLayout(); // I needed this save else it would not work? Assert.AreEqual(8, panel.CountNotes(), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); string guidOfTimeline = MyTimeLine.GuidForNote; string guidOfTimelineTable = guidOfTimeline + "table"; NoteDataXML_Table FoundTable = (NoteDataXML_Table)panel.FindNoteByGuid(guidOfTimelineTable); Assert.NotNull(FoundTable); Assert.AreEqual(1, FoundTable.RowCount()); FoundTable = null; // move the TABLE associated with the timeline OUT to parent // count 1 row panelA.myLayoutPanel().MoveNote(guidOfTimelineTable, "up"); // And for kicks add another timeline just to see if it messages anytnig up NoteDataXML_Timeline MyTimeLine2 = new NoteDataXML_Timeline(100, 1020); MyTimeLine2.Caption = "My Timeline! #2"; panel.AddNote(MyTimeLine2); panel.SaveLayout(); Assert.AreEqual(10, panel.CountNotes(), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); Assert.Null(FoundTable); FoundTable = (NoteDataXML_Table)panel.FindNoteByGuid(guidOfTimelineTable); Assert.NotNull(FoundTable); Assert.AreEqual(1, FoundTable.RowCount()); // move the TABLE into ANOTHER panel // count 1 row _w.output("Moving into panelb now"); panel.MoveNote(guidOfTimelineTable, "panelb"); panel.SaveLayout(); Assert.AreEqual(10, panel.CountNotes(), "Total notes SHOULD BE 6 : (1 + 1 note on it)panel A + (1)panelB + basicNote +DefaultNote = 5 + (NEW) LinkTable = 6"); _w.output("done counting"); FoundTable = null; Assert.Null(FoundTable); FoundTable = (NoteDataXML_Table)panel.FindNoteByGuid(guidOfTimelineTable); Assert.NotNull(FoundTable); Assert.AreEqual(1, FoundTable.RowCount()); form.Dispose(); }
private void DrawSlide2( DeckTraversalModel traversal, int index, System.Drawing.Rectangle displayBounds, System.Drawing.Graphics g ) { float width_scale = g.DpiX / 100f; float height_scale = g.DpiY / 100f; Rectangle bounds = new Rectangle( 0, 0, (int)(displayBounds.Width * 3f), (int)(displayBounds.Height * 3f) ); // Create an image using temporary graphics and graphics buffer object Bitmap imageForPrinting = new Bitmap( bounds.Width, bounds.Height ); using( Graphics graphicsImage = Graphics.FromImage( imageForPrinting ) ) { using( DibGraphicsBuffer dib = new DibGraphicsBuffer() ) { // Create temporary screen Graphics System.Windows.Forms.Form tempForm = new System.Windows.Forms.Form(); Graphics screenGraphics = tempForm.CreateGraphics(); // Create temporary Graphics from the Device Independent Bitmap using( Graphics graphicsTemp = dib.RequestBuffer( screenGraphics, imageForPrinting.Width, imageForPrinting.Height ) ) { // Save the old state System.Drawing.Drawing2D.GraphicsState oldState; using( Synchronizer.Lock( traversal.SyncRoot ) ) { using( Synchronizer.Lock( traversal.Deck.SyncRoot ) ) { using( Synchronizer.Lock( traversal.Deck.TableOfContents.SyncRoot ) ) { TableOfContentsModel.Entry entry = traversal.Deck.TableOfContents.Entries[index]; using( Synchronizer.Lock( entry.Slide.SyncRoot ) ) { //Draw the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. if( entry.Slide.BackgroundColor != Color.Empty ) { graphicsTemp.Clear( entry.Slide.BackgroundColor ); } else if( traversal.Deck.DeckBackgroundColor != Color.Empty ) { graphicsTemp.Clear( traversal.Deck.DeckBackgroundColor ); } else { graphicsTemp.Clear( Color.Transparent ); } //Get the Slide content and draw it oldState = graphicsTemp.Save(); Model.Presentation.SlideModel.SheetCollection sheets = entry.Slide.ContentSheets; for( int i = 0; i < sheets.Count; i++ ) { SlideDisplayModel display = new SlideDisplayModel( graphicsTemp, null ); Rectangle rect = new Rectangle( 0, 0, bounds.Width, bounds.Height ); Rectangle slide = new Rectangle( rect.X, rect.Y, rect.Width, rect.Height ); float zoom = 1f; if( entry.Slide != null ) { slide = entry.Slide.Bounds; zoom = entry.Slide.Zoom; } System.Drawing.Drawing2D.Matrix pixel, ink; display.FitSlideToBounds( System.Windows.Forms.DockStyle.Fill, rect, zoom, ref slide, out pixel, out ink ); using( Synchronizer.Lock( display.SyncRoot ) ) { display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet( display, sheets[i] ); r.Paint( new System.Windows.Forms.PaintEventArgs( graphicsTemp, bounds ) ); r.Dispose(); } } } } } //Restore the Old State graphicsTemp.Restore( oldState ); // Use the buffer to paint onto the final image dib.PaintBuffer( graphicsImage, 0, 0 ); // Draw this image onto the printer graphics, // adjusting for printer margins g.DrawImage( imageForPrinting, displayBounds ); //Cleanup graphicsTemp.Dispose(); screenGraphics.Dispose(); tempForm.Dispose(); dib.Dispose(); graphicsImage.Dispose(); imageForPrinting.Dispose(); } } } }
public void Dispose() { saveConfiguration(); owner.Dispose(); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { ModMxd._MxdPath = ""; m_Form.Close(); m_Form.Dispose(); }
public void Quicker_UpdateAfterLoadTest() { _TestSingleTon.Instance._SetupForLayoutPanelTests(); System.Windows.Forms .Form form = new System.Windows.Forms.Form(); FAKE_LayoutPanel panel = new FAKE_LayoutPanel (CoreUtilities.Constants.BLANK, false); form.Controls.Add (panel); // needed else DataGrid does not initialize form.Show (); //form.Visible = false; _w.output("boom"); // March 2013 -- notelist relies on having this YOM2013.DefaultLayouts.CreateASystemLayout(form,null); //NOTE: For now remember that htis ADDS 1 Extra notes string panelname = System.Guid.NewGuid().ToString(); panel.NewLayout (panelname,true, null); LayoutDetails.Instance.AddToList (typeof(FAKE_NoteDataXML_Panel), "testingpanel"); _w.output ("herefirst"); // ADD 1 of each type foreach (Type t in LayoutDetails.Instance.ListOfTypesToStoreInXML()) { for (int i = 0; i < 5; i++) { NoteDataInterface note = (NoteDataInterface)Activator.CreateInstance (t); panel.AddNote (note); note.CreateParent(panel); note.UpdateAfterLoad(); } } panel.SaveLayout(); form.Dispose (); }
private void DrawSlide2(DeckTraversalModel traversal, int index, System.Drawing.Rectangle displayBounds, System.Drawing.Graphics g) { float width_scale = g.DpiX / 100f; float height_scale = g.DpiY / 100f; Rectangle bounds = new Rectangle(0, 0, (int)(displayBounds.Width * 3f), (int)(displayBounds.Height * 3f)); // Create an image using temporary graphics and graphics buffer object Bitmap imageForPrinting = new Bitmap(bounds.Width, bounds.Height); using (Graphics graphicsImage = Graphics.FromImage(imageForPrinting)) { using (DibGraphicsBuffer dib = new DibGraphicsBuffer()) { // Create temporary screen Graphics System.Windows.Forms.Form tempForm = new System.Windows.Forms.Form(); Graphics screenGraphics = tempForm.CreateGraphics(); // Create temporary Graphics from the Device Independent Bitmap using (Graphics graphicsTemp = dib.RequestBuffer(screenGraphics, imageForPrinting.Width, imageForPrinting.Height)) { // Save the old state System.Drawing.Drawing2D.GraphicsState oldState; using (Synchronizer.Lock(traversal.SyncRoot)) { using (Synchronizer.Lock(traversal.Deck.SyncRoot)) { using (Synchronizer.Lock(traversal.Deck.TableOfContents.SyncRoot)) { TableOfContentsModel.Entry entry = traversal.Deck.TableOfContents.Entries[index]; using (Synchronizer.Lock(entry.Slide.SyncRoot)) { //Draw the background color //First see if there is a Slide BG, if not, try the Deck. Otherwise, use transparent. if (entry.Slide.BackgroundColor != Color.Empty) { graphicsTemp.Clear(entry.Slide.BackgroundColor); } else if (traversal.Deck.DeckBackgroundColor != Color.Empty) { graphicsTemp.Clear(traversal.Deck.DeckBackgroundColor); } else { graphicsTemp.Clear(Color.Transparent); } //Get the Slide content and draw it oldState = graphicsTemp.Save(); Model.Presentation.SlideModel.SheetCollection sheets = entry.Slide.ContentSheets; for (int i = 0; i < sheets.Count; i++) { SlideDisplayModel display = new SlideDisplayModel(graphicsTemp, null); Rectangle rect = new Rectangle(0, 0, bounds.Width, bounds.Height); Rectangle slide = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); float zoom = 1f; if (entry.Slide != null) { slide = entry.Slide.Bounds; zoom = entry.Slide.Zoom; } System.Drawing.Drawing2D.Matrix pixel, ink; display.FitSlideToBounds(System.Windows.Forms.DockStyle.Fill, rect, zoom, ref slide, out pixel, out ink); using (Synchronizer.Lock(display.SyncRoot)) { display.Bounds = slide; display.PixelTransform = pixel; display.InkTransform = ink; } Viewer.Slides.SheetRenderer r = Viewer.Slides.SheetRenderer.ForStaticSheet(display, sheets[i]); r.Paint(new System.Windows.Forms.PaintEventArgs(graphicsTemp, bounds)); r.Dispose(); } } } } } //Restore the Old State graphicsTemp.Restore(oldState); // Use the buffer to paint onto the final image dib.PaintBuffer(graphicsImage, 0, 0); // Draw this image onto the printer graphics, // adjusting for printer margins g.DrawImage(imageForPrinting, displayBounds); //Cleanup graphicsTemp.Dispose(); screenGraphics.Dispose(); tempForm.Dispose(); dib.Dispose(); graphicsImage.Dispose(); imageForPrinting.Dispose(); } } } }