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


C# Form1.Dispose方法代码示例

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


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

示例1: button1_Click

 //클릭이벤트
 private void button1_Click(object sender, EventArgs e)
 {
     Form1 dlg = new Form1();
     dlg.ShowDialog();
     if(MessageBox.Show("밥먹었니?","질문",MessageBoxButtons.YesNo)==DialogResult.Yes)
     dlg.Dispose();
 }
开发者ID:sunnamkim,项目名称:doc,代码行数:8,代码来源:Form1.cs

示例2: Main

        static void Main(string[] args)
        {
            //Check for parameters
            filePath = args[0];

            Bitmap img = new Bitmap(filePath);

            string output = "";

            for (int i = 0; i < img.Height; i++)
            {
                for (int j = 0; j < img.Width; j++)
                {
                    Color pixel = img.GetPixel(j, i);   //Logic for parsing which replacer
                    try
                    {
                        output += colors[pixel.Name];
                    }
                    catch (KeyNotFoundException)
                    {
                        Form1 form = new Form1();
                        form.color = pixel;
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            colors.Add(pixel.Name, form.name);
                            output += colors[pixel.Name];
                            form.Dispose();
                        }
                        else return;

                    }

                }
                output += Environment.NewLine;
            }
            Console.Write(output);
            Clipboard.SetText(output);
            Console.ReadLine();
        }
开发者ID:mrcpj1998,项目名称:Basciinfinity,代码行数:39,代码来源:Program.cs

示例3: Main


//.........这里部分代码省略.........
                PrintUsage();
                return;
            }

            // create a new Form - the QTControl must be hosted on a Form or Window
            frm = new Form1();

            try
            {
                // retrieve the instance of the QTControl object from the Form
                qtc = frm.QTControl;

                // specify that any errors generated will raise an exception
                qtc.ErrorHandling = (int) QTErrorHandlingOptionsEnum.qtErrorHandlingRaiseException;

                // use a QTEvent handler to display export progress information
                qtc.QTEvent += new AxQTOControlLib._IQTControlEvents_QTEventEventHandler(OnQTEvent);

                // get the source movie for the export operation
                qtc.URL = inFile;
                Console.WriteLine("Input file  : " + inFile);
                Console.WriteLine("Output file : " + outFile);

                if (qtc.Movie != null)
                {
                    // get the QuickTime object from the QTControl
                    QTOLibrary.QTQuickTime qt = qtc.QuickTime;

                    if (qt != null)
                    {
                        // must first add an exporter to the collection
                        if (qt.Exporters.Count == 0)
                            qt.Exporters.Add();

                        // retrieve the QTExporter object from the collection
                        QTExporter qtexp = qt.Exporters[1];

                        if (qtexp != null)
                        {
                            qtexp.SetDataSource(qtc.Movie);
                            // export our movie to specified format
                            // (can be overriden by load settings)
                            qtexp.TypeName = codec;
                            // dont show the progress dialog
                            qtexp.ShowProgressDialog = false;
                            // specify destination file for the export operation
                            qtexp.DestinationFileName = outFile;
                            // optionally load exporter settings from a file if one is specified
                            if (loadSettings)
                            {
                                // first check if settings file actually exists
                                if (File.Exists(loadSettingsFile))
                                {
                                    StreamReader reader = new StreamReader(loadSettingsFile);
                                    CFObject settingsObject = new CFObject();
                                    string xml = reader.ReadToEnd();    // read settings file as an XML string
                                    settingsObject.XML = xml;   // load XML settings string into a CFObject
                                    qtexp.Settings = settingsObject;    // set the XML onto the exporter
                                    reader.Close();
                                    Console.WriteLine("Settings loaded from: " + loadSettingsFile);
                                }
                            }
                            // we'll show the settings dialog if the user asks for it
                            if (promptForSettings)
                            {
                                // show the exporter settings dialog
                                qtexp.ShowSettingsDialog();

                                // Optionally save the exporter settings to a file
                                if (saveSettings)
                                {
                                    StreamWriter writer = new StreamWriter(saveSettingsFile, false);
                                    writer.Write(qtexp.Settings.XML);   // write the settings as XML
                                    writer.Close();
                                    Console.WriteLine("Settings saved to: " + saveSettingsFile);
                                }
                            }
                            // we want export progress events
                            qtexp.EventListeners.Add(QTEventClassesEnum.qtEventClassProgress, QTEventIDsEnum.qtEventExportProgress, 0, 0);

                            Console.WriteLine("Export started...");

                            exportProgress = 0;

                            // do the export!
                            qtexp.BeginExport();

                            Console.WriteLine("\nExport done.");
                        }
                    }
                }
            }
            catch(COMException ex)
            {
                QTUtils qtu = new QTUtils();
                Console.WriteLine("Error occurred: " + ex.ErrorCode.ToString("x") + " " + qtu.QTErrorFromErrorCode(ex.ErrorCode).ToString());
            }
            qtc.URL = "";
            frm.Dispose();
        }
开发者ID:fruitsamples,项目名称:QTControlCommandLine,代码行数:101,代码来源:MyExporter.cs

示例4: B_Mass_Edit_Click


//.........这里部分代码省略.........
                bool[] badgeChecks = getBadgeChecks();
                int[] badgeInts = { (TB_PastContest.Text == "") ? 0 : int.Parse(TB_PastContest.Text), (TB_PastBattle.Text == "") ? 0 : int.Parse(TB_PastBattle.Text), comboBox1.SelectedIndex, (int) numericUpDown1.Value };

                bool[] symbolChecks = { CHK_Circle.Checked, CHK_Triangle.Checked, CHK_Square.Checked, CHK_Heart.Checked, CHK_Star.Checked, CHK_Diamond.Checked };

                string[] contestStats = { TB_Cool.Text, TB_Beauty.Text, TB_Cute.Text, TB_Smart.Text, TB_Tough.Text, TB_Sheen.Text };

                string gender = Label_Gender.Text;

                if (CHK_Unshiny.Checked)
                {
                    modes.Add(1);
                }
                if (CHK_ChangeOT.Checked)
                {
                    modes.Add(2);
                }
                if (CHK_DeleteNicknames.Checked)
                {
                    modes.Add(3);
                }
                if (CHK_Perfect_IVs.Checked)
                {
                    modes.Add(4);
                }
                if (CHK_Reroll.Checked)
                {
                    modes.Add(5);
                }
                if (CHK_Frienship.Checked)
                {
                    modes.Add(6);
                }
                if (CHK_Level.Checked)
                {
                    modes.Add(7);
                }
                if (CHK_Met.Checked)
                {
                    modes.Add(8);
                }
                if (CHK_Country.Checked)
                {
                    modes.Add(9);
                }
                if (CHK_Memories.Checked)
                {
                    modes.Add(10);
                }
                if (CHK_PPMax.Checked)
                {
                    modes.Add(11);
                }
                if (CHK_Shiny.Checked)
                {
                    modes.Add(12);
                }
                if (CHK_Badges.Checked)
                {
                    modes.Add(13);
                }
                if (CHK_No_Pokerus.Checked)
                {
                    modes.Add(14);
                }
                if (CHK_Symbols.Checked)
                {
                    modes.Add(15);
                }
                if (CHK_Contest.Checked)
                {
                    modes.Add(16);
                }
                if (CHK_Gender.Checked)
                {
                    modes.Add(17);
                }

                string filename = Path.GetFileNameWithoutExtension(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
                // thread for free UI
                thread = new Thread(delegate() {
                    Form1 f1 = new Form1(litems, modes, this.progressBar1, ret, friendship, level, m, bak, otindexes, countrybool, metbool, otbool, amienabled, amiindex, otgenders, (filename.IndexOf("Mess") >= 0), amilite, amilitebool, amiliteint, allintobox, badgeChecks, badgeInts, symbolChecks, contestStats, gender);
                    f1.Form1_Load(new object(), new EventArgs());
                    f1.Dispose();
                });

                thread.SetApartmentState(ApartmentState.STA);

                // thread2 is basically my thread_finished_Eventhandler
                thread2 = new Thread(delegate() {
                    thread.Join();
                    this.BeginInvoke((MethodInvoker)delegate {
                        enableAll(); running = false;
                    });
                });

                thread.Start();
                thread2.Start();
            }
        }
开发者ID:deathsh3admoth,项目名称:Mass-Editor,代码行数:101,代码来源:OverForm.cs


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