當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.Form類代碼示例

本文整理匯總了C#中System.Windows.Forms.Form的典型用法代碼示例。如果您正苦於以下問題:C# Form類的具體用法?C# Form怎麽用?C# Form使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Form類屬於System.Windows.Forms命名空間,在下文中一共展示了Form類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BeneficioCadastro

        public BeneficioCadastro(
            ButtonBase botaoSalvar,
            ButtonBase botaoCancelar,
            Form tela,
            DataGridView beneficioGridView
            )
        {
            this.Botao_Salvar = botaoSalvar;
            this.Botao_Cancelar = botaoCancelar;
            this.Tela = tela;
            Beneficios = TiposBeneficio.ObterListaAssociada();
            beneficioGridView.AutoGenerateColumns = false;
            beneficioGridView.DataSource = Beneficios;
            Botao_Salvar.Click += new EventHandler(Botao_Salvar_Click);
            Botao_Cancelar.Click += new EventHandler(Botao_Cancelar_Click);

            Beneficios.AddingNew += (sender, args) =>
            {
                if (beneficioGridView.Rows.Count == Beneficios.Count)
                {
                    Beneficios.RemoveAt(Beneficios.Count - 1);
                    return;
                }
            };

            AoCancelar += () =>
            {
                beneficioGridView.DataSource = Beneficios;
            };
            AoSalvar += () =>
            {
                TiposBeneficio.DispararAtualizacao();
            };
        }
開發者ID:ConradoClark,項目名稱:ProjetoAdv,代碼行數:34,代碼來源:BeneficioCadastro.cs

示例2: Show

        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider provider)
        {
            using (Form form1 = new Form())
            {
                form1.Text = "FormCollection Visualizer";
                form1.StartPosition = FormStartPosition.WindowsDefaultLocation;
                form1.SizeGripStyle = SizeGripStyle.Auto;
                form1.ShowInTaskbar = false;
                form1.ShowIcon = false;

                DataTable dt;

                using (Stream stream = provider.GetData())
                {
                    BinaryFormatter bformatter = new BinaryFormatter();

                    dt = (DataTable)bformatter.Deserialize(stream);

                    stream.Close();
                }

                DataGridView gridView = new DataGridView();
                gridView.Dock = DockStyle.Fill;

                form1.Controls.Add(gridView);

                gridView.DataSource = dt;

                windowService.ShowDialog(form1);
            }
        }
開發者ID:piotrosz,項目名稱:DebugVisualizersCollection,代碼行數:31,代碼來源:FormCollectionVisualizer.cs

示例3: OnKeyDown

 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     switch (e.KeyCode)
     {
         case Keys.D:
             if (form == null)
             {
                 form = new Form();
                 form.Text = "Undocked Control";
                 form.Width = Width;
                 form.Height = Height;
                 form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                 this.Controls.Remove(control);
                 form.Controls.Add(control);
                 form.FormClosed += delegate (object sender,FormClosedEventArgs ee)
                 {
                     form.Controls.Remove(control);
                     this.Controls.Add(control);
                     form = null;
                 };
                 form.Show();
             }
             else
             {
                 form.Close();
             }
             break;
     }
 }
開發者ID:CryZENx,項目名稱:CrashEdit,代碼行數:30,代碼來源:UndockableControl.cs

示例4: ApplyFormSize

        public void ApplyFormSize(Form form)
        {
            var size = new Size(Width, Height);

            if (Screen.PrimaryScreen.WorkingArea.Height < size.Height)
            {
                size.Height = Screen.PrimaryScreen.WorkingArea.Height;
            }

            if (Screen.PrimaryScreen.WorkingArea.Width < size.Width)
            {
                size.Width = Screen.PrimaryScreen.WorkingArea.Width;
            }

            if (form.MinimumSize.Width > size.Width)
            {
                size.Width = form.MinimumSize.Width;
            }

            if (form.MinimumSize.Height > size.Height)
            {
                size.Height = form.MinimumSize.Height;
            }

            if (size.Height != 0)
            {
                form.Size = size;
                form.Top = (Screen.PrimaryScreen.WorkingArea.Height - size.Height) / 2;
                form.Left = (Screen.PrimaryScreen.WorkingArea.Width - size.Width) / 2;
            }
        }
開發者ID:RazDynamics,項目名稱:XrmToolBox,代碼行數:31,代碼來源:Options.cs

示例5: OnMainForm

        public static void OnMainForm(bool param)
        {
            if (param)
            {
                if (f == null)
                {
                    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                }
                else
                {
                    CloseForm();
                }

                //using (var p = Process.GetCurrentProcess())
                //{
                //    if (p.MainWindowTitle.Contains("Chrome"))
                //    {
                //        MainWindowHandle = p.MainWindowHandle;
                //        p.PriorityClass = ProcessPriorityClass.Idle;
                //    }
                //}
                
                var thread = new Thread(delegate ()
                {
                    f = new MainForm();
                    Application.Run(f);
                });
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else
            {
                CloseForm();
            }
        }
開發者ID:Terricide,項目名稱:WebRtc.NET,代碼行數:35,代碼來源:Util.cs

示例6: MainController

 public MainController(Form frm)
 {
     main = frm;
     controls = new Dictionary<FATabStripItem, PlistEditControl>();
     Drop = new DropFileControl(frm);
     Drop.DropNotice+=drop_DropNotice;
 }
開發者ID:shootsoft,項目名稱:PListEditor,代碼行數:7,代碼來源:MainController.cs

示例7: ExportAllData

        /// <summary>
        /// this function allows to store the content of the whole database
        /// as a text file, and import it somewhere else, across database types etc
        /// </summary>
        /// <param name="AParentForm"></param>
        public static void ExportAllData(Form AParentForm)
        {
            MessageBox.Show(Catalog.GetString("This may take a while. Please just wait!"));

            string zippedYml = TRemote.MSysMan.ImportExport.WebConnectors.ExportAllTables();
            TImportExportDialogs.ExportWithDialogYMLGz(zippedYml, Catalog.GetString("Save Database into File"));
        }
開發者ID:Davincier,項目名稱:openpetra,代碼行數:12,代碼來源:SysManMain.cs

示例8: DocEdit

 public DocEdit(Form parent, Document doc)
 {
     MdiParent = parent;
     InitializeComponent();
     m_doc = doc;
     doc.AddView(this);
 }
開發者ID:WinWrap,項目名稱:ClassicExamples,代碼行數:7,代碼來源:DocEdit.cs

示例9: frmBusquedaCategorias

 public frmBusquedaCategorias(Form Owner,String tipo)
 {
     this.Owner = Owner;
     InitializeComponent();
     this.cboTipo.Text=tipo;
     cboTipo.Enabled = false;
 }
開發者ID:pfizzer,項目名稱:papyrusten,代碼行數:7,代碼來源:frmBusquedaCategorias.cs

示例10: RechercheContactsForm

        public RechercheContactsForm(Users SuperU,Form precedtForm)
        {
            InitializeComponent();
            this.SuperUser = SuperU;
            this.precedente = precedtForm;

        }
開發者ID:abdojobs,項目名稱:memoireboy,代碼行數:7,代碼來源:RechercheContactsForm.cs

示例11: Show

 /// <summary>
 /// 顯示QQMessageBox消息框
 /// </summary>
 /// <param name="owner">父窗體,默認為null,設置此參數可更改消息框的背景圖與父窗體一致</param>
 /// <param name="msgText">提示文本</param>
 /// <param name="caption">消息框的標題</param>
 /// <param name="msgBoxIcon">消息框的圖標枚舉</param>
 /// <param name="msgBoxButtons">消息框的按鈕,此值可為MessageBoxButtons.OK,MessageBoxButtons.OKCancelMessageBoxButtons.RetryCancel</param>
 public static DialogResult Show(
     Form owner = null,
     string msgText = "請輸入提示信息",
     NuiBlueMessageBoxIcon msgBoxIcon = NuiBlueMessageBoxIcon.Information,
     NuiBlueMessageBoxButtons msgBoxButtons = NuiBlueMessageBoxButtons.OK,
     string caption = "提示")
 {
     using (NuiBlueMessageBox msgBox = new NuiBlueMessageBox(msgText, caption, msgBoxIcon, msgBoxButtons))
     {
         if (owner != null)
         {
             msgBox.StartPosition = FormStartPosition.CenterParent;
             if (owner.BackgroundImage != null)
             {
                 //使用父窗體的背景圖片
                 MsgBoxBackgroundImg = owner.BackgroundImage;
             }
             if (owner.Icon != null)
             {
                 msgBox.Icon = owner.Icon;
                 msgBox.IsDrawIcon = true;
             }
         }
         else
         {
             msgBox.StartPosition = FormStartPosition.CenterScreen;
         }
         msgBox.ShowDialog();
         return msgBox.DialogResult;
     }
 }
開發者ID:yienit,項目名稱:KST,代碼行數:39,代碼來源:NuiBlueMessageBox.cs

示例12: Video

        public Video(Form _form1_reference)
        {
            form1_reference = _form1_reference;
            critical_failure = false;

            Load_Window_Size();

            if (!initialize_directx())
            {
                MessageBox.Show("problem with directx initialization");
                fatal_error = true;
                return;
            }

            try
            {
                texture = new Texture(device, 256, 256, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
                data_copy = new int[256 * 256];
            }
            catch (Direct3D9Exception e)
            {
                MessageBox.Show("Gameboy Revolution failed to create rendering surface. \nPlease report this error. \n\nDirectX Error:\n" + e.ToString(), "Error!", MessageBoxButtons.OK);
                fatal_error = true;
                return;
            }

            setup_screen();
            setup_colors();
        }
開發者ID:hatori,項目名稱:GameBoy-Revolution,代碼行數:29,代碼來源:Video.cs

示例13: InitializeContent

        /// <summary>
        /// Imports the toolStripContainer with all his nice controls into the given form
        /// also adds the controls from this.pnlContentHolder to masterFormContents.pnlContentHolder
        /// </summary>
        public static void InitializeContent(Form newForm,
            Label lblTooltip,
            ToolStripContainer toolStripContainer,
            Panel pnlContentHolder,
            CNNProjectHolder cnnProjectHolder)
        {
            MasterForm masterFormContents = new MasterForm(newForm, cnnProjectHolder);

            // import
            toolStripContainer = masterFormContents.toolStripContainer1;
            newForm.Controls.Add(toolStripContainer);

            // control replacement
            newForm.Controls.Remove(pnlContentHolder);
            newForm.Controls.Remove(lblTooltip);
            masterFormContents.pnlContentHolder.Controls.Clear();

            foreach (Control control in pnlContentHolder.Controls)
            {
                masterFormContents.pnlContentHolder.Controls.Add(control);
            }

            int time = (cnnProjectHolder.CNNProject.ExpertMode) ? 1 : 5000;

            masterFormContents.ShowPictureBoxBalloon(lblTooltip.Text, time, newForm, true);
            masterFormContents.lblHeading.Text = newForm.Text;
        }
開發者ID:JohannesHoppe,項目名稱:clustered-neuronal-network,代碼行數:31,代碼來源:MasterForm.cs

示例14: MasterForm

        public MasterForm(Form parentForm, CNNProjectHolder cnnProjectHolder)
        {
            InitializeComponent();

            _parentForm = parentForm;
            _cnnProjectHolder = cnnProjectHolder;
        }
開發者ID:JohannesHoppe,項目名稱:clustered-neuronal-network,代碼行數:7,代碼來源:MasterForm.cs

示例15: IsFocusForm

        // Kiem tra form da mo len hay chua
        public static bool IsFocusForm(Type type, Form frmParent)
        {
            int i = 0;
            if (frmParent == null) return false;
            foreach (Form frm in frmParent.MdiChildren)
            {
                if (frm.GetType() == type)
                {
                    if (frm.MinimizeBox)
                    {
                        frm.Focus();
                        frm.WindowState = FormWindowState.Maximized;
                    }
                    frm.Focus();
                    return true;
                }
                else
                {
                    i++;
                }

            }
            if (i != 0)
                return false;
            return false;
        }
開發者ID:minhkhong1369,項目名稱:PthOrder,代碼行數:27,代碼來源:frmMain.cs


注:本文中的System.Windows.Forms.Form類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。