using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Msword = Microsoft.Office.Interop.Word;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
{
public partial class result : Form
{
Msword.Application wordapp = null;
Msword.Document worddoc = null;
public Msword.Application Application
{
get { return wordapp; }
set { wordapp = value; }
}
public Msword.Document Document
{
get { return worddoc; }
set { worddoc = value; }
}
public result()
{
InitializeComponent();
this.ControlBox = false;
qr.Visible = false;
}
System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
System.Windows.Forms.Timer timer2 = new System.Windows.Forms.Timer();
string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml";
public string filepath = "";// 圖片地址
XmlDocument xmldoc = new XmlDocument();
string dwinfo = "";
string xminfo = "";
string phinfo = "";
string idinfo = "";
string proinfo = "";
string strdata = "";
string strsa = "";
string strpwd = "";
string typeinfo = "其他(20%)";
string type = "7";
private void result_Load(object sender, EventArgs e)
{
string uppath = System.AppDomain.CurrentDomain.BaseDirectory;
uppath = uppath.Substring(0, uppath.Length - 1);
int clen = uppath.LastIndexOf("\\");
uppath = uppath.Substring(0, clen);
//MessageBox.Show(uppath);
uppath = uppath + "\\setting.xml";
XmlDocument xdoc = new XmlDocument();
xdoc.Load(uppath);
XmlElement xroot = xdoc.DocumentElement;
XmlElement cname = (XmlElement)xroot.GetElementsByTagName("cname")[0]; // 單位信息
XmlElement pname = (XmlElement)xroot.GetElementsByTagName("pname")[0];// 姓名
XmlElement phnum = (XmlElement)xroot.GetElementsByTagName("phnum")[0]; // 電話
XmlElement xidnum = (XmlElement)xroot.GetElementsByTagName("idnum")[0]; // 身份證號
XmlElement proname = (XmlElement)xroot.GetElementsByTagName("proname")[0]; // 項目名稱
//XmlElement strdata = (XmlElement)xroot.GetElementsByTagName("datasource")[0];
//XmlElement strsa = (XmlElement)xroot.GetElementsByTagName("sa")[0];
//XmlElement strpwd = (XmlElement)xroot.GetElementsByTagName("sapwd")[0];
dw.Text = cname.InnerText;
// 隨機數
label4.Text = proname.InnerText;
label5.Text = pname.InnerText;
label6.Text = phnum.InnerText;
label7.Text = xidnum.InnerText;
label8.Text = typeinfo;
dwinfo = cname.InnerText; //單位信息
xminfo = pname.InnerText; // 姓名
phinfo = phnum.InnerText;// 電話
idinfo = xidnum.InnerText; // 身份證號
proinfo = proname.InnerText; //項目名稱
label16.Visible = true;
label15.Text = DateTime.Now.ToString();
dy.Visible = false;
XmlNodeList nlist = xdoc.SelectNodes("Mjdesign/serverset");
if (nlist != null)
{
foreach (XmlNode msnode in nlist)
{
XmlNodeList mlist = msnode.ChildNodes;
foreach (XmlNode nsnode in mlist)
{
if (nsnode.Name == "datasource")
{
strdata = nsnode.InnerText;
//label6.Text = t_data;
}
if (nsnode.Name == "sa")
{
strsa = nsnode.InnerText;
//MessageBox.Show(dwmc.Text);
}
if (nsnode.Name == "sapwd")
{
strpwd = nsnode.InnerText;
}
}
}
}
// MessageBox.Show(ui.ToString());
SqlConnectionStringBuilder sqlb01 = new SqlConnectionStringBuilder();
sqlb01.DataSource = strdata;
sqlb01.InitialCatalog = "random";
sqlb01.UserID = strsa;
sqlb01.Password = strpwd;
sqlb01.IntegratedSecurity = false;
sqlb01.Pooling = true;
SqlConnection conn01 = new SqlConnection();
conn01.ConnectionString = sqlb01.ConnectionString;
// MessageBox.Show(strdata + "11" + strsa + "12" + strpwd);
try
{
conn01.Open();
if (conn01.State.ToString() == "Open")
{
label3.Text = "數據庫鏈接成功";
timer2.Start();
timer2.Interval = 100;
timer2.Tick += new EventHandler(callback2);
tz.Visible = true;
conn01.Close();
}
}
catch (SqlException sqlex)
{
MessageBox.Show("數據庫配置錯誤,請重新填寫/n");
label3.Text = "數據庫鏈接失敗";
tz.Visible = false;
conn01.Close();
}
}
public void callback2(object sender, EventArgs e)
{
Random ran = new Random();
int rt = ran.Next(1, 101); // 含下線不含上線
label1.Text = rt.ToString();
//List<string> ucheck = new List<string>();
//xmldoc.Load(xmlpath);
//XmlElement root = xmldoc.DocumentElement;
//XmlElement checkcount = (XmlElement)root.GetElementsByTagName("checkcount")[0];
//XmlElement ncount = (XmlElement)root.GetElementsByTagName("numcount")[0];
//int c1 = int.Parse(checkcount.InnerText);
//int c2 = int.Parse(ncount.InnerText);
//if (c1 < c2)
//{
// XmlNodeList xlist = xmldoc.SelectNodes("Mjdesign/unchecked/id");
// if (xlist != null)
// {
// foreach (XmlNode msnode in xlist)
// {
// XmlElement xe = (XmlElement)msnode;
// string orderstr = xe.InnerText;
// string contentstr = xe.InnerText;
// ucheck.Add(contentstr);
// }
// }
// int xui = ucheck.Count;
// Random ran = new Random();
// int rt = ran.Next(xui);
// label1.Text = ucheck[rt].ToString();
// // 待修改
// // MessageBox.Show(i.ToString());
//}
//else
//{
// MessageBox.Show(null, "數已用完,請重新設定", "MJSJ");
// return;
//}
////if (i < 0)
////{
//// timer2.Stop();
//// timer2.Enabled = false;
//// // MessageBox.Show("時間到");
////}
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
//if (keyData == Keys.Left)
//{
// this.button1.PerformClick();
// //this.btnTempTest.PerformClick();
//}
if (keyData == Keys.Space)
{
this.tz.PerformClick();//定義快捷鍵
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void tz_Click_1(object sender, EventArgs e)
{
dy.Visible = true;
//string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml";
//XmlDocument xmldoc = new XmlDocument();
//List<string> uncheck = new List<string>();
//xmldoc.Load(xmlpath);
//XmlNodeList nlist = xmldoc.SelectNodes("Mjdesign/unchecked/id");
//if (nlist != null)
//{
// foreach (XmlNode msnode in nlist)
// {
// XmlElement xe = (XmlElement)msnode;
// string contentstr = "";
// if (xe.IsEmpty == false)
// {
// //MessageBox.Show(xe.InnerText);
// contentstr = xe.InnerText;
// }
// uncheck.Add(contentstr);
// }
//}
string reva = "2";
timer2.Stop();
timer2.Enabled = false;
//int ui = uncheck.Count;
//// MessageBox.Show(ui.ToString());
//string[] mstext = new string[ui];
//for (int i = 0; i < ui; i++)
//{
// mstext[i] = uncheck[i];
//}
//Random ran = new Random();
//int wn = ran.Next(ui);
//label1.Text = mstext[wn];
int msnum = int.Parse(label1.Text);
// MessageBox.Show(msnum.ToString());
if (msnum %5==0)
{
label2.Text = "您已選中";
reva = "1";
}
else
{
label2.Text = "您沒選中";
reva = "0";
}
kg.Text = "1";
tz.Visible = false;
string chnum = label1.Text;
qr.Visible = false;
// string time = DateTime.Now.ToLongDateString();
//string time2 = DateTime.Now.ToLongTimeString();
DateTime timeo = DateTime.Now;
// string timestr = time + time2;
// 存入數據庫
// MessageBox.Show(strdata + "11" + strsa + "12" + strpwd);
SqlConnectionStringBuilder sqlb02 = new SqlConnectionStringBuilder();
sqlb02.DataSource = strdata;
sqlb02.InitialCatalog = "random";
sqlb02.UserID = strsa;
sqlb02.Password = strpwd;
sqlb02.IntegratedSecurity = false;
sqlb02.Pooling = true;
SqlConnection conn02 = new SqlConnection();
conn02.ConnectionString = sqlb02.ConnectionString;
try
{
conn02.Open();
if (conn02.State.ToString() == "Open")
{
// string sqlstr = "insert into result(d_content,cs_num,cpname,timekey,xmmc,pcname,oid,locationx,locationy,major) values (" + "'" + vd_content + "'," + "'" + vd_csnum + "'," + "'" + vd_cpname + "','" + vd_timekey + "','" + xmmc + "','" + pcname + "','" + oidstr + "','" + locationxstr + "','" + locationystr + "','" + major + "')";
string sqlstr = @"insert into result(dwxx,xmxx,name,lx,xm,dh,sfzh,cqsz,cqjg,type,cqsj)values(" + "'" + dwinfo + "','" + proinfo + "','" + label16.Text + "','" + typeinfo + "','" + xminfo + "','" + phinfo + "','" + idinfo + "','" + chnum + "','" + label2.Text + "','" + type + "','" + timeo + "')";
//MessageBox.Show(sqlstr);
SqlCommand sqlcmd = new SqlCommand(sqlstr, conn02);
int n = sqlcmd.ExecuteNonQuery();
if (n > 0)
{
MessageBox.Show("保存成功");
conn02.Close();
}
else
{
MessageBox.Show("保存失敗");
conn02.Close();
}
}
}
catch (SqlException sqlex)
{
MessageBox.Show("數據庫配置錯誤,請重新填寫/n" + sqlex);
}
// 完成
//xmldoc.Load(xmlpath);
//XmlElement root = xmldoc.DocumentElement;
//XmlElement cnum = (XmlElement)root.GetElementsByTagName("checkcount")[0];
//string strcnum = cnum.InnerText;
//int checkedcon = int.Parse(strcnum);
//cnum.InnerText = (checkedcon + 1).ToString();
//xmldoc.Save(xmlpath);
//XmlNodeList nlist = xmldoc.SelectNodes("Mjdesign/unchecked/id");
//XmlNode xn = xmldoc.SelectSingleNode("Mjdesign/unchecked");
//if (nlist != null)
//{
// foreach (XmlNode msnode in nlist)
// {
// XmlElement xe = (XmlElement)msnode;
// string orderstr = xe.InnerText;
// string contentstr = xe.InnerText;
// if (xe.InnerText == chnum)
// {
// xn.RemoveChild(xe);
// }
// }
//}
//XmlNodeList Mlist = xmldoc.SelectNodes("Mjdesign/checked");
//if (Mlist != null)
//{
// foreach (XmlNode msnode in Mlist)
// {
// XmlElement xe = (XmlElement)msnode;
// XmlNode xnode = xmldoc.CreateElement("id");
// xnode.InnerText = label1.Text;
// xe.AppendChild(xnode);
// }
//}
//xmldoc.Save(xmlpath);
//*** 存入EXCEL
//EXCELAPPLICATION.Application EXCELA = new EXCELAPPLICATION.Application();
//if (EXCELA == null)
//{
// MessageBox.Show("無法創建EXCEL對象,您的電腦可能未安裝excel");
//}
//string tname = System.AppDomain.CurrentDomain.BaseDirectory + "抽取記錄.xlsx";
//EXCELAPPLICATION.Workbook xbook = EXCELA.Workbooks.Open(tname, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
// Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
//EXCELAPPLICATION.Worksheet xsheet = xbook.Sheets[1];
//int p = 1;
//string wz = "A1";
//string dwwz = "B1";
//EXCELAPPLICATION.Range rng = xsheet.get_Range(wz, Missing.Value);
////MessageBox.Show(rng.Value2.ToString());
//while (rng.Value2 != null)
//{
// p++;
// wz = "A" + p.ToString();
// rng = xsheet.get_Range(wz, Missing.Value);
// // MessageBox.Show(i.ToString());
// // MessageBox.Show(rng.Value.ToString());
// //MessageBox.Show(rng.Value2.ToString());
//}
//int j = p - 2;
//rng.Value2 = j.ToString();
//string time = DateTime.Now.ToLongDateString();
//string time2 = DateTime.Now.ToLongTimeString();
//string timestr = time + time2;
//dwwz = "B" + p.ToString();
//string prwz = "C" + p.ToString();
//string xmwz = "D" + p.ToString();
//string dhwz = "E" + p.ToString();
//string idwz = "F" + p.ToString();
//string szwz = "G" + p.ToString();
//string jgwz = "H" + p.ToString();
//string sjwz = "I" + p.ToString();
//EXCELAPPLICATION.Range dwrng = xsheet.get_Range(dwwz, Missing.Value);
//dwrng.Value2 = dwinfo;
//EXCELAPPLICATION.Range prwzg = xsheet.get_Range(prwz, Missing.Value);
//prwzg.Value2 = proinfo;
//EXCELAPPLICATION.Range xmrng = xsheet.get_Range(xmwz, Missing.Value);
//xmrng.Value2 = xminfo;
//EXCELAPPLICATION.Range dhrng = xsheet.get_Range(dhwz, Missing.Value);
//dhrng.Value2 = phinfo;
//EXCELAPPLICATION.Range idrng = xsheet.get_Range(idwz, Missing.Value);
//idrng.Value2 = idinfo;
//EXCELAPPLICATION.Range szrng = xsheet.get_Range(szwz, Missing.Value);
//szrng.Value2 = label1.Text;
//EXCELAPPLICATION.Range jgrng = xsheet.get_Range(jgwz, Missing.Value);
//jgrng.Value2 = label2.Text;
//EXCELAPPLICATION.Range sjrng = xsheet.get_Range(sjwz, Missing.Value);
//sjrng.Value2 = timestr;
//xbook.Save();
//xbook.Close();
//System.Windows.Forms.Application.DoEvents();
//EXCELA.Quit();
//GC.Collect();
////****結束
//qr.Visible = true;
}
private void qr_Click_1(object sender, EventArgs e)
{
//string chnum = label1.Text;
//qr.Visible = false;
////xmldoc.Load(xmlpath);
////XmlElement root = xmldoc.DocumentElement;
////XmlElement cnum = (XmlElement)root.GetElementsByTagName("checkcount")[0];
////string strcnum = cnum.InnerText;
////int checkedcon = int.Parse(strcnum);
////cnum.InnerText = (checkedcon + 1).ToString();
////xmldoc.Save(xmlpath);
////XmlNodeList nlist = xmldoc.SelectNodes("Mjdesign/unchecked/id");
////XmlNode xn = xmldoc.SelectSingleNode("Mjdesign/unchecked");
////if (nlist != null)
////{
//// foreach (XmlNode msnode in nlist)
//// {
//// XmlElement xe = (XmlElement)msnode;
//// string orderstr = xe.InnerText;
//// string contentstr = xe.InnerText;
//// if (xe.InnerText == chnum)
//// {
//// xn.RemoveChild(xe);
//// }
//// }
////}
////XmlNodeList Mlist = xmldoc.SelectNodes("Mjdesign/checked");
////if (Mlist != null)
////{
//// foreach (XmlNode msnode in Mlist)
//// {
//// XmlElement xe = (XmlElement)msnode;
//// XmlNode xnode = xmldoc.CreateElement("id");
//// xnode.InnerText = label1.Text;
//// xe.AppendChild(xnode);
//// }
////}
////xmldoc.Save(xmlpath);
////*** 存入EXCEL
//EXCELAPPLICATION.Application EXCELA = new EXCELAPPLICATION.Application();
//if (EXCELA == null)
//{
// MessageBox.Show("無法創建EXCEL對象,您的電腦可能未安裝excel");
//}
//string tname = System.AppDomain.CurrentDomain.BaseDirectory + "抽取記錄.xlsx";
// EXCELAPPLICATION.Workbook xbook= EXCELA.Workbooks.Open(tname,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,
// Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value);
// EXCELAPPLICATION.Worksheet xsheet = xbook.Sheets[1];
// int i = 1;
// string wz = "A1";
// string dwwz = "B1";
// EXCELAPPLICATION.Range rng = xsheet.get_Range(wz, Missing.Value);
// //MessageBox.Show(rng.Value2.ToString());
// while(rng.Value2 != null)
// {
// i++;
// wz = "A" + i.ToString();
// rng = xsheet.get_Range(wz, Missing.Value);
// // MessageBox.Show(i.ToString());
// // MessageBox.Show(rng.Value.ToString());
// //MessageBox.Show(rng.Value2.ToString());
// }
// int j = i - 2;
// rng.Value2 = j.ToString();
// string time = DateTime.Now.ToLongDateString();
// string time2 = DateTime.Now.ToLongTimeString();
// string timestr = time + time2;
// dwwz = "B" + i.ToString();
// string prwz = "C" + i.ToString();
// string xmwz = "D" + i.ToString();
// string dhwz = "E" + i.ToString();
// string idwz = "F" + i.ToString();
// string szwz = "G" + i.ToString();
// string jgwz = "H" + i.ToString();
// string sjwz = "I" + i.ToString();
// EXCELAPPLICATION.Range dwrng = xsheet.get_Range(dwwz, Missing.Value);
// dwrng.Value2 = dwinfo;
// EXCELAPPLICATION.Range prwzg = xsheet.get_Range(prwz, Missing.Value);
// prwzg.Value2 = proinfo;
// EXCELAPPLICATION.Range xmrng = xsheet.get_Range(xmwz, Missing.Value);
// xmrng.Value2 = xminfo;
// EXCELAPPLICATION.Range dhrng = xsheet.get_Range(dhwz, Missing.Value);
// dhrng.Value2 = phinfo;
// EXCELAPPLICATION.Range idrng = xsheet.get_Range(idwz, Missing.Value);
// idrng.Value2 = idinfo;
// EXCELAPPLICATION.Range szrng = xsheet.get_Range(szwz, Missing.Value);
// szrng.Value2 = label1.Text;
// EXCELAPPLICATION.Range jgrng = xsheet.get_Range(jgwz, Missing.Value);
// jgrng.Value2 = label2.Text;
// EXCELAPPLICATION.Range sjrng = xsheet.get_Range(sjwz, Missing.Value);
// sjrng.Value2 = timestr ;
// xbook.Save();
// xbook.Close();
// System.Windows.Forms.Application.DoEvents();
// EXCELA.Quit();
// GC.Collect();
////****結束
//main nm = new main();
//nm.REload();
//nm.Show();
this.FindForm().Close();
main nm = new main();
project pro = new project();
pro.Show();
//this.FindForm().Hide();
}
private void dy_Click(object sender, EventArgs e)
{
Form f1 = dy.FindForm();
int gx = f1.Location.X;
int gy = f1.Location.Y;
int gw = f1.Width;
int gh = f1.Height;
int gleft = f1.Location.X;
// MessageBox.Show(gx.ToString() + ";" + gy.ToString() + ";" + gw.ToString() + ";" + gh.ToString() + ";" + gleft.ToString() + ";");
screenshut(0, 0, gw, gh, 0, 0);
string pname = "項目名稱:" + label4.Text;
string cname = "單位名稱:"+dw.Text;
string lx = "抽取類型:" + label8.Text;
string xm = "抽取人姓名:"+label5.Text;
string dh = "聯系電話:"+label6.Text;
string pid ="身份證號:" +label7.Text;
string time1 = "抽取時間:"+label15.Text;
string jg = "抽取結果:"+label2.Text;
wordapp = new Msword.Application();
wordapp.DisplayAlerts = Msword.WdAlertLevel.wdAlertsNone;
wordapp.Visible = true;
object missing = System.Reflection.Missing.Value;
string path = System.AppDomain.CurrentDomain.BaseDirectory + "2020.doc"; ///???
object templatename = path;
// MessageBox.Show(path);
object dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\"+dw.Text+".doc";
object format = Msword.WdSaveFormat.wdFormatDocument;
worddoc = wordapp.Documents.Add(ref templatename, ref missing, ref missing, ref missing);
// PromptSelectionOptions pso = new PromptSelectionOptions();
string strcon = "建筑消防抽取結果確認表\n";
worddoc.Paragraphs.Last.Range.Font.Name = "黑體";
worddoc.Paragraphs.Last.Range.Font.Bold = 1;
worddoc.Paragraphs.Last.Range.Font.Size = 18;
wordapp.Selection.ParagraphFormat.LineSpacingRule = Microsoft.Office.Interop.Word.WdLineSpacing.wdLineSpaceDouble;
worddoc.Paragraphs.Alignment = Msword.WdParagraphAlignment.wdAlignParagraphLeft;
worddoc.Paragraphs.Last.Range.Text = strcon;
object unit = Msword.WdUnits.wdStory;
object count = 2;
wordapp.Selection.ParagraphFormat.Alignment = Msword.WdParagraphAlignment.wdAlignParagraphCenter;
wordapp.Selection.EndKey(ref unit, ref missing);
wordapp.Selection.MoveEnd(unit, missing);
wordapp.Selection.Font.Size = 11;
wordapp.Selection.Font.Bold = 0;
wordapp.Selection.Font.Name = "宋體";
wordapp.Selection.TypeText(lx);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(pname);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(cname);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(xm);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(pid);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(dh);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(time1);
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText(jg);
wordapp.Selection.TypeText("\n");
wordapp.Selection.ParagraphFormat.Alignment = Msword.WdParagraphAlignment.wdAlignParagraphRight;
wordapp.Selection.TypeText("抽取人簽字:____________________");
wordapp.Selection.TypeText("\n");
wordapp.Selection.TypeText("日期:____________________");
wordapp.Selection.TypeText("\n");
wordapp.Selection.ParagraphFormat.Alignment = Msword.WdParagraphAlignment.wdAlignParagraphLeft;
wordapp.Selection.TypeText("抽取結果截圖:");
wordapp.Selection.TypeText("\n");
object rang2 = worddoc.Paragraphs.Last.Range;
object linktofile = false;
object savewdoc = true;
worddoc.InlineShapes.AddPicture(filepath, ref linktofile, ref savewdoc, ref rang2);
worddoc.SaveAs(ref dir, ref format, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
qr.Visible = true;
}
private void result_FormClosing_1(object sender, FormClosingEventArgs e)
{
System.Environment.Exit(0);
}
private void dwxx_Click(object sender, EventArgs e)
{
}
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern int BitBlt(HandleRef hDC, int x, int y, int nWidth, int nHeight, HandleRef hSrcDC, int xSrc, int ySrc, int dwRop);
private void screenshut(int intx,int inty,int intwidth,int inthigh,int intleft,int intright)
{
DateTime ndate = new DateTime();
ndate = DateTime.Now;
string filename = ndate.ToFileTime().ToString();
filepath = @"c:\myresult\" + filename + ".bmp";
Rectangle rect = new Rectangle();
rect = this.Bounds;
Graphics g1 = this.CreateGraphics();
Bitmap mybmp = new Bitmap(intwidth, inthigh, g1);
Graphics g2 = Graphics.FromImage(mybmp);
IntPtr dc1 = g1.GetHdc();
HandleRef hdcsrc = new HandleRef(null, dc1);
IntPtr dc2 = g2.GetHdc();
HandleRef hdcsave = new HandleRef(null, dc2);
const int scrcop = 0xcc0020;
BitBlt(hdcsave, intx, inty, intwidth, inthigh, hdcsrc, intleft, intright, scrcop);
g1.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
mybmp.Save(filepath, ImageFormat.Bmp);
}
}
}
浙公網安備 33010602011771號