📄 123.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace sys_3
{
/// <summary>
/// _123 的摘要说明。
/// </summary>
public class _123 : System.Web.UI.Page
{
// void CommandLine(string* s);
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button3;
protected System.Web.UI.WebControls.Button Button4;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.Button Button5;
protected System.Web.UI.WebControls.Button Button6;
protected System.Web.UI.WebControls.TextBox InputString;
protected System.Web.UI.WebControls.Button Button7;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Button Button8;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Button Button1;
[DllImport("kernel32.dll")]
public static extern int WinExec(string exeName, int operType);
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack)
Session["alpha"]=new sItem(100);
//Response.Write("<INPUT style=\"Z-INDEX: 171; LEFT: 148px; POSITION: absolute; TOP: 62px\" onclick=aaaaaa type=\"button\" value=\"正式下载!!\">");
}
private sItem sItest;
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Button4.Click += new System.EventHandler(this.Button4_Click);
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Button5.Click += new System.EventHandler(this.Button5_Click);
this.Button6.Click += new System.EventHandler(this.Button6_Click);
this.Button7.Click += new System.EventHandler(this.Button7_Click);
this.Button8.Click += new System.EventHandler(this.Button8_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
Item i;
i.x=this.TextBox1.Text;
i.y=this.TextBox2.Text;
sItest=(sItem)Session["alpha"];
sItest.add(i);
}
private void Button3_Click(object sender, System.EventArgs e)
{
sItest=(sItem)Session["alpha"];
for(int i=0;i<sItest.count;i++)
{
Item ii =(Item) sItest[i];
Response.Write(ii.x+"--"+ii.y+"<br>");
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
Item i;
i.x=this.TextBox1.Text;
i.y=this.TextBox2.Text;
sItest=(sItem)Session["alpha"];
sItest.delete(i);
}
private void Button4_Click(object sender, System.EventArgs e)
{
sItest=(sItem)Session["alpha"];
sItest.makeup();
}
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
private System.Diagnostics.Process process;
private string command=@"C:\WINDOWS\system32\xcopy c:\1.txt e:\";//C:\Program Files\AutoDWG\DWG2DWF\g2f.exe /F c:\d1.dwg /o c:\test.dwf ";
/*
* Response.Write("sss");
try
{
process=new Process();
process.StartInfo.FileName=@"g2f.exe";;//@"xcopy c:/1.txt d:/a.txt";
process.StartInfo.Arguments=@" /F c:\d1.dwg /O c:\test.dwf ";
process.StartInfo.WorkingDirectory = @"C:\DWG2DWF\";
this.process.Start(); //F c :\dwg\test.dwg /O c:\dwf\test.dwf
}
catch(Exception qq)
{
Response.Write("asdfsda");
}
Response.Write("sss1");
*/
private void Button5_Click(object sender, System.EventArgs e)
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
//设置外部程序名
Info.FileName = @"c:\BatConvert.exe";
//设置外部程序的启动参数(命令行参数)为test.txt
Info.Arguments = @" c:\a.bat ";
//设置外部程序工作目录为 C:\
Info.WorkingDirectory = @"C:\ ";
//声明一个程序类
System.Diagnostics.Process Proc ;
//process.StartInfo.UseShellExecute=false;
//process.StartInfo.FileName=@"g2f.exe";;//@"xcopy c:/1.txt d:/a.txt";
//process.StartInfo.Arguments=@" /F c:\d1.dwg /O c:\test.dwf ";
//process.StartInfo.WorkingDirectory = @"C:\DWG2DWF\";
try
{
//
//启动外部程序
//
Proc = System.Diagnostics.Process.Start(Info);
}
catch(System.ComponentModel.Win32Exception e22)
{
//Response.Write("系统找不到指定的程序文件。"+ e22);
e22=e22;
return;
}
//打印出外部程序的开始执行时间
//Response.Write("外部程序的开始执行时间:"+ Proc.StartTime);
//等待3秒钟
//Proc.WaitForExit(3000);
//如果这个外部程序没有结束运行则对其强行终止
if(Proc.HasExited == false)
{
//Response.Write ("由主程序强行终止外部程序的运行!");
Proc.Kill();
}
else
{
//Console.WriteLine("由外部程序正常退出!");
}
//Response.Write("外部程序的结束运行时间:{0}"+ Proc.ExitTime);
//Response.Write("外部程序在结束运行时的返回值:{0}"+ Proc.ExitCode);
}
private void Button6_Click(object sender, System.EventArgs e)
{
try
{
WinExec( "c:\\BatConvert.exe c:\\a.bat",0);
}
catch(System.ComponentModel.Win32Exception e212)
{
Response.Write("系统找不到指定的程序文件。"+ e212);
return;
}
//CommandLine(@"C:\WINDOWS\system32\cmd.exe");
}
private void Button7_Click(object sender, System.EventArgs e)
{
string a=InputString.Text.Trim();
int Max=a.Length;
a.GetEnumerator();
Response.Write(Max.ToString());
int i=Max-1;
while(!IsAlpha(a[i]) || !IsAlpha(a[i-1]))
{
bool d=IsAlpha(a[i])&&IsAlpha(a[i-1]);
Response.Write(d.ToString());
i--;
}
Label1.Text=makeupStr(a,0,i-2);
Label2.Text=a[i].ToString();
Label3.Text=a[i-1].ToString();
Label4.Text=makeupStr(a,i+1,Max-1);
}
private string makeupStr(string a , int f,int t)
{
string tStr=new string(' ',100);
for(int i=f;i<t+1;i++)
tStr+=a[i];
return tStr.Trim();
}
private bool IsAlpha(char c)
{
return (('a'<=c )&&(c<='z' ))||(('A'<=c )&&(c<='Z' ));
}
private void Button8_Click(object sender, System.EventArgs e)
{
try
{
Str c=new Str(InputString.Text.Trim());
Label1.Text=c.Name[0];
Label2.Text=c.Name[1];
Label3.Text=c.Name[2];
Label4.Text=c.Name[3];
}
catch(Exception ewwwe)
{
Label1.Text=ewwwe.ToString();
}
}
//sdfsd=C:\Program Files\AutoDWG\DWG2DWF\g2f.exe asdfsd+=sdfk
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -