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


C# UserControl.Dispose方法代码示例

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


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

示例1: RemoveControlFromObjectsPanel

        public void RemoveControlFromObjectsPanel(UserControl control)
        {
            if (this.selectedObjectPanels.Contains(control))
            {
                this.selectedObjectPanels.Remove(control);
                this.selectedAssetTabPage.Controls.Remove(control);

                control.Dispose();
                refreshSelectedObjectListView();
            }
        }
开发者ID:nadar71,项目名称:Krea,代码行数:11,代码来源:AssetManagerForm.cs

示例2: Form1_WorkFinished

        private void Form1_WorkFinished(object sender, EventArgs e)
        {
            this.Controls.Remove(currentModule);
            object returnedData = null;
            int Code;
            if ((Code = (currentModule as IGraphLabsModule).GetReturnedCode(out returnedData)) != 0)
            {
                panelSelect.Visible = true;
                currentModule.Dispose();
                currentModule = null;
                MessageBox.Show(this, string.Format("При выполнении модуля \"{0}\" возникла ошибка:\n{1}",
                    dgridSelectedModules.Rows[executingModuleIndex].Cells[1].Value.ToString(),
                    (currentModule as IGraphLabsModule).GetCodeDescription(Code)),
                    "",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                return;
            }
            currentModule.Dispose();
            currentModule = null;

            executingModuleIndex++;
            if (executingModuleIndex < dgridSelectedModules.Rows.Count)
            {
                try
                {
                    Type moduleType =
                        (AssemblyArray[Int32.Parse(dgridSelectedModules.Rows[executingModuleIndex].Cells[6].Value.ToString())] as Assembly).GetExportedTypes()[0];
                    currentModule = Activator.CreateInstance(moduleType) as UserControl;
                    (currentModule as IGraphLabsModule).WorkFinished += new EventHandler(Form1_WorkFinished);
                    (currentModule as IGraphLabsModule).WorkCanceled += new EventHandler(Form1_WorkCancelled);
                    this.SuspendLayout();
                    currentModule.Location = panelSelect.Location;
                    currentModule.Name = "module";
                    currentModule.Size = panelSelect.Size;
                    currentModule.TabIndex = 0;
                    this.Controls.Add(currentModule);
                    (currentModule as IGraphLabsModule).InitModule(returnedData);
                    DisplayModuleInfo();
                    this.ResumeLayout(false);

                }
                catch (Exception E)
                {
                    MessageBox.Show(E.ToString());
                    executingModuleIndex = -1;
                    panelSelect.Visible = true;
                    if (currentModule != null)
                    {
                        if (Controls.Contains(currentModule))
                            Controls.Remove(currentModule);
                        currentModule.Dispose();
                        currentModule = null;
                    }
                }
            }
            else
            {
                executingModuleIndex = -1;
                panelSelect.Visible = true;
                ResizeOnModuleFinish();
            }
        }
开发者ID:svtz,项目名称:GraphLabs,代码行数:63,代码来源:mainForm.cs

示例3: CleanupButton

        private void CleanupButton(UserControl button)
        {
            button.Parent = null;

            button.MouseDown -= new MouseEventHandler(button_MouseDown);
            button.MouseMove -= new MouseEventHandler(button_MouseMove);
            button.MouseUp -= new MouseEventHandler(button_MouseUp);
            Controls.Remove(button);
            button.Dispose();
        }
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:10,代码来源:ButtonGroupControl.cs

示例4: btnRun_Click

        private void btnRun_Click(object sender, EventArgs e)
        {
            if (dgridSelectedModules.Rows.Count == 0)
            {
                MessageBox.Show(this, "Необходимо выбрать хотя бы один модуль.",
                     "",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Warning);
                return;
            }

            if (dgridSelectedModules.Rows.Count > 1)
                for (int i = 1; i < dgridSelectedModules.Rows.Count; i++)
                {
                    if (dgridSelectedModules.Rows[i].Cells[5].Value.ToString() !=
                        dgridSelectedModules.Rows[i-1].Cells[4].Value.ToString())
                    {
                        MessageBox.Show(this, "Неверная последовательность модулей.\nЗапуск невозможен.",
                            "",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning);
                        return;
                    }
                }

            panelSelect.Visible = false;
            executingModuleIndex = 0;
            try
            {
                Type moduleType =
                    (AssemblyArray[Int32.Parse(dgridSelectedModules.Rows[executingModuleIndex].Cells[6].Value.ToString())] as Assembly).GetExportedTypes()[0];
                currentModule = Activator.CreateInstance(moduleType) as UserControl;
                (currentModule as IGraphLabsModule).WorkFinished += new EventHandler(Form1_WorkFinished);
                (currentModule as IGraphLabsModule).WorkCanceled += new EventHandler(Form1_WorkCancelled);
                this.SuspendLayout();
                if (typeof(IModuleSettings).IsAssignableFrom(moduleType))
                {
                    UserControl settingsControl = ((IModuleSettings)currentModule).GetSettingsControl(null) as UserControl;
                    settingsControl.Location = panelSelect.Location;
                    settingsControl.Name = "settings";
                    settingsControl.Size = panelSelect.Size;
                    settingsControl.TabIndex = 0;
                    (settingsControl as ISettingsControl).SettingsSet += new SettingsEventHandler(mainForm_SettingsSet);
                    (settingsControl as ISettingsControl).SettingsNotSet += new SettingsEventHandler(mainForm_SettingsNotSet);
                    this.Controls.Add(settingsControl);
                    oldHeight = Height;
                    oldWidth = Width;
                }
                else
                {
                    currentModule.Location = panelSelect.Location;
                    currentModule.Name = "module";
                    currentModule.Size = panelSelect.Size;
                    currentModule.TabIndex = 0;
                    (currentModule as IGraphLabsModule).InitModule(typeof(void));
                    this.Controls.Add(currentModule);
                    oldHeight = Height;
                    oldWidth = Width;
                }
                this.ResumeLayout();
                FormBorderStyle = FormBorderStyle.Sizable;
                statusStrip.SizingGrip = true;
                DisplayModuleInfo();
                новаяПоследовательностьЗапускаToolStripMenuItem.Enabled =
                    открытьПоследовательностьЗапускаToolStripMenuItem.Enabled =
                    добавитьВКонецПоследовательностиToolStripMenuItem.Enabled =
                    удалитьИзПоследовательностиToolStripMenuItem.Enabled =
                    передвинутьВверхToolStripMenuItem.Enabled =
                    передвинутьВнизToolStripMenuItem.Enabled =
                    добавитьНовыйМодульВБазуToolStripMenuItem.Enabled =
                    выполнитьПоследовательностьToolStripMenuItem.Enabled =
                    сохранитьПоследовательностьЗапускаToolStripMenuItem.Enabled =
                    сохранитьПоследовательностьЗапускаКакToolStripMenuItem.Enabled = false;
                прерватьВыполнениеToolStripMenuItem.Enabled = true;
            }
            catch
            {
                executingModuleIndex = -1;
                panelSelect.Visible = true;
                if (currentModule != null)
                {
                    if (Controls.Contains(currentModule))
                        Controls.Remove(currentModule);
                    currentModule.Dispose();
                    currentModule = null;
                }
            }
        }
开发者ID:svtz,项目名称:GraphLabs,代码行数:88,代码来源:mainForm.cs

示例5: CleanupButton

        private void CleanupButton(UserControl button)
        {
            button.Parent = null;

            button.MouseDown -= button_MouseDown;
            button.MouseMove -= button_MouseMove;
            button.MouseUp -= button_MouseUp;
            Controls.Remove(button);
            button.Dispose();
        }
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:10,代码来源:ButtonGroupControl.cs


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