本文整理汇总了C#中System.Windows.Forms.PictureBox.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# PictureBox.Hide方法的具体用法?C# PictureBox.Hide怎么用?C# PictureBox.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.PictureBox
的用法示例。
在下文中一共展示了PictureBox.Hide方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BeerColision
public void BeerColision(PictureBox wal)
{
if (Player.Right > wal.Left && Player.Left < wal.Right - Player.Width / 2 && Player.Bottom > wal.Top && Player.Top < wal.Bottom) { wal.Hide(); }
if (Player.Left < wal.Right && Player.Right > wal.Left + Player.Width / 2 && Player.Bottom > wal.Top && Player.Top < wal.Bottom) { wal.Hide(); }
if (Player.Bottom + 5 >= wal.Top && Player.Top < wal.Top - Player.Height / 2 && Player.Right - 2 > wal.Left && Player.Left + 5 < wal.Right) { wal.Hide(); }
if (Player.Top - 5 <= wal.Bottom && Player.Bottom > wal.Bottom - Player.Height / 2 && Player.Right - 2 > wal.Left && Player.Left + 5 < wal.Right) { wal.Hide(); }
}
示例2: DeckBuilder
public DeckBuilder()
: base()
{
AutoScroll = true;
columns = new List<List<DeckBuilderCard>[]>();
for (int i = 0; i < NUM_INITIAL_COLUMNS; i++)
{
columns.Add(new List<DeckBuilderCard>[2]);
columns[i][0] = new List<DeckBuilderCard>();
columns[i][1] = new List<DeckBuilderCard>();
}
// Make indicator.
indicator = new PictureBox();
indicator.BackColor = INDICATOR_COLOR;
Controls.Add(indicator);
indicator.Hide();
}
示例3: CharacterCreation
public CharacterCreation()
{
warriorPicBox = new PictureBox();
warriorPicBox.Image = Properties.Resources.warrior;
warriorPicBox.Width = 250;
warriorPicBox.Height = 250;
warriorPicBox.BackColor = Color.Transparent;
warriorPicBox.Left = 190;
warriorPicBox.Top = 240;
this.Controls.Add(warriorPicBox);
roguePicBox = new PictureBox();
roguePicBox.Image = Properties.Resources.rogue;
roguePicBox.Width = 250;
roguePicBox.Height = 250;
roguePicBox.BackColor = Color.Transparent;
roguePicBox.Left = 190;
roguePicBox.Top = 240;
this.Controls.Add(roguePicBox);
roguePicBox.Hide();
magePicBox = new PictureBox();
magePicBox.Image = Properties.Resources.mage;
magePicBox.Width = 250;
magePicBox.Height = 250;
magePicBox.BackColor = Color.Transparent;
magePicBox.Left = 190;
magePicBox.Top = 240;
this.Controls.Add(magePicBox);
magePicBox.Hide();
InitializeComponent();
//TODO: This will be moved on checked event, but for now, lets load bars here:
strengthProgressBar.Maximum = 50;
dexterityProgressBar.Maximum = 50;
vitalityProgressBar.Maximum = 50;
intelligenceProgressBar.Maximum = 50;
// TODO: Add background music and sound for clicks
}
示例4: avatarBox_Click
private void avatarBox_Click(object sender, EventArgs e)
{
if (pb != null)
{
this.WindowState = FormWindowState.Maximized;
p.Show();
pb.Show();
}
else
{
try
{
Cursor.Current = Cursors.WaitCursor;
p = new Panel();
p.Location = new Point(0, 0);
p.BackColor = Color.Black;
pb = new PictureBox();
string url = _User.profile_image_url.Replace("_normal", "");
var request = WebRequestFactory.CreateHttpRequest(url);
var httpResponse = (HttpWebResponse)request.GetResponse();
Stream stream = httpResponse.GetResponseStream();
Image i = new Bitmap(stream);
pb.Image = i;
pb.SizeMode = PictureBoxSizeMode.StretchImage;
this.WindowState = FormWindowState.Maximized;
pb.Size = getImageSize(i.Size, Screen.PrimaryScreen.Bounds.Size);
pb.Location = new Point((Screen.PrimaryScreen.Bounds.Width / 2) - (pb.Size.Width / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - (pb.Size.Height / 2));
pb.Click += new EventHandler(pb_Click);
p.Click += new EventHandler(pb_Click);
p.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
p.Visible = true;
this.Controls.Add(p);
p.BringToFront();
this.Controls.Add(pb);
pb.BringToFront();
Cursor.Current = Cursors.Default;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
pb.Hide();
}
}
}
示例5: setOKState
private void setOKState(PictureBox image)
{
image.Hide();
}
示例6: timerALienBullets_Tick
private void timerALienBullets_Tick(object sender, EventArgs e)
{
int ran = GetRandomInt(0, ALiens.Count);
PictureBox bullet = new PictureBox();
bullet.Image = SpaceInvad.Properties.Resources.bullet;
bullet.SizeMode = PictureBoxSizeMode.AutoSize;
bullet.Location = new Point(ALiens[ran].Location.X + 9, ALiens[ran].Location.Y + 10);
bullet.Name = "alienbullet";
this.Controls.Add(bullet);
while (bullet.Location.Y < this.Width + 40 && bullet.Visible == true)
{
int count =0;
foreach (PictureBox p in Homes)
{
if (bullet.Bounds.IntersectsWith(p.Bounds))
{
if (HomeStates[count] == 0)
{
p.Image = SpaceInvad.Properties.Resources.house1;
HomeStates[count]++;
bullet.Hide();
Application.DoEvents();
break;
}
else if (HomeStates[count] == 1)
{
p.Image = SpaceInvad.Properties.Resources.house2;
HomeStates[count]++;
bullet.Hide();
break;
}
else if (HomeStates[count] == 2)
{
p.Hide();
bullet.Hide();
break;
}
count++;
}
}
bullet.Location = new Point(bullet.Location.X, bullet.Location.Y + 1);
bullet.Refresh();
foreach (PictureBox p in Players)
{
if (bullet.Bounds.IntersectsWith(p.Bounds) && p.Visible == true)
{
Players[0].Image = SpaceInvad.Properties.Resources.ship2;
p.Refresh();
axWindowsMediaPlayer1.URL = Application.StartupPath + @"\explosion.wav";
Stopwatch sw = new Stopwatch();
for (int i = 0; ; i++)
{
if (i % 100000 == 0) // if in 100000th iteration (could be any other large number
// depending on how often you want the time to be checked)
{
sw.Stop(); // stop the time measurement
if (sw.ElapsedMilliseconds > 500) // check if desired period of time has elapsed
{
break; // if more than 5000 milliseconds have passed, stop looping and return
// to the existing code
}
else
{
sw.Start(); // if less than 5000 milliseconds have elapsed, continue looping
// and resume time measurement
}
}
}
bullet.Hide();
if (lives <= 0)
{
timerALienBullets.Enabled = false;
Players[0].Hide();
score = 0;
ALiens = new List<PictureBox>();
Homes = new List<PictureBox>();
Players = new List<PictureBox>();
this.Controls.Clear();
CreateAliens();
CreatePlayer();
this.Refresh();
timerAnimateAlien.Interval = 600;
HomeStates[0] = 0;
HomeStates[1] = 0;
HomeStates[2] = 0;
Players[0].Show();
Players[0].Image = SpaceInvad.Properties.Resources.ship;
CreateHomes();
timerALienBullets.Enabled = true;
break;
}
else
//.........这里部分代码省略.........
示例7: Form1_KeyDown
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.C)
{
txtcheats.Show();
}
if (e.KeyCode == Keys.Space)
{
axWindowsMediaPlayer4.URL = Application.StartupPath + @"\shoot.wav";
if (bonus == false)
{
int ran = GetRandomInt(1, 10);
if (ran == 4)
{
axWindowsMediaPlayer3.URL = Application.StartupPath + @"\ufo_lowpitch.wav";
bonus = true;
PictureBox spaceship = new PictureBox();
spaceship.Image = SpaceInvad.Properties.Resources.spaceship;
spaceship.SizeMode = PictureBoxSizeMode.AutoSize;
spaceship.Location = new Point(3, 49);
spaceship.Name = "ss";
SpaceShip.Add(spaceship);
this.Controls.Add(SpaceShip[0]);
timerAnimateShipSpace.Enabled = true;
}
}
PictureBox bullet = new PictureBox();
bullet.Image = SpaceInvad.Properties.Resources.bullet;
bullet.SizeMode = PictureBoxSizeMode.AutoSize;
bullet.Location = new Point(Players[0].Location.X + 9, Players[0].Location.Y - 10);
bullet.Name = "bullet";
this.Controls.Add(bullet);
while (bullet.Location.Y > -30 && bullet.Visible == true)
{
bullet.Location = new Point(bullet.Location.X, bullet.Location.Y - 1);
bullet.Refresh();
int count = 0;
foreach (PictureBox p in Homes)
{
if (bullet.Bounds.IntersectsWith(p.Bounds) && p.Visible == true)
{
if (HomeStates[count] == 0)
{
p.Image = SpaceInvad.Properties.Resources.house1;
HomeStates[count]++;
bullet.Hide();
Application.DoEvents();
break;
}
else if (HomeStates[count] == 1)
{
p.Image = SpaceInvad.Properties.Resources.house2;
HomeStates[count]++;
bullet.Hide();
break;
}
else if (HomeStates[count] == 2)
{
p.Hide();
bullet.Hide();
break;
}
}
count++;
}
foreach (PictureBox p in ALiens)
{
int ALiensvis = 0;
foreach (PictureBox alien in ALiens)
{
if (alien.Visible == true)
{
ALiensvis++;
}
}
if (ALiensvis == ALiens.Count / 2)
{
timerAnimateAlien.Interval = 300;
}
else if (ALiensvis <= 4)
{
timerAnimateAlien.Interval = 50;
}
if (bullet.Bounds.IntersectsWith(p.Bounds))
{
Application.DoEvents();
//.........这里部分代码省略.........
示例8: startGame
private void startGame(int type)
{
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=besilka.accdb;Persist Security Info=False;";
connection.Open();
OleDbCommand getWords = new OleDbCommand();
getWords.Connection = connection;
getWords.CommandText = "SELECT * FROM Words WHERE ID_Category = " + type.ToString();
OleDbDataReader wordsReader = getWords.ExecuteReader();
List<string> words = new List<string>();
while (wordsReader.Read())
{
string tmoWord = wordsReader[2].ToString();
words.Add(tmoWord);
}
connection.Close();
Random nrnd = new Random();
choosenWord = words[nrnd.Next(words.Count())];
pictures.Clear();
picturesStart.Clear();
for (int i = 0; i < choosenWord.Length; i++)
{
if (choosenWord[i] == ' ')
{
PictureBox emptyPC = new PictureBox();
picturesStart.Add(emptyPC);
pictures.Add(emptyPC);
continue;
}
// Picture Start
PictureBox tmpPicure = new PictureBox();
tmpPicure.Size = new Size(40, 40);
tmpPicure.Location = new Point(380 + i * 35, 400);
tmpPicure.Image = Image.FromFile(@"Letters\_.png");
tmpPicure.BackColor = System.Drawing.Color.Transparent;
tmpPicure.Show();
picturesStart.Add(tmpPicure);
this.Controls.Add(tmpPicure);
// Picture
PictureBox realPicture = new PictureBox();
realPicture.Size = new Size(40, 40);
realPicture.Location = new Point(380 + i * 35, 400);
realPicture.BackColor = System.Drawing.Color.Transparent;
realPicture.Hide();
string location = @"Letters\" + choosenWord[i] + ".png";
realPicture.Image = Image.FromFile(location);
pictures.Add(realPicture);
this.Controls.Add(realPicture);
}
}
示例9: create
private int create(string content)
{
//何×何か
int width_max = 0, height_max = 0, start_x = 0, start_y = 0;
bool two_flag = false, three_flag = false;
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
System.IO.StringReader rs = new System.IO.StringReader(content);
//1行ずつ読み込む
while(rs.Peek() > -1)
{
int count = 0;
string t = rs.ReadLine();
for(int i = 0; i < t.Length; i++)
{
if (!Char.IsDigit(t[i]))
{
//0,1,2,3以外の文字が含まれていないか
if (!(t[i] == ' ' || t[i] == ','))
return 3;
}
else
{
count++;
if (t[i] == '2')
two_flag = true;
if (t[i] == '3')
three_flag = true;
}
}
//更新
if (width_max < count)
width_max = count;
if (count != 0)
height_max++;
else
{
//空行が含まれているか
if (width_max == 0)
return 4;
}
}
//2,3を含んでいたか
if (two_flag == false || three_flag == false)
return 1;
//ボタン設定
bt6.Show();
bt7.Show();
bt8.Show();
//タブコントロールを表示
tab = new TabControl();
tab.Size = new Size(460, 385);
tab.Location = new Point(10,35);
TabPage tab1 = new TabPage("木構造");
tab.TabPages.Add(tab1);
TabPage tab2 = new TabPage("迷路回答");
tab.TabPages.Add(tab2);
this.Controls.Add(tab);
//パネルの設定
panel1 = new Panel();
panel1.BorderStyle = BorderStyle.Fixed3D;
panel1.Location = new Point(5, 5);
panel1.Size = new Size(440, 350);
panel1.BackColor = Color.White;
panel1.AutoScroll = true;
tab1.Controls.Add(panel1);
panel2 = new Panel();
panel2.BorderStyle = BorderStyle.Fixed3D;
panel2.Location = new Point(5, 5);
panel2.Size = new Size(440, 350);
panel2.BackColor = Color.White;
panel2.AutoScroll = true;
tab2.Controls.Add(panel2);
//ピクチャーボックスの設定
pb1 = new PictureBox();
pb1.Location = new Point(0, 0);
pb1.Size = new Size(400, 345);
pb1.BackColor = Color.White;
panel1.Controls.Add(pb1);
pb2 = new PictureBox();
pb2.Location = new Point(0, 0);
pb2.BackColor = Color.White;
panel2.Controls.Add(pb2);
pb3 = new PictureBox();
pb3.Location = new Point(0, 0);
pb3.Size = new Size(400, 345);
pb3.BackColor = Color.White;
panel1.Controls.Add(pb3);
pb3.Hide();
pb4 = new PictureBox();
pb4.Location = new Point(0, 0);
pb4.BackColor = Color.White;
panel2.Controls.Add(pb4);
//.........这里部分代码省略.........
示例10: FrameForm
public FrameForm(Screen s)
{
InitializeComponent();
/* Set Form Positioning in Secondary Window */
this.Left = s.Bounds.Left;
this.Top = s.Bounds.Top;
this.Size = s.Bounds.Size;
this.WindowState = FormWindowState.Maximized;
/* Create Right Click Menu */
ContextMenu cxtMnu = new ContextMenu();
this.mi_playCtrl = new MenuItem("Pause", mi_playCtrl_Clicked);
cxtMnu.MenuItems.Add(this.mi_playCtrl);
cxtMnu.MenuItems.Add("-");
cxtMnu.MenuItems.Add("Close Frame", delegate(object sndr, EventArgs e) { this.Close(); });
this.ContextMenu = cxtMnu;
/* Load Image Settings */
this.t_imgTransition = new Timer();
this.t_imgTransition.Tick += t_imgTransition_Tick;
LoadSettings();
/* Initiate Picture Boxes */
#if DEBUG
System.Diagnostics.Debug.Print("Initialize picbx_visible");
#endif
img_idx = 0;
picbx_visible = new PictureBox();
picbx_visible.Parent = this;
picbx_visible.Size = this.Size;
picbx_visible.Location = new Point(0, 0);
picbx_visible.Hide();
if (imageList.Length > 0)
picbx_visible.Image = Image.FromFile(imageList[0]);
#if DEBUG
System.Diagnostics.Debug.Print("Initialize picbx_next");
#endif
picbx_next = new PictureBox();
picbx_next.Parent = this;
picbx_next.Size = this.Size;
picbx_next.Location = new Point(0, 0);
picbx_next.Hide();
if (imageList.Length > 1)
picbx_next.Image = Image.FromFile(imageList[1]);
#if DEBUG
System.Diagnostics.Debug.Print(picbx_next.Parent.ToString());
#endif
picbx_visible.FitContainer();
picbx_visible.Center();
picbx_visible.Show();
Properties.Settings.Default.SettingsSaving += delegate(object sndr, CancelEventArgs e){ LoadSettings(); };
/* Start Timer */
this.t_imgTransition.Start();
}
示例11: waitForThread
void waitForThread()
{
canClose = false;
Bitmap bmp = Screenshot.TakeSnapshot(panel1);
BitmapFilter.GaussianBlur(bmp, 1);
PictureBox pb = new PictureBox();
panel1.Controls.Add(pb);
pb.Image = bmp;
pb.Dock = DockStyle.Fill;
pb.BringToFront();
progressBar1.BringToFront();
progressBar1.Visible = true;
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
listBox1.Enabled = false;
while (t.IsAlive)
{
Application.DoEvents();
progressBar1.Maximum = Maximum;
int value = Progress + Crypt.Progress;
if (value > Maximum) value = Maximum;
progressBar1.Value = value;
}
pb.Hide();
button1.Enabled = true;
button2.Enabled = true;
button3.Enabled = true;
progressBar1.Visible = false;
canClose = true;
File.Delete("_temp.$$$");
MessageBox.Show("fin");
}