using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Width = 800;
Height = 600;
}
private void button1_Click(object sender, EventArgs e)
{
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = this.openFileDialog1.FileName;
axWindowsMediaPlayer1.URL = fileName;
}
}
private void button2_click(object sender, EventArgs e)
{ Size siz;
Point pt;
int xp, yp;
siz = axWindowsMediaPlayer1.Size;
xp = this.Location.X;
yp = this.Location.Y;
pt = axWindowsMediaPlayer1.Location;
pt.X += xp;
pt.Y += yp;
Bitmap bmp = new Bitmap(siz.Width, siz.Height);
Graphics g = Graphics.FromImage(bmp);
MessageBox.Show("X:" + pt.X + " Y:" + pt.Y);
g.CopyFromScreen(pt, new Point(0, 0), siz);
g.Dispose();
bmp.Save("c:\\tmp\\w.png");
bmp.Dispose();
}
}
}
|