本文整理汇总了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();
};
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例6: MainController
public MainController(Form frm)
{
main = frm;
controls = new Dictionary<FATabStripItem, PlistEditControl>();
Drop = new DropFileControl(frm);
Drop.DropNotice+=drop_DropNotice;
}
示例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"));
}
示例8: DocEdit
public DocEdit(Form parent, Document doc)
{
MdiParent = parent;
InitializeComponent();
m_doc = doc;
doc.AddView(this);
}
示例9: frmBusquedaCategorias
public frmBusquedaCategorias(Form Owner,String tipo)
{
this.Owner = Owner;
InitializeComponent();
this.cboTipo.Text=tipo;
cboTipo.Enabled = false;
}
示例10: RechercheContactsForm
public RechercheContactsForm(Users SuperU,Form precedtForm)
{
InitializeComponent();
this.SuperUser = SuperU;
this.precedente = precedtForm;
}
示例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;
}
}
示例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();
}
示例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;
}
示例14: MasterForm
public MasterForm(Form parentForm, CNNProjectHolder cnnProjectHolder)
{
InitializeComponent();
_parentForm = parentForm;
_cnnProjectHolder = cnnProjectHolder;
}
示例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;
}