اجرا کردن یک برنامه بدون نمایش دادن پنجره آن
کد:
System.Diagnostics.ProcessStartInfo process_i = new System.Diagnostics.ProcessStartInfo();
process_i.FileName = "Notepad.Exe";
process_i.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = process_i; process.Start();
تغییر دادن مکان picturebox در روی فرم بوسیلۀ موس
کد:
namespace Mouse
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Point MouseDownLocation;
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
pictureBox1.Left = e.X + pictureBox1.Left - MouseDownLocation.X;
pictureBox1.Top = e.Y + pictureBox1.Top - MouseDownLocation.Y;
}
}