- 2_marsmission__2__sprites_a.zip
- Atmosphere_Sun_00.SP3
- Atmosphere_Sun_01.SP3
- Atmosphere_Sun_02.SP3
- Atmosphere_Sun_03.SP3
- Atmosphere_Sun_04.SP3
- Atmosphere_Sun_05.SP3
- Atmosphere_Sun_06.SP3
- Atmosphere_Sun_07.SP3
- Atmosphere_Sun_08.SP3
- Atmosphere_Sun_09.SP3
- Atmosphere_Sun_10.SP3
- ATMOSPHERE_VENUS_00.SP3
- ATMOSPHERE_VENUS_01.SP3
- ATMOSPHERE_VENUS_02.SP3
- ATMOSPHERE_VENUS_03.SP3
- ATMOSPHERE_VENUS_04.SP3
- ATMOSPHERE_VENUS_05.SP3
- ATMOSPHERE_VENUS_06.SP3
- 1_marsmission__2__sourccode.zip
- Mars Mission
- Mars Mission.suo
- Mars Mission
- 4_marsmission__2__bitmaps.zip
- Ship_Fighter.bmp
- Ship_saucer.bmp
- Ship_scout.bmp
- Ship_shuttle.bmp
- Ship_transport.bmp
- Shrapnel_Fighter_0.bmp
- Shrapnel_Fighter_1.bmp
- Shrapnel_Fighter_2.bmp
- Shrapnel_Fighter_3.bmp
- Shrapnel_Fighter_4.bmp
- Shrapnel_Shuttle_0.bmp
- Shrapnel_Shuttle_1.bmp
- Shrapnel_Shuttle_2.bmp
- Shrapnel_Shuttle_3.bmp
- Shrapnel_Shuttle_4.bmp
- Shrapnel_Shuttle_5.bmp
- Shrapnel_Shuttle_6.bmp
- Shrapnel_standard_0.bmp
- Shrapnel_standard_1.bmp
- Shrapnel_standard_2.bmp
- SO_Amalthea.bmp
- SO_ariel.bmp
- SO_Atlas.bmp
- SO_Callisto.bmp
- SO_Charon.bmp
- SO_default_0.bmp
- SO_default_1.bmp
- SO_Deimos.bmp
- SO_Earth.bmp
- SO_Enceladus.bmp
- SO_Epimetheus.bmp
- SO_Europa.bmp
- SO_ganymede.bmp
- SO_Hyperion.bmp
- SO_Iapetus.bmp
- SO_Io.bmp
- SO_Janus.bmp
- SO_Jupiter.bmp
- SO_Larissa.bmp
- SO_Luna.bmp
- SO_mars.bmp
- SO_mercury.bmp
- SO_mimas.bmp
- SO_Miranda.bmp
- SO_Neptune.bmp
- SO_Oberon.bmp
- SO_Pandora.bmp
- SO_Phobos.bmp
- SO_Phoebe.bmp
- SO_Pluto.bmp
- SO_Prometheus.bmp
- SO_Proteus.bmp
- SO_Rhea.bmp
- SO_Saturn.bmp
- SO_SolarShadow.bmp
- SO_Sun.bmp
- SO_Telesto.bmp
- SO_tethys.bmp
- SO_Titan.bmp
- SO_Titania.bmp
- SO_Triton.bmp
- SO_Umbriel.bmp
- SO_Uranus.bmp
- SO_Venus.bmp
- starfield.jpg
- Structure_Base.bmp
- Structure_Terran_Base.bmp
- 3_marsmission__2__sprites_b.zip
- Atmosphere_Sun_11.SP3
- LANDING GEAR.SP3
- SHUTTLE.SP3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BitmapRegion;
public class formNewGameMsgBox : Form
{
private Button btnYes;
private Label lblNewGame;
private Button btnNo;
private void InitializeComponent()
{
this.btnYes = new System.Windows.Forms.Button();
this.btnNo = new System.Windows.Forms.Button();
this.lblNewGame = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnYes
//
this.btnYes.BackgroundImage = global::Mars_Mission.Properties.Resources.thumbs_up_small;
this.btnYes.Location = new System.Drawing.Point(157, 272);
this.btnYes.Name = "btnYes";
this.btnYes.Size = new System.Drawing.Size(70, 69);
this.btnYes.TabIndex = 0;
this.btnYes.UseVisualStyleBackColor = true;
//
// btnNo
//
this.btnNo.BackgroundImage = global::Mars_Mission.Properties.Resources.thumbs_down_small;
this.btnNo.Location = new System.Drawing.Point(222, 273);
this.btnNo.Name = "btnNo";
this.btnNo.Size = new System.Drawing.Size(72, 72);
this.btnNo.TabIndex = 1;
this.btnNo.UseVisualStyleBackColor = true;
//
// lblNewGame
//
this.lblNewGame.AutoSize = true;
this.lblNewGame.BackColor = System.Drawing.Color.Transparent;
this.lblNewGame.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblNewGame.Location = new System.Drawing.Point(115, 138);
this.lblNewGame.Name = "lblNewGame";
this.lblNewGame.Size = new System.Drawing.Size(209, 39);
this.lblNewGame.TabIndex = 2;
this.lblNewGame.Text = "New Game?";
//
// formNewGameMsgBox
//
this.BackgroundImage = global::Mars_Mission.Properties.Resources.pewter_frame;
this.ClientSize = new System.Drawing.Size(448, 341);
this.Controls.Add(this.lblNewGame);
this.Controls.Add(this.btnNo);
this.Controls.Add(this.btnYes);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "formNewGameMsgBox";
this.ResumeLayout(false);
this.PerformLayout();
}
public bool bolResponse;
public formNewGameMsgBox()
{
InitializeComponent();
BitmapRegion.BitmapRegion.CreateControlRegion(this, Mars_Mission.Properties.Resources.pewter_frame);
BitmapRegion.BitmapRegion.CreateControlRegion(btnYes, Mars_Mission.Properties.Resources.thumbs_up_small);
BitmapRegion.BitmapRegion.CreateControlRegion(btnNo, Mars_Mission.Properties.Resources.thumbs_down_small);
btnYes.Click += new EventHandler(btnYes_Click);
btnNo.Click += new EventHandler(btnNo_Click);
btnYes.MouseEnter += new EventHandler(btnYes_MouseEnter);
btnYes.MouseLeave += new EventHandler(btnYes_MouseLeave);
btnNo.MouseEnter += new EventHandler(btnNo_MouseEnter);
btnNo.MouseLeave += new EventHandler(btnNo_MouseLeave);
VisibleChanged += new EventHandler(formNewGameMsgBox_VisibleChanged);
}
void btnNo_MouseLeave(object sender, EventArgs e)
{
BitmapRegion.BitmapRegion.CreateControlRegion(btnNo, Mars_Mission.Properties.Resources.thumbs_down_small);
}
void btnNo_MouseEnter(object sender, EventArgs e)
{
BitmapRegion.BitmapRegion.CreateControlRegion(btnNo, Mars_Mission.Properties.Resources.thumbs_down_small_hightlight);
}
void btnYes_MouseLeave(object sender, EventArgs e)
{
BitmapRegion.BitmapRegion.CreateControlRegion(btnYes, Mars_Mission.Properties.Resources.thumbs_up_small);
}
void btnYes_MouseEnter(object sender, EventArgs e)
{
BitmapRegion.BitmapRegion.CreateControlRegion(btnYes, Mars_Mission.Properties.Resources.thumbs_up_small_highlight );
}
void formNewGameMsgBox_VisibleChanged(object sender, EventArgs e)
{
Left = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2;
Top = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2;
}
void btnNo_Click(object sender, EventArgs e)
{
bolResponse = false;
Hide();
}
void btnYes_Click(object sender, EventArgs e)
{
bolResponse = true;
Hide();
}
}
public class classMessageBox : Form
{
string reply;
int intButtonLeft;
public System.Windows.Forms.Button[] btns = new System.Windows.Forms.Button[0];
public System.Windows.Forms.Label lbl = new System.Windows.Forms.Label();
public classMessageBox(string strTitle, string strText, params string[] strButtons)
{
Controls.Add(lbl);
lbl.Text = strText;
lbl.Top = 5; lbl.Left = 5;
lbl.AutoSize = true;
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
foreach (string strButton in strButtons)
addButton(strButton);
resizeForm();
}
void addButton(string strThisButton)
{
System.Windows.Forms.Button btnNew = new System.Windows.Forms.Button();
Controls.Add(btnNew);
btnNew.Visible = true;
btnNew.AutoSize = true; btnNew.AutoSizeMode = AutoSizeMode.GrowAndShrink;
btnNew.Text = strThisButton.Trim();
btnNew.Click += new EventHandler(btn_Click);
btnNew.FontChanged += new EventHandler(btnNew_FontChanged);
Array.Resize<System.Windows.Forms.Button>(ref btns, btns.Length + 1);
btns[btns.Length - 1] = btnNew;
}
void btn_Click(object sender, EventArgs e)
{
System.Windows.Forms.Button btnThis = (System.Windows.Forms.Button)sender;
reply = btnThis.Text;
Close();
}
void btnNew_FontChanged(object sender, EventArgs e)
{ initResize(); }
void lbl_FontChanged(object sender, EventArgs e) { initResize(); }
void initResize()
{
System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer();
tmr.Interval = 5;
tmr.Tick += new EventHandler(tmr_Tick);
tmr.Enabled = true;
}
void tmr_Tick(object sender, EventArgs e)
{
System.Windows.Forms.Timer tmrMe = (System.Windows.Forms.Timer)sender;
tmrMe.Enabled = false;
resizeForm();
}
void resizeForm()
{
intButtonLeft = 5;
foreach (System.Windows.Forms.Button btn in btns)
{
btn.Left = intButtonLeft;
intButtonLeft += btn.Width + 5;
}
Width = btns[btns.Length - 1].Left + btns[btns.Length - 1].Width + 25;
lbl.AutoSize = true;
// resize label
int intNumLines = (int)Math.Ceiling((double)lbl.Width / (double)Width) + 1;
lbl.AutoSize = false;
lbl.FontChanged += new EventHandler(lbl_FontChanged);
lbl.Height = lbl.Font.Height * intNumLines;
lbl.Width = Width - 20;
int intTallestButtonHeight = 0;
foreach (System.Windows.Forms.Button thisButton in btns)
{
thisButton.Top = lbl.Top + lbl.Height + 5;
if (intTallestButtonHeight < thisButton.Height)
intTallestButtonHeight = thisButton.Height;
}
Height = btns[0].Top + intTallestButtonHeight + 35;
Top = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2;
Left = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2;
}
public string Reply { get { return reply; } }
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Christ Kennedy grew up in the suburbs of Montreal and is a bilingual Quebecois with a bachelor’s degree in computer engineering from McGill University. He is unemployable and currently living in Moncton, N.B. writing his next novel.