本文整理汇总了C#中System.Windows.Forms.PictureBox.SendToBack方法的典型用法代码示例。如果您正苦于以下问题:C# PictureBox.SendToBack方法的具体用法?C# PictureBox.SendToBack怎么用?C# PictureBox.SendToBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.PictureBox
的用法示例。
在下文中一共展示了PictureBox.SendToBack方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainForm
public MainForm()
{
const string filename = "DotGNU_Logo.png";
//
// Required for Windows Form Designer support
//
InitializeComponent();
LoadOptions();
if (!CreateDevelopers())
{
Environment.Exit(1);
}
// Display the form so that handles are created.
Show();
BackColor = Color.White;
try
{
// Load the DotGNU logo
PictureBox picture = new PictureBox();
picture.Image = Image.FromFile(filename);
mainPanel.Controls.Add(picture);
picture.SendToBack();
picture.Anchor = AnchorStyles.None;
picture.SizeMode = PictureBoxSizeMode.StretchImage;
picture.Width = 250;
picture.Height = (int)(picture.Width * ((double)picture.Image.Height / (double)picture.Image.Width));
picture.Left = (mainPanel.Width - picture.Width) / 2;
picture.Top = (mainPanel.Height - picture.Height) / 2;
}
catch (FileNotFoundException)
{
#if CONFIG_SMALL_CONSOLE
Console.WriteLine("Warning: Couldn't find {0}", filename);
#else
Console.Error.WriteLine("Warning: Couldn't find {0}", filename);
#endif
}
// Layout the developers.
mainPanel.Layout += new LayoutEventHandler(DeveloperViews_Layout);
mainPanel.PerformLayout();
scrollSpinSpeed.Value = scrollSpinSpeed.Maximum / 2;
UpdateSpin();
StartControllers();
}
示例2: setBackground
void setBackground()
{
background = new PictureBox();
background.Size = new Size(form.Width, 30);
background.Location = new Point(0, 0);
background.BackColor = Color.FromArgb(20, 18, 18);
background.SendToBack();
form.Controls.Add(background);
}
示例3: StartDrawing
public override void StartDrawing(Control control)
{
_control = control;
_pictureBox = new PictureBox
{
Size = control.ClientSize
};
_pictureBox.Paint += FormPaint;
control.Controls.Add(_pictureBox);
_pictureBox.SendToBack();
_scene = new WinformsScene();
_timer = new System.Threading.Timer(Tick, null, 0, 1000 / FrameRate);
_initialized.Set();
}
示例4: MasuraCreator
public MasuraCreator()
{
InitializeComponent();
addfile_button.Location = new Point(247, 123);
labels = new Label[7];
txtboxes = new TextBox[7];
fnumber = 0;
_files = new string[100];
for (int i = 0; i < 100; i++)
{
_files[i] = "Schimba Numele";
}
dec_files = new PictureBox[99];
// labels[0] = label1;
// txtboxes[0] = t0;
for (int i = 0; i < 7; i++)
{
PictureBox picbox = new PictureBox();
picbox.Size = new Size(24, 24);
picbox.SizeMode = PictureBoxSizeMode.StretchImage;
picbox.Location = new Point(11, 70 + 65 * i);
picbox.Image = Properties.Resources.appbar_page_bold;
picbox.SendToBack();
//if (i > 0)
picbox.Visible = false;
this.Controls.Add(picbox);
dec_files[i] = picbox;
}
scrollbar.MouseMove += new MouseEventHandler(scrollbar_MouseMove);
scrollbar.MouseUp += new MouseEventHandler(scrollbar_MouseUp);
scrollbar.MouseDown += new MouseEventHandler(scrollbar_MouseDown);
foreach (Control con in this.Controls)
{
if (con.GetType() == typeof(Panel))
{
con.MouseEnter += new EventHandler(Globals._mainForm.box_enter);
con.MouseLeave += new EventHandler(Globals._mainForm.box_leave);
foreach (Control child in con.Controls)
{
child.MouseEnter += new EventHandler(Globals._mainForm.child_enter);
child.MouseLeave += new EventHandler(Globals._mainForm.child_leave);
}
}
}
}
示例5: MakeControlsPanel
//.........这里部分代码省略.........
Image = ((Image)(_resources.GetObject("pictureBoxReverse.Image"))),
Location = new Point(28, 3),
Name = "_pictureBoxReverse",
Size = new Size(16, 8),
SizeMode = PictureBoxSizeMode.AutoSize,
TabStop = false
};
_panelcontrols.Controls.Add(_pictureBoxReverse);
_pictureBoxReverse.MouseEnter += PictureBoxReverseMouseEnter;
_pictureBoxReverseOver = new PictureBox
{
Image =
((Image)(_resources.GetObject("pictureBoxReverseMouseOver.Image"))),
Location = _pictureBoxReverse.Location,
Name = "_pictureBoxReverseOver",
Size = _pictureBoxReverse.Size,
SizeMode = PictureBoxSizeMode.AutoSize,
TabStop = false
};
_panelcontrols.Controls.Add(_pictureBoxReverseOver);
_pictureBoxReverseOver.MouseLeave += PictureBoxReverseOverMouseLeave;
_pictureBoxReverseOver.MouseDown += PictureBoxReverseOverMouseDown;
_pictureBoxReverseOver.MouseUp += PictureBoxReverseOverMouseUp;
_pictureBoxReverseDown = new PictureBox
{
Image = ((Image)(_resources.GetObject("pictureBoxReverseMouseDown.Image"))),
Location = _pictureBoxReverse.Location,
Name = "_pictureBoxReverseOver",
Size = _pictureBoxReverse.Size,
SizeMode = PictureBoxSizeMode.AutoSize,
TabStop = false
};
_panelcontrols.Controls.Add(_pictureBoxReverseDown);
_pictureBoxFastForward = new PictureBox
{
Image = ((Image)(_resources.GetObject("pictureBoxFastForward.Image"))),
Location = new Point(571, 1),
Name = "_pictureBoxFastForward",
Size = new Size(17, 13),
SizeMode = PictureBoxSizeMode.AutoSize,
TabStop = false
};
_panelcontrols.Controls.Add(_pictureBoxFastForward);
_pictureBoxFastForward.MouseEnter += PictureBoxFastForwardMouseEnter;
_pictureBoxFastForwardOver = new PictureBox
{
Image = ((Image)(_resources.GetObject("pictureBoxFastForwardMouseOver.Image"))),
Location = _pictureBoxFastForward.Location,
Name = "_pictureBoxFastForwardOver",
Size = _pictureBoxFastForward.Size,
SizeMode = PictureBoxSizeMode.AutoSize,
TabStop = false
};
_panelcontrols.Controls.Add(_pictureBoxFastForwardOver);
_pictureBoxFastForwardOver.MouseLeave += PictureBoxFastForwardOverMouseLeave;
_pictureBoxFastForwardOver.MouseDown += PictureBoxFastForwardOverMouseDown;
_pictureBoxFastForwardOver.MouseUp += PictureBoxFastForwardOverMouseUp;
_pictureBoxFastForwardDown = new PictureBox
{
Image = ((Image)(_resources.GetObject("pictureBoxFastForwardMouseDown.Image"))),
Location = _pictureBoxFastForward.Location,
Name = "_pictureBoxFastForwardDown",
Size = _pictureBoxFastForward.Size,
SizeMode = PictureBoxSizeMode.AutoSize,
TabStop = false
};
_panelcontrols.Controls.Add(_pictureBoxFastForwardDown);
_labelTimeCode.Location = new Point(280, 28);
_labelTimeCode.ForeColor = Color.Gray;
_labelTimeCode.Font = new Font(_labelTimeCode.Font.FontFamily, 7);
_labelTimeCode.AutoSize = true;
_panelcontrols.Controls.Add(_labelTimeCode);
_labelVideoPlayerName.Location = new Point(280, 17);
_labelVideoPlayerName.ForeColor = Color.Gray;
_labelVideoPlayerName.BackColor = Color.FromArgb(67, 75, 93);
_labelVideoPlayerName.AutoSize = true;
_labelVideoPlayerName.Font = new Font(_labelTimeCode.Font.FontFamily, 5);
_panelcontrols.Controls.Add(_labelVideoPlayerName);
_pictureBoxBackground.SendToBack();
_pictureBoxFastForward.BringToFront();
_pictureBoxFastForwardDown.BringToFront();
_pictureBoxFastForwardOver.BringToFront();
_pictureBoxPlay.BringToFront();
_panelcontrols.BackColor = _backgroundColor;
_pictureBoxPlay.BringToFront();
_pictureBoxPlayDown.BringToFront();
_pictureBoxPlayOver.BringToFront();
_labelTimeCode.BringToFront();
return _panelcontrols;
}
示例6: showMap
private void showMap()
{
MazeGeneratorPrim.maxl = 0;
showSolNr = 0;
finish = false;
changeTime = TimeSpan.Zero;
clearAll();
/*if (imgParent != null)
imgParent.Dispose*/
imgParent = new PictureBox();
x = xVal;
y = yVal;
if (gameWidth / x > gameHeight / y)
{
tileDim = gameHeight / y;
Y0Map = Y0;
X0Map = X0 + (gameWidth - tileDim * x) / 2;
}
else
{
tileDim = gameWidth / x;
Y0Map = Y0 + (gameHeight - tileDim * y) / 2;
X0Map = X0;
}
speedCh = 10 * tileDim / 100;
imgParent.Width = x * tileDim;
imgParent.Height = y * tileDim;
imgParent.SizeMode = PictureBoxSizeMode.StretchImage;
imgParent.Image = Properties.Resources.Grass;
imgParent.Location = new Point(X0Map, Y0Map);
this.Controls.Add(imgParent);
imgParent.SendToBack();
x -= 2;
y -= 2;
MazeGeneratorPrim.generateMap(x, y, ref xs, ref ys, ref a);
int xi, yi;
for (yi = 0; yi <= y + 1; yi++)
{
for (xi = 0; xi <= x + 1; xi++)
{
if (a[yi, xi] == 2 || a[yi, xi] == 1)
{
PictureBox img = new PictureBox();
img.Width = img.Height = tileDim;
img.SizeMode = PictureBoxSizeMode.StretchImage;
img.Image = Properties.Resources.Stone;
img.Location = new Point(xi * tileDim, yi * tileDim);
this.Controls.Add(img);
img.Parent = imgParent;
Rectangle frameStone = new Rectangle(img.Location, new Size(img.Width, img.Height));
listStones.Add(frameStone);
}
}
}
/*if (chImg != null)
chImg.Dispose();*/
chImg = new PictureBox();
chImg.Width = 40 * tileDim / 100;
chImg.Height = 65 * tileDim / 100;
chImg.SizeMode = PictureBoxSizeMode.StretchImage;
chImg.Image = Properties.Resources.RStay;
chImg.Location = new Point(xs * tileDim, ys * tileDim);
this.Controls.Add(chImg);
chImg.BringToFront();
chImg.BackColor = Color.Transparent;
chImg.Parent = imgParent;
chImgFrame.Location = chImg.Location;
chImgFrame.Size = chImg.Size;
MazeGeneratorPrim.findMaxLength(xs, ys, 1, ref xf, ref yf, a);
//if (imgFinal != null)
// imgFinal.Dispose();
imgFinal = new PictureBox();
imgFinal.Size = new Size(tileDim, tileDim); ;
imgFinal.SizeMode = PictureBoxSizeMode.StretchImage;
imgFinal.Image = Properties.Resources.Finish;
imgFinal.Location = new Point(xf * tileDim, yf * tileDim);
imgFinalFrame = new Rectangle(imgFinal.Location, imgFinal.Size);
this.Controls.Add(imgFinal);
//.........这里部分代码省略.........
示例7: popup_Load
private void popup_Load(object sender, EventArgs e)
{
//MessageBox.Show("Loading ");
int i = 1;
Dictionary<string, string> _clipDict = _clipboard.returnClips();
clipz.AutoSize = true;
this.Text = "popper";
//Create the header area and add the close button and movement button
PictureBox Closer = new PictureBox();
Closer.Image = ClipboardMagic.Properties.Resources.button_cancel;
Closer.Width = 20;
Closer.Height = 20;
Closer.Top = 3;
Closer.MouseClick += new MouseEventHandler(closer);
this.clipz.Controls.Add(Closer);
PictureBox Mover = new PictureBox();
Mover.Image = ClipboardMagic.Properties.Resources.cursor_move;
Mover.Width = 20;
Mover.Height = 20;
Mover.Top = Closer.Top;
Mover.MouseDown += new MouseEventHandler(Form1_MouseDown);
this.clipz.Controls.Add(Mover);
foreach (KeyValuePair<string, string> pair in _clipDict)
{
//MessageBox.Show("looping");
//Add the clip seperator
if (i != 1)
{
PictureBox border = new PictureBox();
border.Image = ClipboardMagic.Properties.Resources.border;
border.Width = 390;
border.Height = 2;
border.Top = ClipPosY;
border.Left = 9;
ClipPosY += 5;
this.clipz.Controls.Add(border);
}
//Create the Panel to hold the clip
Panel clip = new Panel();
clip.Name = "clip" + i.ToString();
clip.Left = 3;
clip.Top = ClipPosY;
clip.Width = 400;
//clip.MaximumSize = new Size(390, 100);
//clip.MinimumSize = new Size(390, 40);
//clip.BorderStyle = BorderStyle.FixedSingle;
this.clipz.Controls.Add(clip);
//Add the clipboard image
PictureBox ClipboardImage = new PictureBox();
ClipboardImage.Name = "ClipboardImage" + i.ToString();
ClipboardImage.Image = ClipboardMagic.Properties.Resources.clipboard1;
ClipboardImage.Width = 20;
ClipboardImage.Height = 30;
ClipboardImage.Left = 3;
clip.Controls.Add(ClipboardImage);
//Create the number
Label ClipboardNumber = new Label();
ClipboardNumber.Name = "ClipboardNumber" + i.ToString();
ClipboardNumber.Text = i.ToString();
ClipboardNumber.Left = 6;
ClipboardNumber.Width = 14;
ClipboardNumber.Height = 14;
ClipboardNumber.BackColor = Color.White;
ClipboardNumber.Font = new Font("Arial", 10, FontStyle.Bold);
clip.Controls.Add(ClipboardNumber);
ClipboardImage.SendToBack();
//Create the text box
RichTextBox ClipboardText = new RichTextBox();
ClipboardText.Name = "ClipboardText" + i.ToString();
ClipboardText.Top = 5;
ClipboardText.Left = 30;
ClipboardText.Text = _clipDict["Clipboard" + i.ToString()];
Size strSize = TextRenderer.MeasureText(ClipboardText.Text, ClipboardText.Font, new Size(350, 100), TextFormatFlags.WordBreak);
ClipboardText.Height = ClipboardText.Height = strSize.Height;
ClipboardText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.popup_KeyDown);
ClipboardText.ReadOnly = true;
ClipboardText.BackColor = SystemColors.Menu;
ClipboardText.BorderStyle = BorderStyle.None;
ClipboardText.ScrollBars = 0;
ClipboardText.MinimumSize = new Size(350, 30);
ClipboardText.MaximumSize = new Size(350, 100);
clip.Controls.Add(ClipboardText);
//Create the Checkbox
CheckBox ClipboardCheckbox = new CheckBox();
ClipboardCheckbox.Name = "ClipboardCheckbox" + i.ToString();
ClipboardCheckbox.Tag = ClipboardCheckbox.Name;
ClipboardCheckbox.Left = 380;
ClipboardCheckbox.Visible = false;
clip.Controls.Add(ClipboardCheckbox);
//Add then lock image
//.........这里部分代码省略.........
示例8: SuspendLayout
//.........这里部分代码省略.........
salirToolStripMenuItem.Size = new System.Drawing.Size(151, 22);
salirToolStripMenuItem.Text = "&Salir";
salirToolStripMenuItem.Click += new System.EventHandler(salirToolStripMenuItem_Click);
//
// editarToolStripMenuItem
//
editarToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
modificarToolStripMenuItem,
eliminarToolStripMenuItem});
editarToolStripMenuItem.Name = "editarToolStripMenuItem";
editarToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
editarToolStripMenuItem.Text = "&Editar";
//
// modificarToolStripMenuItem
//
modificarToolStripMenuItem.Enabled = false;
modificarToolStripMenuItem.Image = global::Sistema_Shajobe.Properties.Resources.Modificar;
modificarToolStripMenuItem.Name = "modificarToolStripMenuItem";
modificarToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
modificarToolStripMenuItem.Text = "Modificar";
modificarToolStripMenuItem.Click += new System.EventHandler(modificarToolStripMenuItem_Click);
//
// eliminarToolStripMenuItem
//
eliminarToolStripMenuItem.Enabled = false;
eliminarToolStripMenuItem.Image = global::Sistema_Shajobe.Properties.Resources.Borrar;
eliminarToolStripMenuItem.Name = "eliminarToolStripMenuItem";
eliminarToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
eliminarToolStripMenuItem.Text = "Eliminar";
eliminarToolStripMenuItem.Visible = true;
eliminarToolStripMenuItem.Click += new System.EventHandler(eliminarToolStripMenuItem_Click);
//
// ayudaToolStripMenuItem
//
ayudaToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
acercadeToolStripMenuItem});
ayudaToolStripMenuItem.Name = "ayudaToolStripMenuItem";
ayudaToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
ayudaToolStripMenuItem.Text = "Ay&uda";
//
// acercadeToolStripMenuItem
//
acercadeToolStripMenuItem.Name = "acercadeToolStripMenuItem";
acercadeToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
acercadeToolStripMenuItem.Text = "&Acerca de...";
//
// errorProvider1
//
errorProvider1.ContainerControl = this;
//
// pic_TipoUsuario
//
pic_TipoUsuario.BackgroundImage = global::Sistema_Shajobe.Properties.Resources.Usuario;
pic_TipoUsuario.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
pic_TipoUsuario.Location = new System.Drawing.Point(351, 25);
pic_TipoUsuario.Name = "pic_TipoUsuario";
pic_TipoUsuario.Size = new System.Drawing.Size(85, 67);
pic_TipoUsuario.TabIndex = 79;
pic_TipoUsuario.TabStop = false;
//
// pic_Logo
//
pic_Logo.BackgroundImage = global::Sistema_Shajobe.Properties.Resources.Logo_Shajobe;
pic_Logo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
pic_Logo.Location = new System.Drawing.Point(280, 200);
pic_Logo.Name = "pic_Logo";
pic_Logo.Size = new System.Drawing.Size(152, 70);
pic_Logo.TabIndex = 13;
pic_Logo.TabStop = false;
pic_Logo.SendToBack();
//
// Tipo de MateriaPrima
//
AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(448, 284);
Controls.Add(pic_TipoUsuario);
Controls.Add(menuStrip1);
Controls.Add(pic_Logo);
Controls.Add(groupBoxdatos);
BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(228)))), ((int)(((byte)(196)))));
FormClosing += new System.Windows.Forms.FormClosingEventHandler(Tipo_UsuarioFormClosing);
Icon = global::Sistema_Shajobe.Properties.Resources.Usuario_ICO;
MaximizeBox = false;
MaximumSize = new System.Drawing.Size(454, 306);
MinimumSize = new System.Drawing.Size(454, 306);
Name = "Tipo_Usuario";
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Text = "Tipo de usuarios";
Load += new System.EventHandler(Tipo_Usuario_Load);
groupBoxdatos.ResumeLayout(false);
groupBoxdatos.PerformLayout();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(errorProvider1)).EndInit();
((System.ComponentModel.ISupportInitialize)(pic_TipoUsuario)).EndInit();
((System.ComponentModel.ISupportInitialize)(errorProvider_Combobox)).EndInit();
ResumeLayout(false);
PerformLayout();
}
示例9: bgInit
private void bgInit()
{
Image imgsrc = Properties.Resources.b1;
background = new PictureBox();
background.MouseClick += new MouseEventHandler(playerAttack);
Image imgdest = new Bitmap(parentForm.Width, parentForm.Height);
using (Graphics gr = Graphics.FromImage(imgdest))
{
gr.DrawImageUnscaledAndClipped(imgsrc,
new Rectangle(0, 0, parentForm.Width, parentForm.Height));
}
background.Image = imgdest;
background.Width = parentForm.Width;
background.Height = parentForm.Height;
background.SendToBack();
parentForm.Controls.Add(background);
}
示例10: Form1
public Form1()
{
//Creating interface
InitializeComponent();
medianFilter = new MedianFilterClass();
this.Icon = new Icon("favicon.ico");
this.BackColor = Color.FromArgb(32, 30, 30);
this.FormBorderStyle = FormBorderStyle.None;
this.TopMost = true;
this.Bounds = Screen.PrimaryScreen.Bounds;
b = new Bitmap("Pet-cat-toilet-2.jpg");
pb = new PictureBox();
pb.WaitOnLoad = false;
pb.LoadAsync("Pet-cat-toilet-2.jpg");
TopMenu topMenu = new TopMenu(this, pb);
pb.LoadCompleted += Pb_LoadCompleted;
pb.BackgroundImage = new Bitmap("backgroundPattern.png");
pb.Size = new Size(800, 600);
pb.SizeMode = PictureBoxSizeMode.Zoom;
pb.Location = new Point(60, 80);
pb.Image = b;
PictureBox imageBorder = new PictureBox();
imageBorder.Location = new Point(51, 72);
imageBorder.Size = new Size(816, 618);
imageBorder.Image = new Bitmap("imageBorder.png");
this.Controls.Add(imageBorder);
this.Controls.Add(pb);
fm = new FilterManager(b, this);
imageBorder.SendToBack();
//Creating color scrolls block
LabelNameForBlock colorName = new LabelNameForBlock("Work with color");
colorName.Location = new Point(980, 80);
this.Controls.Add(colorName);
greenScroll = new FilterController(980, 110, Color.FromArgb(103, 184, 109), "G", 128, this);
greenScroll.scroll.MouseUp += Sc_MouseUp;
redScroll = new FilterController(980, 140, Color.FromArgb(142, 50, 50), "R", 128, this);
redScroll.scroll.MouseUp += Sc_MouseUp1;
blueScroll = new FilterController(980, 170, Color.FromArgb(13, 120, 200), "B", 128, this);
blueScroll.scroll.MouseUp += Scroll_MouseUp;
//Creating brightness block
LabelNameForBlock brightness = new LabelNameForBlock("Brightness");
brightness.Location = new Point(980, 220);
this.Controls.Add(brightness);
brightnessScroll = new FilterController(980, 240, Color.FromArgb(144, 16, 45), "Bright", 128, this);
brightnessScroll.scroll.MouseUp += Scroll_MouseUp1;
//Creating PixelizationBlock
LabelNameForBlock pixelization = new LabelNameForBlock("Pixelization");
pixelization.Location = new Point(980, 280);
this.Controls.Add(pixelization);
pixelScroll = new FilterController(980, 300, Color.FromArgb(225, 166, 41), "P", 0, this);
pixelScroll.scroll.MouseUp += Scroll_MouseUp2;
//Creating OpacityBlock
LabelNameForBlock opacity = new LabelNameForBlock("Opacity");
opacity.Location = new Point(980, 340);
this.Controls.Add(opacity);
opacityScroll = new FilterController(980, 360, Color.FromArgb(75, 50, 70), "O", 255, this);
opacityScroll.scroll.MouseUp += Scroll_MouseUp3;
//Creating BlackAndWhiteBlock
LabelNameForBlock blackWhite = new LabelNameForBlock("Black-White");
blackWhite.Location = new Point(980, 400);
this.Controls.Add(blackWhite);
blackWhiteScroll = new FilterController(980, 420, Color.FromArgb(70, 190, 70), "w", 0, this);
blackWhiteScroll.scroll.MouseUp += Scroll_MouseUp4;
//Creating SegmentationBlock
LabelNameForBlock segmentation = new LabelNameForBlock("Segmentation2D");
segmentation.Location = new Point(980, 460);
this.Controls.Add(segmentation);
segmentation2DScroll = new FilterController(980, 480, Color.FromArgb(41, 144, 225), "S", 0, this);
segmentation2DScroll.scroll.MouseUp += Scroll_MouseUp5;
//To inverse button
inverseButton = new SuperButtonForTools(Color.FromArgb(160, 75, 255), Color.White, "Inverse");
inverseButton.Location = new Point(865, 72);
inverseButton.MouseClick += inverseButton_MouseClick;
this.Controls.Add(inverseButton);
//BlackAndWhite button
//blackWhiteButton = new SuperButton(Color.FromArgb(255, 75, 75), Color.White, "B/W");
//blackWhiteButton.Location = new Point(865, 102);
//blackWhiteButton.MouseClick += Sb_MouseClick;
//this.Controls.Add(blackWhiteButton);
//Segmentation button
segmentationButton = new SuperButton(Color.FromArgb(255, 75, 75), Color.White, "Segmentation");
segmentationButton.Location = new Point(865, 102);
segmentationButton.MouseClick += SegmentationButton_MouseClick;
this.Controls.Add(segmentationButton);
//.........这里部分代码省略.........
示例11: InitializeComponent
//.........这里部分代码省略.........
PauseButton.Click += new EventHandler(PauseButton_Click);
PauseButton.Text = "Pause";
//
// GameDisplay
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(802, 556);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "Display";
this.Text = "Sorry";
this.ResumeLayout(false);
this.Controls.Add(BoardPicture);
this.Controls.Add(DeckButton);
this.Controls.Add(PauseButton);
//
// CardPicture
//
CardPicture = new Label();
CardPicture.Location = new System.Drawing.Point(50, 300);
CardPicture.Size = new System.Drawing.Size(200, 200);
CardPicture.Size = new Size(deckPic.Width, deckPic.Height);
CardPicture.Image = deckPic;
this.Controls.Add(CardPicture);
//
// Board
//
BoardButtons = new List<List<SquareButton>>();
int buttonSize = 31;
for (int i = 0; i < baseBoard.board.Count; i++)
{
int xAdjust = 0;
int yAdjust = 0;
BoardButtons.Add(new List<SquareButton>());
for (int j = 0; j < baseBoard.board[i].Count; j++)
{
int buttonT = boardTop, buttonR = boardRight,jrfactor=0,jtfactor=0;
if (baseBoard.board.Count / 4 > i) { //top line, Red
buttonR=boardRight + i * buttonSize;
buttonT = boardTop;
jtfactor = 1;
xAdjust = 31;
}
else if (baseBoard.board.Count / 2 > i) { //right line, blue
buttonR = boardRight + (baseBoard.board.Count / 4 * buttonSize);
buttonT = boardTop + i % 15 * buttonSize;
jrfactor = -1;
yAdjust = 31;
}
else if (baseBoard.board.Count * 3 / 4 > i) { //bottom line, yellow
buttonR=boardRight + ((baseBoard.board.Count / 4) - i % 15) * buttonSize;
buttonT=boardTop + baseBoard.board.Count / 4 * buttonSize;
jtfactor = -1;
xAdjust = 31;
}
else { //left line, green
buttonT = boardTop + ((baseBoard.board.Count / 4) - i % 15) * buttonSize;
buttonR = boardRight;
jrfactor = 1;
yAdjust = 31;
}
BoardButtons[i].Add(new SquareButton(baseBoard.board[i][j]));
BoardButtons[i][j].Location = new System.Drawing.Point(buttonR+jrfactor*j*32-196, buttonT+ jtfactor * j * buttonSize-45);
BoardButtons[i][j].Name = "Square" + i;
BoardButtons[i][j].Size = new System.Drawing.Size(buttonSize, buttonSize);
BoardButtons[i][j].TabIndex = 0;
//Board[i].Text = "Square" + i;
BoardButtons[i][j].UseVisualStyleBackColor = true;
this.Controls.Add(BoardButtons[i][j]);
BoardButtons[i][j].Parent = BoardPicture;
BoardButtons[i][j].BackColor = Color.Transparent;
BoardButtons[i][j].Click += new EventHandler(parentGame.SquareButtonPressed);
BoardButtons[i][j].UpdateBackgroundImage();
if (j == 8)
{
BoardButtons[i][j].Location = new System.Drawing.Point(buttonR + jrfactor * 7 * 32 - 196 - xAdjust, buttonT + jtfactor * 7 * buttonSize - 45 - yAdjust);
}
if (j == 9)
{
BoardButtons[i][j].Location = new System.Drawing.Point(buttonR + jrfactor * 7 * 32 - 196 + xAdjust, buttonT + jtfactor * 7 * buttonSize - 45 + yAdjust);
}
if (baseBoard.board[i][j].type == SquareType.Start && j == 3 )
{
BoardButtons[i][j].Location = new System.Drawing.Point(buttonR + jrfactor * 2 * 32 - 196 - xAdjust, buttonT + jtfactor * 2 * buttonSize - 45 - yAdjust);
}
if (baseBoard.board[i][j].type == SquareType.Start && j == 4)
{
BoardButtons[i][j].Location = new System.Drawing.Point(buttonR + jrfactor * 2 * 32 - 196 + xAdjust, buttonT + jtfactor * 2 * buttonSize - 45 + yAdjust);
}
}
}
BoardPicture.SendToBack();
}