using System.Runtime.InteropServices;
string CommandString;
OpenFileDialog file = new OpenFileDialog();
[DllImport("winmm.dll")]
private static extern long mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, int hwndCallback);
private void button1_Click(object sender, System.EventArgs e)
{
if (file.ShowDialog() == DialogResult.OK)
{
CommandString = "open " + "\"" + file.FileName + "\"" + " type MPEGVideo alias MediaFile";
mciSendString(CommandString, null, 0, 0);
CommandString = "play MediaFile";
mciSendString(CommandString, null, 0, 0);
}
}
private void Form1_Load(object sender, EventArgs e)
{
PictureBox pic = new PictureBox();
//pic.Image = Image.FromFile("FilePath");
pic.Image = SystemIcons.Information.ToBitmap();;
textBox1.Controls.Add(pic);
}
using System.Globalization;
public string Miladi2Shamsi(DateTime _date)
{
PersianCalendar pc = new PersianCalendar();
StringBuilder sb = new StringBuilder();
sb.Append(pc.GetYear(_date).ToString("0000"));
sb.Append("/");
sb.Append(pc.GetMonth(_date).ToString("00"));
sb.Append("/");
sb.Append(pc.GetDayOfMonth(_date).ToString("00"));
return sb.ToString();
}
string today = Miladi2Shamsi(DateTime.Now);
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
int a, b, c, d = 0;
a = int.Parse(numericUpDown1.Value.ToString());
b = a * 3600;
c = b / 1000;
d = 50;
SolidBrush sb = new SolidBrush(Color.Black);
Bitmap bit = new Bitmap(Width, Height);
Graphics g = Graphics.FromImage(bit);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawPie(new Pen(sb, 1), d, 20, 190, 170, 0, 360);
sb.Color = Color.Silver;
g.FillPie(sb, d, 20, 190, 170, 0, 360);
sb.Color = Color.Black;
g.DrawPie(new Pen(sb, 1), d, 20, 190, 170, -c, c);
sb.Color = Color.Yellow;
g.FillPie(sb, d, 20, 190, 170, -c, c);
this.BackgroundImage = bit;
}
private void Form1_Load(object sender, EventArgs e)
{
numericUpDown1_ValueChanged(null, null);
}
using System.Drawing;
void New_file(PictureBox pb)
{
bmp_image = newBitmap(pb.Width, pb.Height);
g = Graphics.FromImage(bmp_image);
g.FillRectangle(Brushes.White, newRectangle(0, 0, bmp_image.Width, bmp_image.Height));
pb.Image = bmp_image;
}