using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.ClientSize = new Size(
Convert.ToInt32(textBox1.Text),
Convert.ToInt32(textBox2.Text));
string path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
Bitmap bmp = new Bitmap(
this.ClientSize.Width,
this.ClientSize.Height,
PixelFormat.Format32bppArgb);
FormBorderStyle f = this.FormBorderStyle;
this.FormBorderStyle = FormBorderStyle.None;
this.DrawToBitmap(bmp, new Rectangle(0, 0, this.ClientSize.Width, this.ClientSize.Height));
bmp.Save(path + "\\test.png", ImageFormat.Png);
this.FormBorderStyle = f;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CnVzaW5nIFN5c3RlbS5EcmF3aW5nLkRyYXdpbmcyRDsKdXNpbmcgU3lzdGVtLkRyYXdpbmcuSW1hZ2luZzsKCm5hbWVzcGFjZSBXaW5kb3dzRm9ybXNBcHBsaWNhdGlvbjEKewogICAgcHVibGljIHBhcnRpYWwgY2xhc3MgRm9ybTEgOiBGb3JtCiAgICB7CiAgICAgICAgcHVibGljIEZvcm0xKCkKICAgICAgICB7CiAgICAgICAgICAgIEluaXRpYWxpemVDb21wb25lbnQoKTsKICAgICAgICB9CgogICAgICAgIHByaXZhdGUgdm9pZCBidXR0b24xX0NsaWNrKG9iamVjdCBzZW5kZXIsIEV2ZW50QXJncyBlKQogICAgICAgIHsKICAgICAgICAgICAgdGhpcy5DbGllbnRTaXplID0gbmV3IFNpemUoCiAgICAgICAgICAgICAgICBDb252ZXJ0LlRvSW50MzIodGV4dEJveDEuVGV4dCksCiAgICAgICAgICAgICAgICBDb252ZXJ0LlRvSW50MzIodGV4dEJveDIuVGV4dCkpOwogICAgICAgICAgICBzdHJpbmcgcGF0aCA9IEVudmlyb25tZW50LkdldEZvbGRlclBhdGgoRW52aXJvbm1lbnQuU3BlY2lhbEZvbGRlci5EZXNrdG9wRGlyZWN0b3J5KTsKICAgICAgICAgICAgQml0bWFwIGJtcCA9IG5ldyBCaXRtYXAoCiAgICAgICAgICAgICAgICB0aGlzLkNsaWVudFNpemUuV2lkdGgsCiAgICAgICAgICAgICAgICB0aGlzLkNsaWVudFNpemUuSGVpZ2h0LAogICAgICAgICAgICAgICAgUGl4ZWxGb3JtYXQuRm9ybWF0MzJicHBBcmdiKTsKICAgICAgICAgICAgRm9ybUJvcmRlclN0eWxlIGYgPSB0aGlzLkZvcm1Cb3JkZXJTdHlsZTsKICAgICAgICAgICAgdGhpcy5Gb3JtQm9yZGVyU3R5bGUgPSBGb3JtQm9yZGVyU3R5bGUuTm9uZTsKICAgICAgICAgICAgdGhpcy5EcmF3VG9CaXRtYXAoYm1wLCBuZXcgUmVjdGFuZ2xlKDAsIDAsIHRoaXMuQ2xpZW50U2l6ZS5XaWR0aCwgdGhpcy5DbGllbnRTaXplLkhlaWdodCkpOwogICAgICAgICAgICBibXAuU2F2ZShwYXRoICsgIlxcdGVzdC5wbmciLCBJbWFnZUZvcm1hdC5QbmcpOwogICAgICAgICAgICAKICAgICAgICAgICAgdGhpcy5Gb3JtQm9yZGVyU3R5bGUgPSBmOwogICAgICAgIH0KICAgIH0KfQo=