本人 已验证中文U版与官方公布的一致,其它版本请大家自行验证
SHA1: 44B73423A7BBCE38D06BA55ECD821946630BEA4D
![]()
软件版本: Visual Studio 2010
-----------------------------------------------------------------------------
软件类型: 开发编程
-----------------------------------------------------------------------------
MSDN Professional包含Key(简体中文版本):ed2k://|file|cn_visual_studio_2010_professional_x86_dvd_532145.iso|2591844352|6001253431AFE573E4344F5A0B1D9CAC|/
MSDN Ultimate包含Key(简体中文版本):ed2k://|file|cn_visual_studio_2010_ultimate_x86_dvd_532347.iso|2685982720|4AE6228933DDE49D9BFA4C3467C831C2|/
MSDN Team Foundation Server包含Key(简体中文版本):ed2k://|file|cn_visual_studio_team_foundation_server_2010_x86_x64_dvd_531909.iso|1963589632|C9C77B2707DF100621B3FB653C285524|/
MSDN Team Foundation Server包含Key(繁體中文版本):ed2k://|file|ct_visual_studio_team_foundation_server_2010_x86_x64_dvd_531915.iso|1966714880|D6BD12D5B693E7EDA545D52FB54CC8E5|/
MSDN Ultimate包含Key(繁體中文版本):ed2k://|file|ct_visual_studio_2010_ultimate_x86_dvd_532348.iso|2691330048|BF50926EAB061C7D0D92580F4132F9EA|/
MSDN Professional包含Key(英文版本):ed2k://|file|en_visual_studio_2010_professional_x86_dvd_509727.iso|2351316992|D395B6381AC129209EE80D9BED4BA5F1|/
MSDN Ultimate包含Key(英文版本):ed2k://|file|en_visual_studio_2010_ultimate_x86_dvd_509116.iso|2446950400|0694CFA0756D8C11499DE5B42E205410|/
MSDN Premium包含Key(英文版本):ed2k://|file|en_visual_studio_2010_premium_x86_dvd_509357.iso|2439485440|C72F6195CAC0932AA5B6861AE863FDBC|/
MSDN Express包含Key(英文版本):ed2k://|file|en_visual_studio_2010_express_x86_dvd_510419.iso|727351296|1D2EE178370FBD55E925045F3A435DCC|/
MSDN Team Foundation Server包含Key(英文版本):ed2k://|file|en_visual_studio_team_foundation_server_2010_x86_x64_dvd_509406.iso|1723766784|70DC63F8B39D09C2B0BAE63DFB0673C9|/
在网上搜了一通后, 发现中文世界到处都在吹 VS 2010 怎么怎么怎么好, 但就是没一篇文章来说说这三个版本有什么区别. 真是杯具....
没人说, 只好自己动手丰衣足食了. 经搜索找到了这一张版本比较图, 发出来给大家看看, 好选择下载适合自己的版本.
Enterprise Library Configuration是Enterprise Library附带的编辑App.Config的工具,安装Enterprise Library就会编译生成。使用这个工具编辑App.config时非常方便,但是也遇到一些使用上的问题。记录下来,以备后查。
问题起因:在调试的过程中,希望能够跟踪到Enterprise Library的内部,所以将Enterprise Library的Blocks中的代码加入到了自己的项目中,并在项目中引用这些组件。
问题描述:使用VSTS的插件Enterprise Library Configuration编辑并保存项目的App.config。在编译时选择全部重新编译,顺利通过(中间也遇到些小麻烦,不过不是本文档的重点讨论范畴)。运行时,一旦调用到Enterprise Library的组件,便会报以下错误提示:
未能加载文件或程序集“Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项,找到程序集清单定义与程序集不匹配。(异常来自……)
问题分析:
1、看到PublicKeyToken,就猜测是因为强命名的关系,即清单与引用的程序集强命名不匹配(准确的说是公钥和私钥不匹配)。
2、 不匹配的原因:微软发布的程序集是包含强命的(即“……\Enterprise Library 4\ Bin”中的*.dll)。而本机编译得到的程序集是不包含强命名的(即“……Enterprise Library 4\EntLib4SCR\Bin”中的*.dll)
3、 VSTS 中嵌入的Enterprise Library Configuration是微软发布的,所以用它来编辑App.Config就会在配置文件中引入强命名,而项目引用的是本机编译得到的程序集,自然不匹配。
解决办法:
1、 使用VSTS中嵌入的Enterprise Library Configuration(“……\Enterprise Library 4\ Bin”)编辑配置文件,但引用的程序集一定得是微软发布的(“……\Enterprise Library 4\ Bin”)。
2、 使用本机编译得到的Enterprise Library Configuration(“……Enterprise Library 4\EntLib4SCR\Bin”)来编辑配置文件,引用的程序集就可以是本机编译得到的(“……Enterprise Library 4\EntLib4SCR\Bin”)。
其实道理很简单,就是必须得用配套的东西,要么用微软发布的,要么用本机编译的。
后记:
1、 本来是想可以使用Enterprise Library的同时还可以编辑其中的代码,没想到弄巧成拙。版本控制在微软这样的企业必定是非常严格的,所以如果你想修改Enterprise Library版本,合理的做法是也给Enterprise Library的每个项目都加上强命名(巨大的工作)。
2、 为了表述清楚,上文中的本地编译得到的程序集(“……Enterprise Library 4\EntLib4SCR\Bin”)实际上是在安装Enterprise Library时得到的,如果你希望使用的是已经经过你修改的程序集,应该使用“……Enterprise Library 4\EntLib4SCR\Block\Configuration\Src\Console\bin\Debug”下的Enterprise Library Configuration来编辑你的配置文件,才能确保正确。
3、网上大部分说法是去掉配置文件中的“PublicKeyToken=31bf3856ad364e35”,我觉得这样做不是很合理,虽然能够使用,但是显然损失了很多可控性。原理是因为本机默认编译出的程序集本身就是“PublicKeyToken=null”,所以能够通过。
终于有点明白了,本人才疏学浅,这么简单的问题搞了这么久,不过欣慰的是总算有点收获。还有一点没有搞明白的是:VSTS中的插件路径在什么地方保存,要是知道直接改到本地编译后的路径就好了。我在本地文件和注册表中都没有找到(注册表中有这个路径,不过改了之后没有效果)。希望路过的高手能告诉一声,先谢了!
最新接到任务需要给客户制作个能图片截取并合成编辑的小程序,研究了两天GDI+,改了段C#截图功能的代码,现贴上来希望对大家有用
主文件
CaptureScreenForm.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
namespace CaptureScreen
{
/// <summary>
/// CaptureScreenForm 的摘要说明。
/// </summary>
public class CaptureScreenForm : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox picbox;
private System.Windows.Forms.Button exitBtn;
private System.Windows.Forms.Button aboutBtn;
private System.Windows.Forms.Button ClearBtn;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.Button fullScreenBtn;
private System.Windows.Forms.Button mouseCaptureBtn;
public static Image image = null ;
private System.Windows.Forms.Panel panel1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public CaptureScreenForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.picbox = new System.Windows.Forms.PictureBox();
this.fullScreenBtn = new System.Windows.Forms.Button();
this.mouseCaptureBtn = new System.Windows.Forms.Button();
this.ClearBtn = new System.Windows.Forms.Button();
this.saveBtn = new System.Windows.Forms.Button();
this.aboutBtn = new System.Windows.Forms.Button();
this.exitBtn = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// picbox
//
this.picbox.Location = new System.Drawing.Point(0, 40);
this.picbox.Name = "picbox";
this.picbox.Size = new System.Drawing.Size(680, 312);
this.picbox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.picbox.TabIndex = 0;
this.picbox.TabStop = false;
//
// fullScreenBtn
//
this.fullScreenBtn.Location = new System.Drawing.Point(0, 0);
this.fullScreenBtn.Name = "fullScreenBtn";
this.fullScreenBtn.Size = new System.Drawing.Size(96, 32);
this.fullScreenBtn.TabIndex = 1;
this.fullScreenBtn.Text = "全屏截取";
this.fullScreenBtn.Click += new System.EventHandler(this.fullScreenBtn_Click);
//
// mouseCaptureBtn
//
this.mouseCaptureBtn.Location = new System.Drawing.Point(120, 0);
this.mouseCaptureBtn.Name = "mouseCaptureBtn";
this.mouseCaptureBtn.Size = new System.Drawing.Size(96, 32);
this.mouseCaptureBtn.TabIndex = 2;
this.mouseCaptureBtn.Text = "鼠标截取";
this.mouseCaptureBtn.Click += new System.EventHandler(this.mouseCaptureBtn_Click);
//
// ClearBtn
//
this.ClearBtn.Location = new System.Drawing.Point(240, 0);
this.ClearBtn.Name = "ClearBtn";
this.ClearBtn.Size = new System.Drawing.Size(88, 32);
this.ClearBtn.TabIndex = 3;
this.ClearBtn.Text = "清除截取图片";
this.ClearBtn.Click += new System.EventHandler(this.ClearBtn_Click);
//
// saveBtn
//
this.saveBtn.Location = new System.Drawing.Point(352, 0);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(96, 32);
this.saveBtn.TabIndex = 4;
this.saveBtn.Text = "保存截取图片";
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// aboutBtn
//
this.aboutBtn.Location = new System.Drawing.Point(472, 0);
this.aboutBtn.Name = "aboutBtn";
this.aboutBtn.Size = new System.Drawing.Size(96, 32);
this.aboutBtn.TabIndex = 5;
this.aboutBtn.Text = "关 于";
this.aboutBtn.Click += new System.EventHandler(this.aboutBtn_Click);
//
// exitBtn
//
this.exitBtn.Location = new System.Drawing.Point(592, 0);
this.exitBtn.Name = "exitBtn";
this.exitBtn.Size = new System.Drawing.Size(88, 32);
this.exitBtn.TabIndex = 6;
this.exitBtn.Text = "退 出";
this.exitBtn.Click += new System.EventHandler(this.exitBtn_Click);
//
// panel1
//
this.panel1.Controls.Add(this.fullScreenBtn);
this.panel1.Controls.Add(this.mouseCaptureBtn);
this.panel1.Controls.Add(this.ClearBtn);
this.panel1.Controls.Add(this.saveBtn);
this.panel1.Controls.Add(this.aboutBtn);
this.panel1.Controls.Add(this.exitBtn);
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(680, 32);
this.panel1.TabIndex = 7;
//
// CaptureScreenForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(696, 358);
this.Controls.Add(this.panel1);
this.Controls.Add(this.picbox);
this.Name = "CaptureScreenForm";
this.Text = "截取屏幕";
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new CaptureScreenForm());
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
if(image != null)
{
this.picbox.Image = image;
}
else
{
this.picbox.Image = null;
this.picbox.Refresh();
}
}
// 引用API
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
public static extern bool BitBlt(
IntPtr hdcDest, //目标设备的句柄
int nXDest, // 目标对象的左上角的X坐标
int nYDest, // 目标对象的左上角的X坐标
int nWidth, // 目标对象的矩形的宽度
int nHeight, // 目标对象的矩形的长度
IntPtr hdcSrc, // 源设备的句柄
int nXSrc, // 源对象的左上角的X坐标
int nYSrc, // 源对象的左上角的X坐标
System.Int32 dwRop // 光栅的操作值
);
private void exitBtn_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void aboutBtn_Click(object sender, System.EventArgs e)
{
MessageBox.Show("Code by MaxWeill in 2009-9-4,E_mail: maxweill@126.com ,thank you to use this.");
}
private void ClearBtn_Click(object sender, System.EventArgs e)
{
CaptureScreenForm.image = null;
this.Invalidate();
}
private void saveBtn_Click(object sender, System.EventArgs e)
{
bool isSave = true;
SaveFileDialog saveImageDialog = new SaveFileDialog();
saveImageDialog.Title = "Capture screen image save dialog";
saveImageDialog.Filter= @"jpeg*.jpgbmp*.bmpgif*.gif";
if(saveImageDialog.ShowDialog() == DialogResult.OK)
{
string fileName = saveImageDialog.FileName.ToString();
if(fileName != "" && fileName != null)
{
string fileExtName = fileName.Substring(fileName.LastIndexOf(".")+1).ToString();
System.Drawing.Imaging.ImageFormat imgformat = null;
if(fileExtName!="")
{
switch(fileExtName)
{
case "jpg":
imgformat = System.Drawing.Imaging.ImageFormat.Jpeg;
break;
case "bmp":
imgformat = System.Drawing.Imaging.ImageFormat.Bmp;
break;
case "gif":
imgformat = System.Drawing.Imaging.ImageFormat.Gif;
break;
default:
MessageBox.Show("只能存取为: jpg,bmp,gif 格式");
isSave = false;
break;
}
}
//默认保存为JPG格式
if(imgformat == null)
{
imgformat = System.Drawing.Imaging.ImageFormat.Jpeg;
}
if(isSave)
{
try
{
CaptureScreenForm.image.Save(fileName,imgformat);
MessageBox.Show("图片已经成功保存!~~");
}
catch
{
MessageBox.Show("保存失败,你还没有截取过图片或已经清空图片!");
}
}
}
}
}
private void fullScreenBtn_Click(object sender, System.EventArgs e)
{
CaptureScreenForm.image = windowFullScreen();
picbox.Image = CaptureScreenForm.image;
}
public static Bitmap windowFullScreen()
{
//建立屏幕Graphics
Graphics grpScreen = Graphics.FromHwnd(IntPtr.Zero);
//根据屏幕大小建立位图
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,grpScreen);
//建立位图相关Graphics
Graphics grpBitmap = Graphics.FromImage(bitmap);
//建立屏幕上下文
IntPtr hdcScreen = grpScreen.GetHdc();
//建立位图上下文
IntPtr hdcBitmap = grpBitmap.GetHdc();
//将屏幕捕获保存在图位中
BitBlt(hdcBitmap,0,0,bitmap.Width,bitmap.Height,hdcScreen,0,0,0x00CC0020);
//关闭位图句柄
grpBitmap.ReleaseHdc(hdcBitmap);
//关闭屏幕句柄
grpScreen.ReleaseHdc(hdcScreen);
//释放位图对像
grpBitmap.Dispose();
//释放屏幕对像
grpScreen.Dispose();
//返回捕获位图
return bitmap;
}
private void mouseCaptureBtn_Click(object sender, System.EventArgs e)
{
MouseCaptureForm mouseCapture = new MouseCaptureForm();
mouseCapture.Show();
}
}
}
另一个截屏文件:
MouseCaptureForm.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace CaptureScreen
{
/// <summary>
/// MouseCaptureForm 的摘要说明。
/// </summary>
public class MouseCaptureForm : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
//
//自定义变量
//
private Point pot;
private Rectangle area = Rectangle.Empty;
private Image img;
private int index = -1;
private string noselectString = "\n.请按下鼠标左键不放拖动选取截图区域\n\n .单击鼠标右键或按ESC取消截图";
private string selectingString = "\n.松开鼠标左键确定选取范围\n\n.按ESC重新选择";
private string selectedString = "\n.按鼠标左键调整选择范围\n\n .双击鼠标左键保存截图 \n\n.按鼠标右键重新选择 \n\n.ESC键取消截图";
private System.Windows.Forms.Label tiptext;
//
//系统生成定义
//
private System.ComponentModel.Container components = null;
public MouseCaptureForm()
{
this.Bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
this.BackgroundImage = CaptureScreenForm.windowFullScreen();
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tiptext = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// tiptext
//
this.tiptext.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
this.tiptext.ForeColor = System.Drawing.Color.White;
this.tiptext.Location = new System.Drawing.Point(10, 10);
this.tiptext.Name = "tiptext";
this.tiptext.Size = new System.Drawing.Size(166, 140);
this.tiptext.TabIndex = 0;
this.tiptext.MouseMove += new System.Windows.Forms.MouseEventHandler(this.tiptext_MouseMove);
//
// MouseCaptureForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(456, 320);
this.Controls.Add(this.tiptext);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "MouseCaptureForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds;
this.Text = "鼠标截屏";
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MouseCaptureForm_KeyDown);
this.Load += new System.EventHandler(this.MouseCaptureForm_Load);
this.DoubleClick += new System.EventHandler(this.MouseCaptureForm_DoubleClick);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 重载MouseDown
/// </summary>
///
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown (e);
{
if(this.area == Rectangle.Empty && e.Button == MouseButtons.Left)
{
this.tiptext.Text = selectingString;
this.area.Location = new Point(e.X,e.Y);
}
this.pot = new Point(e.X,e.Y);
this.index = this.GetSelectedHandle(new Point(e.X,e.Y));
this.SetCursor();
}
}
/// <summary>
/// 设置鼠标方案
/// </summary>
private void SetCursor()
{
Cursor cr = Cursors.Default;
if(index == 1&& index == 5)
{
cr = Cursors.SizeNWSE;
}
else if(index == 2 && index == 6)
{
cr = Cursors.SizeNS;
}
else if(index == 3&& index == 7)
{
cr = Cursors.SizeNESW;
}
else if(index == 4 && index == 8)
{
cr = Cursors.SizeWE;
}
else if(index == 0)
{
cr = Cursors.SizeAll;
}
Cursor.Current = cr;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawRectangle(new Pen(this.ForeColor),this.area);
for(int i = 1;i < 9;i++)
{
e.Graphics.FillRectangle(new SolidBrush(Color.Green),this.GetHandleRect(i));
}
}
private Rectangle GetHandleRect(int index)
{
Point point = GetHandle(index);
return new Rectangle(point.X - 3, point.Y - 3, 6, 6);
}
private Point GetHandle(int index)
{
int x, y, xCenter, yCenter;
xCenter = area.X + area.Width/2;
yCenter = area.Y + area.Height/2;
x = area.X;
y = area.Y;
switch ( index )
{
case 1:
x = area.X;
y = area.Y;
break;
case 2:
x = xCenter;
y = area.Y;
break;
case 3:
x = area.Right;
y = area.Y;
break;
case 4:
x = area.Right;
y = yCenter;
break;
case 5:
x = area.Right;
y = area.Bottom;
break;
case 6:
x = xCenter;
y = area.Bottom;
break;
case 7:
x = area.X;
y = area.Bottom;
break;
case 8:
x = area.X;
y = yCenter;
break;
}
return new Point(x, y);
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp (e);
int left = area.Left;
int top = area.Top;
int right = area.Right;
int bottom = area.Bottom;
area.X = Math.Min(left,right);
area.Y = Math.Min(top,bottom);
area.Width = Math.Abs(left-right);
area.Height = Math.Abs(top-bottom);
this.tiptext.Text = selectedString;
if(e.Button == MouseButtons.Right)
{
if(this.area == Rectangle.Empty)
{
this.Close();
}
else
{
this.area=Rectangle.Empty;
this.Invalidate();
}
}
this.index = this.GetSelectedHandle(new Point(e.X,e.Y));
this.SetCursor();
}
private int GetSelectedHandle(Point p)
{
int index = -1;
for(int i = 1;i < 9;i++)
{
if(GetHandleRect(i).Contains(p))
{
index=i;
break;
}
}
if(this.area.Contains(p))index = 0;
return index;
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove (e);
if(this.Capture)
{
this.MoveHandleTo(new Point(e.X,e.Y));
this.Invalidate();
}
else
{
this.index = this.GetSelectedHandle(new Point(e.X,e.Y));
this.SetCursor();
}
}
private void MoveHandleTo(Point point)
{
int left = area.Left;
int top = area.Top;
int right = area.Right;
int bottom = area.Bottom;
switch ( index )
{
case 0:
area.X +=point.X - this.pot.X;
area.Y += point.Y - pot.Y;
this.pot = point;
return;
case 1:
left = point.X;
top = point.Y;
break;
case 2:
top = point.Y;
break;
case 3:
right = point.X;
top = point.Y;
break;
case 4:
right = point.X;
break;
case 5:
right = point.X;
bottom = point.Y;
break;
case 6:
bottom = point.Y;
break;
case 7:
left = point.X;
bottom = point.Y;
break;
case 8:
left = point.X;
break;
}
this.pot = point;
area.X = left;
area.Y = top;
area.Width = right - left;
area.Height = bottom - top;
}
private void MouseCaptureForm_DoubleClick(object sender, System.EventArgs e)
{
//修正截取图片过界提示内存不足BUG
int left = area.Left;
int right = area.Right;
int top = area.Top;
int bottom = area.Bottom;
if(left < Screen.PrimaryScreen.Bounds.Left)
{left = Screen.PrimaryScreen.Bounds.Left; }
if(right > Screen.PrimaryScreen.Bounds.Right )
{right = Screen.PrimaryScreen.Bounds.Right;}
if(top < Screen.PrimaryScreen.Bounds.Top)
{top = Screen.PrimaryScreen.Bounds.Top;}
if(bottom > Screen.PrimaryScreen.Bounds.Bottom)
{bottom = Screen.PrimaryScreen.Bounds.Bottom;}
area.X = left;
area.Y = top;
area.Width = right - left;
area.Height = bottom - top;
//截取选择区域图片
Bitmap bm = new Bitmap(this.BackgroundImage);
this.img = bm.Clone(this.area,System.Drawing.Imaging.PixelFormat.Format16bppArgb1555);
CaptureScreenForm.image = img;
CaptureScreenForm.ActiveForm.Invalidate();
this.Close();
}
private void MouseCaptureForm_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyData == Keys.Escape && System.Windows.Forms.Button.MouseButtons == MouseButtons.Left)
{
this.area=Rectangle.Empty;
this.Invalidate();
tiptext.Text = noselectString;
}
else if(e.KeyData == Keys.Escape)
{this.Close();}
}
private void tiptext_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (tiptext.Location.X == 10 && tiptext.Location.Y == 10)
{
Point formloc = new Point((Screen.PrimaryScreen.Bounds.Width - 176),10) ;
tiptext.Location = formloc;
}
else
{tiptext.Location = new Point(10,10);}
}
private void MouseCaptureForm_Load(object sender, System.EventArgs e)
{
tiptext.Text = noselectString;
}
}
}
先把这段JS代码放到你页面的HTML中去
function catch_keydown(sel) { switch(event.keyCode) {
case 13: //Enter;
sel.options[sel.length] = new Option("","",false,true);
event.returnValue = false;
break;
case 27: //Esc;
alert("text:" + sel.options[sel.selectedIndex].text + ", value:" + sel.options[sel.selectedIndex].value + ";");
event.returnValue = false;
break;
case 46: //Delete;
if(confirm("刪除當前內容!?")) {
sel.options[sel.selectedIndex] = null;
if(sel.length>0) { sel.options[0].selected = true; } }
event.returnValue = false; break;
case 8: //Back Space;
var s = sel.options[sel.selectedIndex].text;
sel.options[sel.selectedIndex].text = s.substr(0,s.length-1);
event.returnValue = false; break; } }
function catch_press(sel) {
sel.options[sel.selectedIndex].text = sel.options[sel.selectedIndex].text + String.fromCharCode
(event.keyCode); event.returnValue = false;
}
然后在你的程序中拖拽一个 DropDownList 控件,在到HTML页中找到这个 控件的 代码
在他后面加上 onkeydown="catch_keydown(this);" onkeypress="catch_press(this);"
运行程序就好了
SQL Server 安装完毕后,在重新安装 SQL Server Management Studio ,即为中文,OK!