本文整理汇总了C#中System.Windows.Forms.Button.BringToFront方法的典型用法代码示例。如果您正苦于以下问题:C# Button.BringToFront方法的具体用法?C# Button.BringToFront怎么用?C# Button.BringToFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Button
的用法示例。
在下文中一共展示了Button.BringToFront方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NinePointsEnigmaPanel
/// <summary>
/// Affichage de l'énigme 9 points
/// </summary>
public NinePointsEnigmaPanel()
{
this.Height = 800; //change la taille du panel "parent"
/*Initialise la PictureBox*/
pcbCase9Points.Size = this.Size;
pcbCase9Points.BackgroundImage = Properties.Resources.NinePoints;
pcbCase9Points.Click += new System.EventHandler(MouseClick_Affiche9Points);
pcbCase9Points.MouseMove += new MouseEventHandler(MouseMove_Afficher9Points);
pcbCase9Points.Paint += new PaintEventHandler(Paint_pcbCase9Points);
Controls.Add(pcbCase9Points);
/*Initialise bouton recommencer*/
Button btnRecommencer = new Button();
btnRecommencer.Font = new Font("Microsoft Sans Serif", 19);
btnRecommencer.Text = "Recommencer";
btnRecommencer.AutoSize = true;
btnRecommencer.Click += new EventHandler(MouseClick_btnRecommencer);
btnRecommencer.Location = new Point(this.Left + 10, this.Top + 750);
Controls.Add(btnRecommencer);
btnRecommencer.BringToFront();
/*Initialise les positions du centre des points*/
for (int i = 0, iX = 200, iY = 200; i < tCentrePoint.Length; i++, iX += 200)
{
if (i % 3 == 0 && i != 0) //permet de changer de ligne dans un axe x, y
{
iY += 200;
iX = 200;
}
tCentrePoint[i] = new Point(iX, iY);
}
}
示例2: CreateButton
// TODO: fix button creation using ImageList, and resize images to other size, tooltips.
// Yes, we doesn't use any *Strip controls, 'cause from one side they are really buggy, and from other side - this code more similar to GTK port.
private Button CreateButton(string title, string stockImage, EventHandler action, DockStyle dockStyle = DockStyle.Left)
{
var button = new Button();
button.Image = Image.FromStream(GetImageStream(stockImage));
button.Width = 36; // button.Image.Width;
button.Height = 36; // button.Image.Height;
button.Text = "";
button.TextImageRelation = TextImageRelation.Overlay;
button.ImageAlign = ContentAlignment.MiddleCenter;
button.TextAlign = ContentAlignment.MiddleCenter;
button.Parent = this;
button.Dock = dockStyle;
button.BringToFront();
button.Click += action;
return button;
}
示例3: MinimizeButton
public static void MinimizeButton(Button currentButton)
{
try
{
Point currentLocation = new System.Drawing.Point(currentButton.Location.X, currentButton.Location.Y);
currentButton.Width = currentButton.Width - maximizeValue;
currentButton.Height = currentButton.Height - maximizeValue;
currentLocation.X = currentLocation.X + (maximizeValue / 2);
currentLocation.Y = currentLocation.Y + (maximizeValue / 2);
currentButton.Location = currentLocation;
currentButton.BringToFront();
}
catch (Exception) { }
}
示例4: Ship
public Ship(int number, int ship_length, string name)
{
on_playboard = false;
length = ship_length;
horizontal = true;
System.Windows.Forms.Button button1 = new System.Windows.Forms.Button();
button1.Location = new System.Drawing.Point(100, 30*number);
button1.Text = "S_" + length;
button1.Name = name;
button1.Size = new System.Drawing.Size(25*length, 25);
button1.TabIndex = 0;
button1.MouseClick += new System.Windows.Forms.MouseEventHandler(ship_Click);
location = button1.Location;
button = button1;
MainForm.mainform.Controls.Add(button1);
button1.BringToFront();
}
示例5: CreateMidiChordFormButton
private void CreateMidiChordFormButton(int x, int y, int i)
{
Button b = new Button();
b.Location = new System.Drawing.Point(x, y);
b.Size = new System.Drawing.Size(27, 24);
b.Tag = i;
//b.UseVisualStyleBackColor = false;
b.Text = (i + 1).ToString();
b.MouseDown += new MouseEventHandler(PaletteChordFormButton_MouseDown);
this.Controls.Add(b);
_paletteChordFormButtons.Add(b);
b.BringToFront();
}
示例6: updateImagesMap
public void updateImagesMap(int debut, int fin)
{
// affiche toutes les images dans la période passée en paramètre
foreach (Button but in maListeBouttons) {
this.Controls.Remove(but);
}
for (int i = debut; i < fin; i++) {
Journee jour = maFenetrePrec.maMission.monPlanning.monTableauJournees[i-1];
foreach (Activite act in jour.maListeActivites) {
if (act.enExterieur == true) {
Button btnImg = new Button();
btnImg.Text = "";
btnImg.Width = 22;
btnImg.Height = 22;
btnImg.Visible = true;
btnImg.Enabled = true;
btnImg.Location = new System.Drawing.Point(686 + -8 + 700/3 + act.monLieu.maPosX / 3, 25 - 8 + 1000/3 + act.monLieu.maPosY / 3);
//btnImg.Location = new System.Drawing.Point(480,25);
btnImg.Click += new System.EventHandler(img_click);
Bitmap image = (Bitmap)Image.FromFile(@"..//..//Images//vehiculePasse.png", true);
btnImg.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
if (jour.monNumero < maFenetrePrec.maMission.monJourJ) { // activités passées
if (act.monNom == "Vehicle") {
image = (Bitmap)Image.FromFile(@"..//..//Images//vehiculePasse.png", true);
} else if (act.monNom == "Space suit") {
image = (Bitmap)Image.FromFile(@"..//..//Images//astroPasse.png", true);
} else if (act.monNom == "Outside experiment") {
image = (Bitmap)Image.FromFile(@"..//..//Images//expePasse.png", true);
}
} else {
if (act.monNom == "Vehicle") {
image = (Bitmap)Image.FromFile(@"..//..//Images//vehiculeFutur.png", true);
} else if (act.monNom == "Space suit") {
image = (Bitmap)Image.FromFile(@"..//..//Images//astroFutur.png", true);
} else if (act.monNom == "Outside experiment") {
image = (Bitmap)Image.FromFile(@"..//..//Images//expeFutur.png", true);
}
}
btnImg.Image = image;
btnImg.BringToFront();
btnImg.Name = monNbActExtTrouve.ToString();
maListeBouttons.Add(btnImg);
maListeActivite.Add(act);
maListeJours.Add(jour.monNumero);
monNbActExtTrouve++;
this.Controls.Add(btnImg);
}
}
}
foreach (Button but in maListeBouttons) {
but.Visible = true;
but.Enabled = true;
but.BringToFront();
}
}
示例7: CreateAudioSampleButton
private void CreateAudioSampleButton(int x, int y, int i)
{
Button b = new Button();
b.Location = new System.Drawing.Point(x, y);
b.Size = new System.Drawing.Size(27, 24);
b.Tag = new MoritzMediaPlayer(PlayerHasStopped); // the associated media player
b.Image = global::Moritz.Globals.Properties.Resources.noFile23x20;
b.UseVisualStyleBackColor = false;
b.MouseDown += new MouseEventHandler(AudioSampleButton_MouseDown);
this.Controls.Add(b);
_audioSampleButtons.Add(b);
b.BringToFront();
}
示例8: ShowInfoPage
public void ShowInfoPage()
{
this.SuspendLayout();
WebBrowser webStart = new WebBrowser();
PNLlist.Controls.Add(webStart);
webStart.Visible = false;
webStart.ScriptErrorsSuppressed = true;
webStart.ScrollBarsEnabled = false;
webStart.Dock = DockStyle.Fill;
webStart.BringToFront();
Button btnClose = new Button();
this.Controls.Add(btnClose);
btnClose.Visible = false;
btnClose.Size = new Size(PNLlist.Width - 6, 35);
btnClose.Location = new Point(15, PNLlist.Height - 39 + 39);
btnClose.FlatAppearance.BorderColor = Color.Gray;
btnClose.BackColor = Color.FromArgb(64, 64, 64);
btnClose.ForeColor = Color.WhiteSmoke;
btnClose.Text = "Close";
btnClose.FlatStyle = FlatStyle.Flat;
btnClose.BringToFront();
this.ResumeLayout();
btnClose.Click += (e, s) =>
{
PNLlist.Controls.Remove(webStart);
this.Controls.Remove(btnClose);
};
webStart.Navigated += (e, s) =>
{
if (!webStart.Document.ToString().ToLower().Contains("checking your"))
{
webStart.Show();
btnClose.Show();
}
};
webStart.Navigate("http://www.realmbot.xyz/hello.html");
}
示例9: eventHandler_ShowCloseButton
void eventHandler_ShowCloseButton(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (buttonHelpEnd != null) return;
buttonHelpEnd = new Button();
buttonHelpEnd.Parent = this;
int size = Math.Min(this.Width, this.Height) / 12;
buttonHelpEnd.Top = 0;
buttonHelpEnd.Left = this.Width - 2 * size;
buttonHelpEnd.Width = size;
buttonHelpEnd.Height = size;
buttonHelpEnd.Text = "X";
buttonHelpEnd.Click += HelpEndClick;
buttonHelpEnd.BringToFront();
}
示例10: CreateParent
//delegate_UpdateListOfNotes UpdateListOfNotes;
public void CreateParent(LayoutPanelBase _Layout)
{
ParentNotePanel = new NotePanel (this);
//ParentNotePanel.Visible = false;
// ParentNotePanel.SuspendLayout ();
ParentNotePanel.Visible = true;
ParentNotePanel.Location = Location;
ParentNotePanel.Dock = System.Windows.Forms.DockStyle.None;
ParentNotePanel.Height = Height;
ParentNotePanel.Width = Width;
ParentNotePanel.Dock = this.Dock;
try {
_Layout.NoteCanvas.Controls.Add (ParentNotePanel);
} catch (Exception ex) {
lg.Instance.Line ("CreateParent", ProblemType.EXCEPTION, "Unable to create note after changing properties" + ex.ToString ());
throw new Exception ("Failed to add control");
}
CaptionLabel = new ToolStrip ();
// must be false for height to matter
CaptionLabel.AutoSize = false;
// CaptionLabel.SuspendLayout ();
CaptionLabel.Click += (object sender, EventArgs e) => BringToFrontAndShow ();
// CaptionLabel.DoubleClick += HandleCaptionLabelDoubleClick;
CaptionLabel.MouseDown += HandleMouseDown;
CaptionLabel.MouseUp += HandleMouseUp;
CaptionLabel.MouseLeave += HandleMouseLeave;
CaptionLabel.MouseMove += HandleMouseMove;
CaptionLabel.Parent = ParentNotePanel;
CaptionLabel.BackColor = Color.Green;
CaptionLabel.Dock = DockStyle.Fill;
CaptionLabel.GripStyle = ToolStripGripStyle.Hidden;
captionLabel = new ToolStripLabel (this.Caption);
captionLabel.ToolTipText = Loc.Instance.GetString ("TIP: Doubleclick this to set the note to its regular size");
captionLabel.MouseDown += HandleMouseDown;
captionLabel.MouseUp += HandleMouseUp;
//captionLabel.MouseLeave += HandleMouseLeave;
captionLabel.MouseMove += HandleMouseMove;
captionLabel.DoubleClickEnabled = true;
captionLabel.DoubleClick+= HandleCaptionLabelDoubleClick;
CaptionLabel.Items.Add (captionLabel);
//if (Caption == "") NewMessage.Show ("Caption is blank");
properties = new ToolStripDropDownButton ("");
properties.Image = CoreUtilities.FileUtils.GetImage_ForDLL ("application_form_edit.png");
CaptionLabel.Items.Add (properties);
MinimizeButton = new ToolStripButton ();
//MinimizeButton.Text = "--";
MinimizeButton.Image = CoreUtilities.FileUtils.GetImage_ForDLL ("application_put.png");
MinimizeButton.ToolTipText = "Hides the note. Bring it back by using the List or a Tab";
MinimizeButton.Click += HandleMinimizeButtonClick;
MaximizeButton = new ToolStripButton ();
//MaximizeButton.Text = "[ ]";
MaximizeButton.Image = CoreUtilities.FileUtils.GetImage_ForDLL ("application_xp.png");
MaximizeButton.ToolTipText = Loc.Instance.GetString ("Fills available screen");
MaximizeButton.Click += HandleMaximizeButtonClick;
if (true == IsSystemNote) {
// not really a delete, more of a close
ToolStripButton closeButton = new ToolStripButton ();
//closeButton.Text = " X ";
closeButton.Image = CoreUtilities.FileUtils.GetImage_ForDLL ("delete_x.png");
closeButton.Click += HandleCloseClick;
;
CaptionLabel.Items.Add (closeButton);
//closeButton.Anchor = AnchorStyles.Right;
closeButton.Alignment = ToolStripItemAlignment.Right;
// ToolStripItem item = new ToolStripItem();
//item.ToolStripItemAlignment = ToolStripItemAlignment.Right;
//closeButton.Dock = DockStyle.Right;
}
if (false == IsSystemNote) {
ToolStripTextBox captionEditor = new ToolStripTextBox ();
captionEditor.Text = Caption;
captionEditor.TextChanged += HandleCaptionTextChanged;
captionEditor.KeyDown += HandleCaptionEditorKeyDown;
properties.DropDownItems.Add (captionEditor);
}
CaptionLabel.Items.Add (MaximizeButton);
MaximizeButton.Alignment = ToolStripItemAlignment.Right;
CaptionLabel.Items.Add (MinimizeButton);
MinimizeButton.Alignment = ToolStripItemAlignment.Right;
//contextMenu = new ContextMenuStrip();
ToolStripButton BringToFront = new ToolStripButton ();
BringToFront.Text = Loc.Instance.Cat.GetString ("Bring to Front");
BringToFront.Click += HandleBringToFrontClick;
//.........这里部分代码省略.........
示例11: popContactPlayer
public popContactPlayer( byte player, byte other)
{
/* this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;*/
platformSpec.setFloatingWindow.before( this );
platformSpec.manageWindows.setUserInputSize( this );
this.ControlBox = false;
#region heart
this.Text = "Contact";
this.player = player;
this.other = other;
int ySpaces = 8, butHeight = 24, butWidth = 100;
byte butPos = 0;
this.Width = butWidth + 2 * ySpaces;
Button cmdNegotiate = new Button();
cmdNegotiate.Text = "Negotiate";
cmdNegotiate.Width = butWidth;
cmdNegotiate.Height = butHeight;
cmdNegotiate.Left = this.Width / 2 - cmdNegotiate.Width / 2;
cmdNegotiate.Top = butPos * ( butHeight + ySpaces ) + ySpaces; //this.Height * butPos / 5 - cmdNegotiate.Height / 2 + 11;
cmdNegotiate.Click += new EventHandler( cmdNegotiate_Click );
#if !CF
cmdNegotiate.FlatStyle = FlatStyle.System;
#endif
butPos++;
if ( Form1.game.playerList[ player ].foreignRelation[ other ].politic != (byte)Form1.relationPolType.war )
{
Button cmdDeclareWar = new Button();
cmdDeclareWar.Text = "Declare war!";
cmdDeclareWar.Width = butWidth;
cmdDeclareWar.Height = butHeight;
cmdDeclareWar.Left = this.Width / 2 - cmdDeclareWar.Width / 2;
cmdDeclareWar.Top = butPos * ( butHeight + ySpaces ) + ySpaces; //this.Height * butPos / 5 - cmdDeclareWar.Height / 2 + 11;
cmdDeclareWar.Click += new EventHandler( cmdDeclareWar_Click );
#if !CF
cmdDeclareWar.FlatStyle = FlatStyle.System;
#endif
butPos++;
this.Controls.Add( cmdDeclareWar );
}
Button cmdCancel = new Button();
cmdCancel.Text = "Cancel";
cmdCancel.Width = butWidth;
cmdCancel.Height = butHeight;
cmdCancel.Left = this.Width / 2 - cmdCancel.Width / 2;
cmdCancel.Top = butPos * ( butHeight + ySpaces ) + ySpaces; //this.Height * 4 / 5 - cmdCancel.Height / 2 + 11;
cmdCancel.Click += new EventHandler( cmdCancel_Click );
#if !CF
cmdCancel.FlatStyle = FlatStyle.System;
#endif
this.Controls.Add( cmdNegotiate );
this.Controls.Add( cmdCancel );
cmdNegotiate.BringToFront();
cmdCancel.BringToFront();
/* Size cs = new Size( (int)(butWidth + 2 * ySpaces), (int)(cmdCancel.Bottom + ySpaces) );
this.ClientSize = cs;*/
/* int tempW = (int)(butWidth + 2 * ySpaces);
int tempH = (int)(); = tempW;
this.Width = tempH;*/
this.Height = cmdCancel.Bottom + ySpaces;
#endregion
platformSpec.setFloatingWindow.after( this );
#region floating
/*
// Mémorise la zone cliente avant le changement de style
Size aireAvant = this.ClientSize;
// Récupèrer le handle de la fenêtre
IntPtr hWnd = Win32Window.FromControl( this );
// Liste des styles à enlever (voir article)
int enleves = (int)( Win32Window.WindowStyle.WS_SYSMENU | Win32Window.WindowStyle.WS_MINIMIZEBOX | Win32Window.WindowStyle.WS_MAXIMIZEBOX );
// Liste des styles à ajouter
int ajoutes = (int)( Win32Window.WindowStyle.WS_CAPTION | Win32Window.WindowStyle.WS_POPUP );
// Mise à jour du style de la fenêtre
Win32Window.UpdateWindowStyle( hWnd, enleves, ajoutes );
// Mesure l'aide cliente après le changement de style
Size aireApres = this.ClientSize;
// Restitue la taille de l'aire cliente
aireApres.Width += aireAvant.Width - aireApres.Width;
aireApres.Height += aireAvant.Height - aireApres.Height;
this.ClientSize = aireApres;
this.Left = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 2 - this.Width / 2;
this.Top = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height / 2 - this.Height / 2;
*/
//.........这里部分代码省略.........
示例12: SelectFields
private void SelectFields(ListView lvSrc, ListView lvDes, Boolean All)
{
int I;
ListViewItem Item;
ListViewItem.ListViewSubItem LVSI;
for (I = 0; I < lvSrc.Items.Count; I++)
{
if (lvSrc.Items[I].Selected || All)
{
Item = new ListViewItem(lvSrc.Items[I].Text);
Item.Tag = lvSrc.Items[I].Tag;
if (lvSrc.Items[I].SubItems.Count > 1)
Item.SubItems.Add(lvSrc.Items[I].SubItems[1]);
else
Item.SubItems.Add("");
lvDes.Items.Add(Item);
if (lvDes.Columns.Count == 3)
{
LVSI = Item.SubItems.Add("");
System.Windows.Forms.Button B = new System.Windows.Forms.Button();
B.Parent = lvDes;
RearrangeRefValButton(B, LVSI.Bounds);
B.BackColor = Color.Silver;
B.BringToFront();
LVSI.Tag = B;
B.Tag = Item;
B.Click += new EventHandler(btnRefVal_Click);
B.Text = "...";
}
}
}
for (I = lvSrc.Items.Count - 1; I >= 0; I--)
{
if (lvSrc.Items[I].Selected || All)
{
if (lvSrc.Columns.Count == 3)
{
LVSI = lvSrc.Items[I].SubItems[2];
if (LVSI != null)
{
if (LVSI.Tag != null)
{
((System.Windows.Forms.Button)LVSI.Tag).Dispose();
}
}
}
lvSrc.Items[I].Remove();
}
}
if (lvSrc.Columns.Count == 3)
{
foreach (ListViewItem LVI in lvSrc.Items)
{
LVSI = LVI.SubItems[2];
if (LVSI.Tag != null)
RearrangeRefValButton((System.Windows.Forms.Button)LVSI.Tag, LVSI.Bounds);
}
}
}
示例13: beginEditIncludeDir
private void beginEditIncludeDir()
{
if(_editingIncludes)
{
endEditIncludeDir(true);
}
_editingIncludes = true;
_dialog.unsetCancelButton();
if(_editingIndex != -1)
{
_txtIncludeDir = new TextBox();
_txtIncludeDir.Text = sliceIncludeList.Items[sliceIncludeList.SelectedIndex].ToString();
_editingIncludeDir = _txtIncludeDir.Text;
sliceIncludeList.SelectionMode = SelectionMode.One;
Rectangle rect = sliceIncludeList.GetItemRectangle(sliceIncludeList.SelectedIndex);
_txtIncludeDir.Location = new Point(sliceIncludeList.Location.X + 2,
sliceIncludeList.Location.Y + rect.Y);
_txtIncludeDir.Width = sliceIncludeList.Width - 50;
_txtIncludeDir.Parent = sliceIncludeList;
_txtIncludeDir.KeyDown += new KeyEventHandler(includeDirKeyDown);
_txtIncludeDir.KeyUp += new KeyEventHandler(includeDirKeyUp);
groupBox1.Controls.Add(_txtIncludeDir);
_btnSelectInclude = new Button();
_btnSelectInclude.Text = "...";
_btnSelectInclude.Location = new Point(sliceIncludeList.Location.X + _txtIncludeDir.Width,
sliceIncludeList.Location.Y + rect.Y);
_btnSelectInclude.Width = 49;
_btnSelectInclude.Height = _txtIncludeDir.Height;
_btnSelectInclude.Click += new EventHandler(selectIncludeClicked);
groupBox1.Controls.Add(_btnSelectInclude);
_txtIncludeDir.Show();
_txtIncludeDir.BringToFront();
_txtIncludeDir.Focus();
_btnSelectInclude.Show();
_btnSelectInclude.BringToFront();
}
}
示例14: AddButton
private void AddButton(string name, string file)
{
if (_cButtons == null)
_cButtons = new Dictionary<string, string>();
if (_cButtons.Keys.Contains(name))
return;
_cButtons.Add(name, file); // -- for tracking purposes..
var newButton = new Button
{
Text = name,
Location = new Point(_curX, _curY),
Size = new Size(110, 23),
Visible = true,
Enabled = true
};
newButton.BringToFront();
newButton.Click += HandleButtons;
Controls.Add(newButton);
tabPage9.Controls.Add(newButton);
if (_curY == 235) {
_curY = 3;
if (_curX == 583) {
MessageBox.Show("That's a lot of LUAS, you've reached the limit!");
return;
}
_curX += 116;
} else {
_curY += 29;
}
}
示例15: CreateMidiEventDemoButton
private void CreateMidiEventDemoButton(int x, int y, int i)
{
Label label = new Label();
label.ForeColor = System.Drawing.Color.RoyalBlue;
label.Location = new System.Drawing.Point(x + 1, y + 4);
label.Size = new System.Drawing.Size(26, 14);
label.Text = "rest";
this.Controls.Add(label);
_restLabels.Add(label);
label.SendToBack();
Button b = new Button();
b.Location = new System.Drawing.Point(x, y);
b.Size = new System.Drawing.Size(27, 24);
//b.TabIndex = 82 + i;
b.Text = (i + 1).ToString();
b.UseVisualStyleBackColor = true;
b.Click += new EventHandler(MidiEventDemoButton_Click);
this.Controls.Add(b);
_midiEventDemoButtons.Add(b);
b.BringToFront();
}