当前位置: 首页>>代码示例>>C#>>正文


C# Form.Dispose方法代码示例

本文整理汇总了C#中System.Windows.Forms.Form.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Form.Dispose方法的具体用法?C# Form.Dispose怎么用?C# Form.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectRow_ShouldMaintain_ActivePosition

		public void SelectRow_ShouldMaintain_ActivePosition()
		{
			// set up special conditions
			var grid = new Grid();
			grid.Redim(1, 1);
			grid[0, 0] = new Cell();
			
			var form = new Form();
			form.Controls.Add(grid);
			form.Show();

			grid.SelectionMode = GridSelectionMode.Row;
			grid.Selection.EnableMultiSelection = false;
			
			
			// just assert that we have correct conditions for test, 
			// active position should not be empty
			grid.Selection.Focus(new Position(0, 0), true);
			Assert.AreEqual(new Position(0, 0), grid.Selection.ActivePosition);
			
			// this method causes first row to be selected. Should not fail 
			// it failed once in RowSelection.SelectRow method
			// As call to ResetSelection asked to maintain focus, a stack overflow was raised
			grid.Selection.SelectRow(0, true);
			Assert.AreEqual(new Position(0, 0), grid.Selection.ActivePosition);
			
			// destroy
			form.Close();
			form.Dispose();
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:30,代码来源:TestRowSelection.cs

示例2: set_window

        public void set_window(Form frm)
        {
            foreach (Control control in panel_container.Controls)
            {
                if (control.Text == frm.Text)
                {
                    control.BringToFront();
                    current_form = (Form)frm;
                    frm.Dispose();
                    return;
                }
            }

            frm.TopLevel = false;
            frm.Dock = System.Windows.Forms.DockStyle.Fill;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopMost = true;
            this.panel_container.Controls.Add(frm);
            frm.Show();
            frm.BringToFront();
            current_form = (Form)frm;

            TreeNode node = new TreeNode();
            node.Text = frm.Text;
            tree_menu.Nodes.Add(node);
        }
开发者ID:topomondher,项目名称:web_helper,代码行数:26,代码来源:frm_main.cs

示例3: Logout

 public void Logout(Form currentForm)
 {
     currentForm.Hide();
     _appGlobal.Logout();
     Program.LoginForm.Show();
     currentForm.Dispose();
 }
开发者ID:bartreedijk,项目名称:TI2.1-RHAPP-IP,代码行数:7,代码来源:StandardForm.cs

示例4: MaterialCheckBox

        public MaterialCheckBox()
        {
            // DPI Adjustments
            Form tmp = new Form();
            int dpiY = Utilities.DPIMath.ratioY(tmp);
            int dpiX = Utilities.DPIMath.ratioX(tmp);
            tmp.Dispose();
            CHECKBOX_SIZE = CHECKBOX_SIZE * dpiX;
            CHECKBOX_SIZE_HALF = CHECKBOX_SIZE_HALF * dpiX;
            CHECKBOX_INNER_BOX_SIZE = CHECKBOX_INNER_BOX_SIZE * dpiX;
            animationManager = new AnimationManager
            {
                AnimationType = AnimationType.EaseInOut,
                Increment = 0.05
            };
            rippleAnimationManager = new AnimationManager(false)
            {
                AnimationType = AnimationType.Linear,
                Increment = 0.10,
                SecondaryIncrement = 0.08
            };
            animationManager.OnAnimationProgress += sender => Invalidate();
            rippleAnimationManager.OnAnimationProgress += sender => Invalidate();

            CheckedChanged += (sender, args) =>
            {
                animationManager.StartNewAnimation(Checked ? AnimationDirection.In : AnimationDirection.Out);
            };

            Ripple = true;
            MouseLocation = new Point(-1, -1);
        }
开发者ID:ananthonline,项目名称:Google-Play-Music-Desktop-Player-UNOFFICIAL-,代码行数:32,代码来源:MaterialCheckbox.cs

示例5: ConvertToBitmap

        public ConvertToBitmap()
        {
            Bitmap bitmap = null;

            // do cvThreshold
            using (IplImage src = new IplImage(FilePath.Image.Lenna, LoadMode.GrayScale))
            using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
            {
                src.Smooth(src, SmoothType.Gaussian, 5);
                src.Threshold(dst, 0, 255, ThresholdType.Otsu);
                // IplImage -> Bitmap
                bitmap = dst.ToBitmap();
                //bitmap = BitmapConverter.ToBitmap(dst);
            }

            // visualize using WindowsForm
            Form form = new Form
            {
                Text = "from IplImage to Bitmap",
                ClientSize = bitmap.Size,
            };
            PictureBox pictureBox = new PictureBox
            {
                Dock = DockStyle.Fill,
                SizeMode = PictureBoxSizeMode.StretchImage,
                Image = bitmap
            };

            form.Controls.Add(pictureBox);
            form.ShowDialog();

            form.Dispose();
            bitmap.Dispose();
        }
开发者ID:0sv,项目名称:opencvsharp,代码行数:34,代码来源:ConvertToBitmap.cs

示例6: AbrirNuevoForm

 public static void AbrirNuevoForm(Form frmNueva)
 {
     Herramientas.frmAnterior = Herramientas.frmActual;
     Herramientas.frmActual = frmNueva;
     frmActual.Show();
     frmAnterior.Dispose();
 }
开发者ID:razor777,项目名称:Bencaleth,代码行数:7,代码来源:Herramientas.cs

示例7: getGenericFormInstance

        /// <summary>
        /// Devuelve o crea una instancia de un tipo de Formulario de la aplicación de forma genérica
        /// </summary>
        /// <param name="currentForm">Referencia del formulario origen de la llamada</param>
        /// <param name="newFormType">Tipo del formulario a crear</param>
        /// <param name="newForm">Referencia actual del formulario a crear (puede que ya exista)</param>
        /// <param name="forceCreate">Si es true, siempre se creará una instancia nueva, y si es false intentará devolver la instancia existente.</param>
        /// <returns></returns>
        private static Form getGenericFormInstance(Form currentForm, Type newFormType, Form newForm, Boolean forceCreate)
        {
            if (newForm == null || forceCreate)
            {
                // Hay que crear una instancia nueva
                if (newForm != null)
                {
                    // Si ya existía, lo cerramos antes de crear otro, liberando los recursos utilizados por el mismo.
                    newForm.Close();
                    newForm.Dispose();
                }
                // Creamos el nuevo formulario
                newForm = (Form)Activator.CreateInstance(newFormType);
            }

            // Mostramos el nuevo formulario
            newForm.Show();

            if (currentForm != null)
            {
                // Si nos llegó la referencia al formulario origen de la 'navegación', lo ocultamos (la referencia está guardada para recuperarla después)
                currentForm.Hide();
            }
            return newForm;
        }
开发者ID:100052610,项目名称:PFC,代码行数:33,代码来源:FormReferences.cs

示例8: Initialize

		public override void Initialize()
		{
			Form form = new Form();
			IntPtr intPtr = Direct3DCreate9(32u);
			if (intPtr == IntPtr.Zero)
			{
				throw new Exception("Failed to create D3D.");
			}
			D3D9.Struct0 @struct = new D3D9.Struct0
			{
				bool_0 = true,
				uint_6 = 1u,
				uint_2 = 0u
			};
			D3D9.Delegate4 @delegate = (D3D9.Delegate4)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 64), typeof(D3D9.Delegate4));
			IntPtr intPtr2;
			if (@delegate(intPtr, 0u, 1u, form.Handle, 32u, ref @struct, out intPtr2) < 0)
			{
				throw new Exception("Failed to create device.");
			}
			this.EndScenePointer = Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 168);
			D3D9.Delegate3 delegate2 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 8), typeof(D3D9.Delegate3));
			D3D9.Delegate3 delegate3 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 8), typeof(D3D9.Delegate3));
			delegate2(intPtr2);
			delegate3(intPtr);
			form.Dispose();
			this.delegate2_0 = (D3D9.Delegate2)Marshal.GetDelegateForFunctionPointer(this.EndScenePointer, typeof(D3D9.Delegate2));
			this.localHook_0 = LocalHook.Create(this.EndScenePointer, new D3D9.Delegate2(this.method_0), this);
			
			int[] exclusiveACL = new int[1];
			localHook_0.ThreadACL.SetExclusiveACL(exclusiveACL);
		}
开发者ID:isxGames,项目名称:QuestorISX,代码行数:32,代码来源:D3D9.cs

示例9: PreferredWidth

		public void PreferredWidth ()
		{
			Label l = new Label();

			// preferred width is 0 by default
			Assert.AreEqual (0, l.PreferredWidth, "2");

			// and after text is changed it's something else
			l.Text = "hi";
			Assert.IsTrue (l.PreferredWidth > 0, "3");

			// now add it to a form and see
			Form f = new Form ();
			f.ShowInTaskbar = false;
			l.Text = "";

			f.Controls.Add (l);
			f.Show ();
			Assert.AreEqual (0, l.PreferredWidth, "4");

			l.Text = "hi";
			Assert.IsTrue (l.PreferredWidth > 0, "5");

			f.Dispose ();
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:25,代码来源:LabelTest.cs

示例10: ActualizarTutor

        public void ActualizarTutor(Form vent, int Id, string nombre, string apellido, string dir, string tel)
        {
            try
            {
                cn = new SqlConnection(CadCon.Servidor());
                cn.Open();
                cmd = new SqlCommand("ActualizarTutor", cn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@id", Id);
                    cmd.Parameters.AddWithValue("@nombre", nombre);
                    cmd.Parameters.AddWithValue("@apellido", apellido);

                    cmd.Parameters.AddWithValue("@dir", dir);
                    cmd.Parameters.AddWithValue("@tel", tel);

                    int f = cmd.ExecuteNonQuery();
                    if (f != 0)
                    {
                        MessageBox.Show("Tutor actualizado exitosamente", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        vent.Dispose();
                        cmd.Dispose();
                        cn.Close();
                    }//KMN
            }
            catch (SqlException ex) { MessageBox.Show(ex.Message); }
        }
开发者ID:unscharf,项目名称:Gestion-de-casting,代码行数:27,代码来源:MetodosComunes.cs

示例11: Show

        public static DialogResult Show(string text, string head)
        {
            form1.Dispose();
            form1 = new Form();
            InitializeComponent();

            if (form1.ParentForm == null)
                form1.StartPosition = FormStartPosition.CenterScreen;

            label1.Location = new Point(12, label1.Location.Y);

            btnNames = AsignButtons(buttons);

            form1.Text = head;
            label1.Text = text;
            FormAutoHeigh();

            CenterButtons(btnNames.Length);

            MakeButtons(btnNames, selNoBtn);
            AddSound(icon);

            DialogResult rez = form1.ShowDialog();
            form1.Dispose();
            return rez;
        }
开发者ID:AndrewEastwood,项目名称:desktop,代码行数:26,代码来源:MMessageBox.cs

示例12: vCargaForma

        public static void vCargaForma(Form Formulario, Form FormularioPadre, string strText)
        {

            Formulario.Text = strText;

            foreach (Form ctr in FormularioPadre.MdiChildren)
            {
                if (ctr.Text == Formulario.Text)
                {
                    ctr.Focus();
                    Formulario.Dispose();
                    return;
                }

            }            

            Formulario.WindowState = FormWindowState.Maximized;
            Formulario.MdiParent = FormularioPadre;
            Formulario.ControlBox = false;

            Formulario.BackgroundImage = ConsultasIkorMysql.Properties.Resources.fondo;
            Formulario.Icon = ConsultasIkorMysql.Properties.Resources.ToolboxWindow;
            Formulario.BackgroundImageLayout = ImageLayout.Stretch;
            Formulario.Show();
            Formulario.WindowState = FormWindowState.Maximized;
            
        }
开发者ID:primedevmx,项目名称:3.-ConsultasIkorMysql,代码行数:27,代码来源:clSeguridad.cs

示例13: Initialize

        public static void Initialize()
        {
            var window = new Form();
            IntPtr direct3D = Direct3DAPI.Direct3DCreate9(Direct3DAPI.SDKVersion);
            if (direct3D == IntPtr.Zero)
                throw new Exception("Direct3DCreate9 failed (SDK Version: " + Direct3DAPI.SDKVersion + ")");
            var pp = new Direct3DAPI.PresentParameters { Windowed = true, SwapEffect = 1, BackBufferFormat = 0 };
            var createDevice = Helper.Magic.RegisterDelegate<Direct3DAPI.Direct3D9CreateDevice>(Helper.Magic.GetObjectVtableFunction(direct3D, 16));
            IntPtr device;
            if (createDevice(direct3D, 0, 1, window.Handle, 0x20, ref pp, out device) < 0)
                throw new Exception("Failed to create device");

            EndScenePointer = Helper.Magic.GetObjectVtableFunction(device, Direct3DAPI.EndSceneOffset);
            ResetPointer = Helper.Magic.GetObjectVtableFunction(device, Direct3DAPI.ResetOffset);
            ResetExPointer = Helper.Magic.GetObjectVtableFunction(device, Direct3DAPI.ResetExOffset);

            var deviceRelease = Helper.Magic.RegisterDelegate<Direct3DAPI.D3DRelease>(Helper.Magic.GetObjectVtableFunction(device, 2));
            var release = Helper.Magic.RegisterDelegate<Direct3DAPI.D3DRelease>(Helper.Magic.GetObjectVtableFunction(direct3D, 2));

            deviceRelease(device);
            release(direct3D);
            window.Dispose();

            // TODO: replace this with a VTable hook
            _endSceneDelegate = Helper.Magic.RegisterDelegate<Direct3DAPI.Direct3D9EndScene>(EndScenePointer);
            _endSceneHook = Helper.Magic.Detours.CreateAndApply(_endSceneDelegate,
                                                                new Direct3DAPI.Direct3D9EndScene(EndSceneHook),
                                                                "EndScene");
        }
开发者ID:aash,项目名称:cleanCore,代码行数:29,代码来源:Pulse.cs

示例14: Draw

        public static Point[] Draw(Pen pen, Form parent)
        {
            sPen = pen;
            // Record the start point
            mPos = parent.PointToClient(Control.MousePosition);
            // Create a transparent form on top of  the parent form
            mMask = new Form();
            mMask.FormBorderStyle = FormBorderStyle.None;
            mMask.BackColor = Color.Magenta;
            mMask.TransparencyKey = mMask.BackColor;

            mMask.ShowInTaskbar = false;
            mMask.StartPosition = FormStartPosition.Manual;
            mMask.Size = parent.ClientSize;
            mMask.Location = parent.PointToScreen(Point.Empty);
            mMask.MouseMove += MouseMove;
            mMask.MouseUp += MouseUp;
            mMask.Paint += PaintRectangle;
            mMask.Load += DoCapture;
            // Display the overlay
            mMask.ShowDialog(parent);
            // Clean-up and calculate return value
            mMask.Dispose();
            mMask = null;
            var pos = parent.PointToClient(Control.MousePosition);

            return new[] {mPos, pos};
        }
开发者ID:Khanchai,项目名称:Paint,代码行数:28,代码来源:LineTools.cs

示例15: AutoSize

		public void AutoSize ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;

			Panel p = new Panel ();
			p.AutoSize = true;
			f.Controls.Add (p);
			
			Button b = new Button ();
			b.Size = new Size (200, 200);
			b.Location = new Point (200, 200);
			p.Controls.Add (b);

			f.Show ();

			Assert.AreEqual (new Size (403, 403), p.ClientSize, "A1");
			
			p.Controls.Remove (b);
			Assert.AreEqual (new Size (200, 100), p.ClientSize, "A2");
			
			p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
			Assert.AreEqual (new Size (0, 0), p.ClientSize, "A3");
			f.Dispose ();
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:25,代码来源:PanelTest.cs


注:本文中的System.Windows.Forms.Form.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。