C#_鼠标拖放图片透明缩略图效果实现思路一.doc_第1页
C#_鼠标拖放图片透明缩略图效果实现思路一.doc_第2页
C#_鼠标拖放图片透明缩略图效果实现思路一.doc_第3页
C#_鼠标拖放图片透明缩略图效果实现思路一.doc_第4页
C#_鼠标拖放图片透明缩略图效果实现思路一.doc_第5页
免费预览已结束,剩余2页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

C# 鼠标拖放透明缩略图实现思路一 vs2005 winform提示一下如果使用的是wpf就没有必要使用这个了,那个前台的动画要好的多。大家都知道.net是不支持拖放图效果的,本思路通过.net窗体来实现拖放过程中显示所拖放图片的缩略图效果。代码贴出来了,供大家参考,算是一种思路吧。partial class Form1 / / 必需的设计器变量。 / private System.ComponentModel.IContainer components = null; / / 清理所有正在使用的资源。 / / 如果应释放托管资源,为 true;否则为 false。 protected override void Dispose(bool disposing) if (disposing & (components != null) components.Dispose(); base.Dispose(disposing); #region Windows 窗体设计器生成的代码 / / 设计器支持所需的方法 - 不要 / 使用代码编辑器修改此方法的内容。 / private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.pictureBox6 = new System.Windows.Forms.PictureBox(); (System.ComponentModel.ISupportInitialize)(this.pictureBox1).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox2).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox3).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox4).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox5).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox6).BeginInit(); this.SuspendLayout(); / / pictureBox1 / this.pictureBox1.Image = (System.Drawing.Image)(resources.GetObject(pictureBox1.Image); this.pictureBox1.Location = new System.Drawing.Point(14, 12); this.pictureBox1.Name = pictureBox1; this.pictureBox1.Size = new System.Drawing.Size(159, 126); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; / / pictureBox2 / this.pictureBox2.Image = (System.Drawing.Image)(resources.GetObject(pictureBox2.Image); this.pictureBox2.Location = new System.Drawing.Point(204, 12); this.pictureBox2.Name = pictureBox2; this.pictureBox2.Size = new System.Drawing.Size(178, 126); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox2.TabIndex = 1; this.pictureBox2.TabStop = false; / / pictureBox3 / this.pictureBox3.Image = (System.Drawing.Image)(resources.GetObject(pictureBox3.Image); this.pictureBox3.Location = new System.Drawing.Point(401, 12); this.pictureBox3.Name = pictureBox3; this.pictureBox3.Size = new System.Drawing.Size(216, 126); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.TabIndex = 2; this.pictureBox3.TabStop = false; this.pictureBox3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseMove); this.pictureBox3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox3_MouseDown); / / pictureBox4 / this.pictureBox4.Image = (System.Drawing.Image)(resources.GetObject(pictureBox4.Image); this.pictureBox4.Location = new System.Drawing.Point(14, 188); this.pictureBox4.Name = pictureBox4; this.pictureBox4.Size = new System.Drawing.Size(159, 126); this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox4.TabIndex = 3; this.pictureBox4.TabStop = false; / / pictureBox5 / this.pictureBox5.Image = (System.Drawing.Image)(resources.GetObject(pictureBox5.Image); this.pictureBox5.Location = new System.Drawing.Point(204, 187); this.pictureBox5.Name = pictureBox5; this.pictureBox5.Size = new System.Drawing.Size(178, 126); this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox5.TabIndex = 4; this.pictureBox5.TabStop = false; / / pictureBox6 / this.pictureBox6.Image = (System.Drawing.Image)(resources.GetObject(pictureBox6.Image); this.pictureBox6.Location = new System.Drawing.Point(401, 188); this.pictureBox6.Name = pictureBox6; this.pictureBox6.Size = new System.Drawing.Size(216, 126); this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox6.TabIndex = 5; this.pictureBox6.TabStop = false; / / Form1 / this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(630, 318); this.Controls.Add(this.pictureBox6); this.Controls.Add(this.pictureBox5); this.Controls.Add(this.pictureBox4); this.Controls.Add(this.pictureBox3); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Name = Form1; this.Text = Form1; (System.ComponentModel.ISupportInitialize)(this.pictureBox1).EndInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox2).EndInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox3).EndInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox4).EndInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox5).EndInit(); (System.ComponentModel.ISupportInitialize)(this.pictureBox6).EndInit(); this.ResumeLayout(false); #endregion private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.PictureBox pictureBox5; private System.Windows.Forms.PictureBox pictureBox6;public partial class Form1 : Form public Form1() InitializeComponent(); int x = 0; int y = 0; Form2 objFrm=null; private void pictureBox3_MouseDown(object sender, MouseEventArgs e) int intTemp = Cursor.Position.X; x = e.X; y = e.Y; int xl = Cursor.Position.X ; int yl = Cursor.Position.Y; objFrm = new Form2(pictureBox3.Image); objFrm.Top = xl; objFrm.Left = yl-e.X; objFrm.Visible = false; objFrm.Show(); private void pictureBox3_MouseMove(object sender, MouseEventArgs e) if (e.Button = MouseButtons.Left) objFrm.Visible = true; objFrm.Location=new Point(Cursor.Position.X,Cursor.Position.Y); partial class Form2 / / 必需的设计器变量。 / private System.ComponentModel.IContainer components = null; / / 清理所有正在使用的资源。 / / 如果应释放托管资源,为 true;否则为 false。 protected override void Dispose(bool disposing) if (disposing & (components != null) components.Dispose(); base.Dispose(disposing); #region Windows 窗体设计器生成的代码 / / 设计器支持所需的方法 - 不要 / 使用代码编辑器修改此方法的内容。 / private void InitializeComponent() this.SuspendLayout(); / / Form2 / this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(42, 54); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = Form2; this.Opacity = 0.7; this.Text = Form2; this.TopMost = true; this.ResumeLayout(false); #endregionpublic partial class Form2 : Form Image objImage; public Form2(Image objImageTemp) InitializeComponent(); this.MouseDown += new MouseEventHandler(Form2_MouseDown); this.MouseMove += new MouseEventHandler(Form2_MouseMove); this.MouseUp +=

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论