• 大小: 332KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: C#  图分割  

资源简介

能把一张大图片按照自己指定的大小来分割成几个小图片,比如 100*100的一个图片可以把它分割成10张100*10的图片,能保存当前流行的格式。具有错误日志功能,后台线程处理图片切割

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ImageCutOrSplit.Core;
using System.Threading;
using System.IO;

namespace ImageCutOrSplit
{
    public partial class ImageChange : DevExpress.XtraEditors.XtraForm
    {
        public ImageChange()
        {
            InitializeComponent();
            InitPicType();
            InitBackgroundWorker();
            SetImages();
            this.btnClose.Image = _closeImages[0];
            this.btnMin.Image = _minImages[0];
        }
        #region 私有变量
        private string _originalPath = ““;
        private string _pciSavePath = ““;
        private System.Drawing.Imaging.ImageFormat _imageFormat = null;
        private BackgroundWorker oBackgroundWorker = null;
        private Image[] oImage = null;

        private int _originalX = 0;
        private int _originalY = 0;

        private int _formX = 0;
        private int _formY = 0;

        public Image[] _minImages;
        public Image[] _closeImages;
        #endregion
        #region 私有方法
        /// 
        /// 初始化图片类型
        /// 

        private void InitPicType()
        {
            foreach (System.Drawing.Imaging.ImageFormat format in TypeDescriptor.GetConverter(typeof(System.Drawing.Imaging.ImageFormat)).GetStandardValues())
            {
                this.PicType.Properties.Items.Add(TypeDescriptor.GetConverter(format).ConvertToString(format));
            }
        }
        /// 
        /// 验证填写值不为空
        /// 

        private bool ValidateNotEmpty()
        {
            if (this.picPath.Text.Trim().Length <= 0)
            {
                MessageBox.Show(“请选择图片!“ “图片分割系统“ MessageBoxButtons.OK MessageBoxIcon.Warning MessageBoxDefaultButton.Button1 MessageBoxOptions.RightAlign);
                this.picPath.Focus();
                return false;
            }
            if (this.picSavePath.Text.Trim().Length <= 0)
            {
                MessageBox.Show(“请选择保存路径!“ “图片分割系统“ MessageBoxButtons.OK MessageBoxIcon.Warning MessageBoxDefaultButton.Button1 MessageBoxOptions.RightAlign);
                this.picSavePath.Focus();
                return false;
            }
            if (this.picWidth.Text.Trim().Length <= 0 || this.picHeight.Text.Trim().Length <= 0)
            {
                MessageBox.Show(“请填写图片规格!“ “图片分割系统“ MessageBoxButtons.OK MessageBoxIcon.Warning MessageBoxDefaultButton.Button1 MessageBoxOptions.RightAlign);
                this.picWidth.Focus();
                return false;
            }
            if (this.PicType.SelectedText.Trim().Length <= 0)
            {
                MessageBox.Show(“请选择图片类型!“ “图片分割系统“ MessageBoxButtons.OK MessageBoxIcon.Warning MessageBoxDefaultButton.Button1 MessageBoxOptions.Ri

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      61440  2008-03-27 14:10  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\DevExpress.LocalizationCHS.dll

     文件      49152  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\ImageCutOrSplit.exe

     文件      38400  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\ImageCutOrSplit.pdb

     文件       5632  2005-12-08 14:51  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\ImageCutOrSplit.vshost.exe

     文件        699  2008-04-14 16:16  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\NLog.config

     文件     253952  2006-09-18 20:39  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\NLog.dll

     文件       5131  2007-12-13 14:40  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\skin\close_buttons.png

     文件       4309  2007-12-13 14:40  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\skin\minimize_buttons.png

     文件       8960  2008-08-25 16:14  ImageCutOrSplit\ImageCutOrSplit\bin\Debug\skin\title.png

     文件      61440  2008-03-27 14:10  ImageCutOrSplit\ImageCutOrSplit\bin\DevExpress.LocalizationCHS.dll

     文件     253952  2006-09-18 20:39  ImageCutOrSplit\ImageCutOrSplit\bin\NLog.dll

     文件       5116  2008-08-27 14:35  ImageCutOrSplit\ImageCutOrSplit\Core\ImageSplit.cs

     文件        481  2008-08-26 17:13  ImageCutOrSplit\ImageCutOrSplit\Core\LogException.cs

     文件      11099  2008-08-27 14:06  ImageCutOrSplit\ImageCutOrSplit\ImageChange.cs

     文件      37907  2008-08-27 14:06  ImageCutOrSplit\ImageCutOrSplit\ImageChange.Designer.cs

     文件      20196  2008-08-27 14:06  ImageCutOrSplit\ImageCutOrSplit\ImageChange.resx

     文件       5109  2008-08-27 13:55  ImageCutOrSplit\ImageCutOrSplit\ImageCutOrSplit.csproj

     文件        168  2008-08-26 17:13  ImageCutOrSplit\ImageCutOrSplit\ImageCutOrSplit.csproj.user

     文件        699  2008-04-14 16:16  ImageCutOrSplit\ImageCutOrSplit\NLog.config

     文件        848  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\obj\Debug\ImageCutOrSplit.csproj.GenerateResource.Cache

     文件      49152  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\obj\Debug\ImageCutOrSplit.exe

     文件       9472  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\obj\Debug\ImageCutOrSplit.ImageChange.resources

     文件      38400  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\obj\Debug\ImageCutOrSplit.pdb

     文件        180  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\obj\Debug\ImageCutOrSplit.Properties.Resources.resources

     文件       1184  2008-08-27 14:18  ImageCutOrSplit\ImageCutOrSplit\obj\ImageCutOrSplit.csproj.FileListAbsolute.txt

     文件        726  2008-08-27 13:59  ImageCutOrSplit\ImageCutOrSplit\Program.cs

     文件       1182  2008-08-26 10:47  ImageCutOrSplit\ImageCutOrSplit\Properties\AssemblyInfo.cs

     文件       2886  2008-08-26 10:47  ImageCutOrSplit\ImageCutOrSplit\Properties\Resources.Designer.cs

     文件       5612  2008-08-26 10:47  ImageCutOrSplit\ImageCutOrSplit\Properties\Resources.resx

     文件       1100  2008-08-26 10:47  ImageCutOrSplit\ImageCutOrSplit\Properties\Settings.Designer.cs

............此处省略22个文件信息

评论

共有 条评论