XnaMessageBox Library Code:
using System;
using System.Runtime.InteropServices;
namespace Blaze.XNA.MessageBox
{
public class XNAMessageBox
{
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static uint MessageBox(IntPtr hWnd, string text, string caption, uint type);
public void Show(string text, string caption, uint type)
{
int num = (int) XNAMessageBox.MessageBox(new IntPtr(0), text, caption, type);
}
}
}
Example of how to use:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using Blaze.XNA.MessageBox;
namespace XnaMessageBox_SampleCode
{
public class Game1 : Microsoft.Xna.Framework.Game
{
Blaze.XNA.MessageBox.XNAMessageBox testBox = new XNAMessageBox();
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
testBox.Show("Hello World", "Test",0);
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}
}
}
NumberOnlyTextBox Code:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (Regex.IsMatch(e.KeyChar.ToString(), "\\d+"))
return;
e.Handled = true;
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Back || this.textBox1.Text.Length == 0)
return;
string text = this.textBox1.Text;
string str = string.Empty;
text.ToCharArray();
char[] chArray = new char[text.Length - 1];
for (int index = 0; index < chArray.Length; ++index)
{
chArray[index] = text[index];
str = str + (object) chArray[index];
}
this.textBox1.Text = str;
this.textBox1.SelectionStart = chArray.Length + 1;
}
DoubleBuffer Library
using System.Reflection;
namespace Blaze.Controls.DoubleBuffer
{
public class Buffer
{
public void SetToDoubleBuffer(object c)
{
typeof (object).InvokeMember("DoubleBuffered", BindingFlags.Instance |
BindingFlags.NonPublic | BindingFlags.SetProperty, (Binder) null, c, new object[1]
{
(object) true
});
}
}
}
I started learning HTML in 7th grade (2007) then went on to learn any and everything I could.
HTML/CSS/JavaScript/ActionScript/ASP.Net (6 years)
Basic (5 years)
C/C++ (4 years)
Java (4 years)
C# (3 years)
VB (2 years)
Out of all of these I have to say C# is by far my favorite since its wide spread, works for almost any solution and allows me to use Visual Studio.