资源简介
用C#打开TIF文件,实现图片的缩放、移动等基本操作

代码片段和文件信息
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.IO;
namespace PicKeyin2
{
public partial class frmMain : Form
{
string PicWorkPath = string.Empty;//图片所在文件夹 工作区
Bitmap SourcePic;
private Point mouseDownPoint = new Point();
private bool isSelected = false;
double curZoomRate = 1;//当前放缩比率
public frmMain()
{
InitializeComponent();
Screen[] screens = Screen.AllScreens;// 显示设备的集合
Screen screen = screens[0];// 获取第一个显示设备
this.Left = 0;
this.Top = 0;
this.Height = screen.WorkingArea.Height;//获取桌面的工作区 高度
this.Width = screen.WorkingArea.Width;//获取桌面的工作区 宽度
IniComponent();
this.pictureBox1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseWheel);
}
private void pictureBox1_MouseWheel(object sender System.Windows.Forms.MouseEventArgs e)
{
if (SourcePic == null) return;
int numberOfTextLinesToMove = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
if (numberOfTextLinesToMove > 0)
{
//for (int i = 0; i < numberOfTextLinesToMove; i++)
//{
// max();
//}
max();
}
else if (numberOfTextLinesToMove < 0)
{
//for (int i = 0; i > numberOfTextLinesToMove; i--)
//{
// min();
//}
min();
}
}
private void IniComponent()
{
lbFolder.Text = ““;
cbFiles.Items.Clear();
ButtonEnableedFalse(false);
DataTable dt = new DataTable();
dt.Columns.Add(“Name“);
dt.Columns.Add(“Value“);
int i=10;
while (i <= 300)
{
dt.Rows.Add(new string[] { Convert.ToString(i) + “%“ Convert.ToString(i) });
i = i + 5;
}
this.cbZoom.DataSource = dt;
this.cbZoom.DisplayMember = “Name“;
this.cbZoom.ValueMember = “Value“;
}
private void ButtonEnableedFalse(bool bl)
{
btNext.Enabled = bl;
btPrior.Enabled = bl;
btZoom75.Enabled = bl;
btZoom100.Enabled = bl;
btZoom125.Enabled = bl;
btZoom150.Enabled = bl;
btZoom200.Enabled = bl;
}
private void btFolder_Click(object sender EventArgs e)
{
List files = new List();
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-08-30 11:43 PicKeyin2\
目录 0 2011-08-30 11:44 PicKeyin2\PicKeyin2\
文件 869 2011-08-30 11:43 PicKeyin2\PicKeyin2.sln
文件 19968 2011-08-30 16:39 PicKeyin2\PicKeyin2.suo
目录 0 2011-08-30 11:44 PicKeyin2\PicKeyin2\bin\
目录 0 2011-08-30 11:52 PicKeyin2\PicKeyin2\bin\Debug\
文件 19456 2011-08-30 16:25 PicKeyin2\PicKeyin2\bin\Debug\PicKeyin2.exe
文件 36352 2011-08-30 16:25 PicKeyin2\PicKeyin2\bin\Debug\PicKeyin2.pdb
文件 11600 2011-08-30 16:39 PicKeyin2\PicKeyin2\bin\Debug\PicKeyin2.vshost.exe
目录 0 2011-08-30 11:44 PicKeyin2\PicKeyin2\bin\Release\
文件 12552 2011-08-30 16:25 PicKeyin2\PicKeyin2\frmMain.cs
文件 15584 2011-08-30 16:13 PicKeyin2\PicKeyin2\frmMain.Designer.cs
文件 6229 2011-08-30 16:13 PicKeyin2\PicKeyin2\frmMain.resx
目录 0 2011-08-30 11:43 PicKeyin2\PicKeyin2\obj\
目录 0 2011-08-30 11:43 PicKeyin2\PicKeyin2\obj\x86\
目录 0 2011-08-30 16:25 PicKeyin2\PicKeyin2\obj\x86\Debug\
文件 6223 2011-08-30 16:25 PicKeyin2\PicKeyin2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 256 2011-08-30 16:13 PicKeyin2\PicKeyin2\obj\x86\Debug\GenerateResource.read.1.tlog
文件 618 2011-08-30 16:13 PicKeyin2\PicKeyin2\obj\x86\Debug\GenerateResource.write.1.tlog
文件 720 2011-08-30 16:39 PicKeyin2\PicKeyin2\obj\x86\Debug\PicKeyin2.csproj.FileListAbsolute.txt
文件 19456 2011-08-30 16:25 PicKeyin2\PicKeyin2\obj\x86\Debug\PicKeyin2.exe
文件 180 2011-08-30 16:13 PicKeyin2\PicKeyin2\obj\x86\Debug\PicKeyin2.frmMain.resources
文件 36352 2011-08-30 16:25 PicKeyin2\PicKeyin2\obj\x86\Debug\PicKeyin2.pdb
文件 180 2011-08-30 11:52 PicKeyin2\PicKeyin2\obj\x86\Debug\PicKeyin2.Properties.Resources.resources
目录 0 2011-08-30 11:43 PicKeyin2\PicKeyin2\obj\x86\Debug\TempPE\
文件 3687 2011-08-30 11:44 PicKeyin2\PicKeyin2\PicKeyin2.csproj
文件 492 2011-08-30 11:44 PicKeyin2\PicKeyin2\Program.cs
目录 0 2011-08-30 11:43 PicKeyin2\PicKeyin2\Properties\
文件 1350 2011-08-30 11:43 PicKeyin2\PicKeyin2\Properties\AssemblyInfo.cs
文件 2868 2011-08-30 11:43 PicKeyin2\PicKeyin2\Properties\Resources.Designer.cs
文件 5612 2011-08-30 11:43 PicKeyin2\PicKeyin2\Properties\Resources.resx
............此处省略2个文件信息
- 上一篇:C#与DVP PLC通信
- 下一篇:C#读取BIN文件内容
相关资源
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
评论
共有 条评论