• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.Form类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Form类属于System.Windows.Forms命名空间,在下文中一共展示了Form类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: RightClickTitleBarDialog

        public RightClickTitleBarDialog(Form frm)
        {
            this.form = frm;
            try
            {
                m_SystemMenu = SystemMenu.FromForm(frm);

                m_SystemMenu.AppendSeparator();

                if (FrameworkParams.isSupportDeveloper)
                    m_SystemMenu.AppendMenu(m_FormInfo, MENU_TITLE_FORM_INFO_TEXT);
                if (this is IFormRefresh)
                {
                    m_SystemMenu.AppendMenu(m_RefreshForm, MENU_TITLE_FORM_REFRESH_TEXT);
                }
                if (this is IFormFURL)
                {
                    m_SystemMenu.AppendMenu(m_FURL, MENU_TITLE_FORM_FURL_TEXT);
                }

                m_SystemMenu.AppendSeparator();
            }
            catch (NoSystemMenuException /* err */ )
            {
                // Do some error handling
            }
        }
开发者ID:khanhdtn,项目名称:my-fw-win,代码行数:27,代码来源:RightClickTitleBarDialog.cs


示例17: Initialize

    protected override void Initialize()
    {
      base.Initialize();

      // Get the standard XNA window.
      _gameForm = Control.FromHandle(Window.Handle) as Form;

#if MONOGAME
      // Create a "virtual file system" for reading game assets.
      var titleStorage = new TitleStorage("Content");
      var assetsStorage = new ZipStorage(titleStorage, "Content.zip");
      var drStorage = new ZipStorage(titleStorage, "DigitalRune.zip");
      var vfsStorage = new VfsStorage();
      vfsStorage.MountInfos.Add(new VfsMountInfo(titleStorage, null));
      vfsStorage.MountInfos.Add(new VfsMountInfo(assetsStorage, null));
      vfsStorage.MountInfos.Add(new VfsMountInfo(drStorage, null));

      Content = new StorageContentManager(Services, vfsStorage);
#else
      Content.RootDirectory = "Content";
#endif
      // Create the DigitalRune GraphicsManager.
      _graphicsManager = new GraphicsManager(GraphicsDevice, Window, Content);

      // Add graphics service to service provider
      Services.AddService(typeof(IGraphicsService), _graphicsManager);

      // Add a few GraphicsScreens that draw stuff.
      _graphicsManager.Screens.Add(new BackgroundGraphicsScreen(_graphicsManager));
      _graphicsManager.Screens.Add(new TriangleGraphicsScreen(_graphicsManager));
      _graphicsManager.Screens.Add(new TextGraphicsScreen(_graphicsManager, Content));
    }
开发者ID:,项目名称:,代码行数:32,代码来源:


示例18: centerFormTo

 private void centerFormTo(Form form, Form containerForm)
 {
     Point point = new Point();
     Size formSize = form.Size;
     Rectangle workingArea = Screen.GetWorkingArea(containerForm);
     Rectangle rect = containerForm.Bounds;
     point.X = ((rect.Left + rect.Right) - formSize.Width) / 2;
     if (point.X < workingArea.X)
     {
         point.X = workingArea.X;
     }
     else if ((point.X + formSize.Width) > (workingArea.X + workingArea.Width))
     {
         point.X = (workingArea.X + workingArea.Width) - formSize.Width;
     }
     point.Y = ((rect.Top + rect.Bottom) - formSize.Height) / 2;
     if (point.Y < workingArea.Y)
     {
         point.Y = workingArea.Y;
     }
     else if ((point.Y + formSize.Height) > (workingArea.Y + workingArea.Height))
     {
         point.Y = (workingArea.Y + workingArea.Height) - formSize.Height;
     }
     form.Location = point;
 } 
开发者ID:vjohnson01,项目名称:Tools,代码行数:26,代码来源:frmAbout.cs


示例19: Form3

 public Form3(Form formPai,Arvore arvore)
 {
     InitializeComponent();
     this.formPai = formPai;
     this.formPai.Hide();
     this.arvore = arvore;
 }
开发者ID:DiegoAguiar,项目名称:GuessingGame,代码行数:7,代码来源:Form3.cs


示例20: ShowConfirm

 public static ConfirmSaveLPSResult ShowConfirm(Form parent, string caption)
 {
     if (FrameworkParams.wait != null) FrameworkParams.wait.Finish();
     frmConfirmSaveReplaceLPS frm = new frmConfirmSaveReplaceLPS(caption);
     frm.ShowDialog(parent);
     return frm.Result;
 }
开发者ID:khanhdtn,项目名称:did-vlib-2011,代码行数:7,代码来源:frmConfirmSaveReplaceLPS.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.FormClosedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Forms.FontDialog类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap