资源简介
用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文件内容
相关资源
- C#读取BIN文件内容
- C#与DVP PLC通信
- C# Winform 中实现的翻译功能
- WinIO v3.0 资源文件以及VB6和C#
- C#封装的JqGrid插件
- C#实现4种经典迷宫生成算法和迷宫寻
- C#连接数据库已封装好
- 使用c#.基于web在线选课系统
- C#压力测试程序,测试完毕后能够自动
- Arcengine+C# 做空间插值的
- 计算机图形学作业C#,图片鼠标,键盘
- c#窗体中的DataGridView及TreeView的应用
- C#编写的二叉排序树
- C#使用Socket实现服务器与多个客户端通
- 用C#做一个画图软件
- C#可视化打印模板设计工具含源码
- C#网络应用编程第3版习题答案
- C#实现窗体最小化和托盘功能源代码
-
C#获取xm
l文件信息显示到web界面 - 留言板用C#做的留言板
- C# asp.net http HttpWebRequest模拟浏览器请
-
xm
l Schema C#写的验证程序 - c#实现的简单画图程序源代码
- C# 仿迅雷源码
- C#实验—接口:正方形、三角形、圆形
- C#进销存源码
- 一个基于C# +SQL的学生成绩管理系统。
- 简单考试系统
- 快速傅里叶变换C#实现
- C#.NET编写的写字板程序
评论
共有 条评论