• 大小: 56KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-12
  • 语言: 其他
  • 标签: .net  c#  源码  

资源简介

.net 图片转字符画,可选择数字字符画,中文等模式 源码 .net 图片转字符画,可选择数字字符画,中文等模式 源码 .net 图片转字符画,可选择数字字符画,中文等模式 源码 .net 图片转字符画,可选择数字字符画,中文等模式 源码

资源截图

代码片段和文件信息

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Regularexpressions;
using System.Windows.Forms;

namespace Img2AscII
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 
        }

        private void button1_Click(object sender EventArgs e)
        {
            //初始化一个OpenFileDialog类
            OpenFileDialog fileDialog = new OpenFileDialog();

            //判断用户是否正确的选择了文件
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                //获取用户选择文件的后缀名
                string extension = Path.GetExtension(fileDialog.FileName);
                //声明允许的后缀名
                string[] str = new string[] { “.gif“ “.jpge“ “.jpg““.png“ };
                if (!((IList)str).Contains(extension))
                {
                    MessageBox.Show(“仅能上传gifjpgejpg格式的图片!“);
                }
                else
                {
                    //获取用户选择的文件,并判断文件大小不能超过200K,fileInfo.Length是以字节为单位的
                    FileInfo fileInfo = new FileInfo(fileDialog.FileName);
                    if (fileInfo.Length > 307200)
                    {
                        MessageBox.Show(“上传的图片不能大于300K“);
                    }
                    else
                    {
                        textBox1.Text = fileInfo.FullName;
                    }
                }
            }
        }

        private void label1_Click(object sender EventArgs e)
        {

        }

        private void button2_Click(object sender EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show(“请先选择图片!“);
            }
            if (string.IsNullOrEmpty(textBox4.Text))
            {
                MessageBox.Show(“填写输出全路径!“);
            }
            else
            {
                try
                {
                    var x = 8;
                    var y = 6;
                    if (!string.IsNullOrEmpty(textBox2.Text))
                        x = Convert.ToInt32(textBox2.Text);
                    if (!string.IsNullOrEmpty(textBox3.Text))
                        y = Convert.ToInt32(textBox3.Text);
                    Bitmap bm = new Bitmap(textBox1.Text);
                    var type = comboBox1.SelectedIndex;
                    var asctxt = Generate(bm x y type);
                    var path = “E:\\img2Asc.txt“;
                    path = textBox4.Text.ToString();
                    Write(path asctxt);
                    MessageBox.Show(“成功转化“);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Messa

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

     文件      14336  2016-10-28 14:54  Img2AscII\Img2AscII\bin\Debug\Img2AscII.exe

     文件      28160  2016-10-28 14:54  Img2AscII\Img2AscII\bin\Debug\Img2AscII.pdb

     文件      22656  2016-10-28 14:54  Img2AscII\Img2AscII\bin\Debug\Img2AscII.vshost.exe

     文件        490  2013-06-18 20:28  Img2AscII\Img2AscII\bin\Debug\Img2AscII.vshost.exe.manifest

     文件       8646  2016-10-28 14:54  Img2AscII\Img2AscII\Form1.cs

     文件       7199  2016-10-28 11:39  Img2AscII\Img2AscII\Form1.Designer.cs

     文件       5817  2016-10-28 11:39  Img2AscII\Img2AscII\Form1.resx

     文件       3782  2016-10-24 18:19  Img2AscII\Img2AscII\Img2AscII.csproj

     文件       1453  2016-10-25 09:09  Img2AscII\Img2AscII\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6791  2016-10-24 18:19  Img2AscII\Img2AscII\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        485  2016-10-28 14:54  Img2AscII\Img2AscII\obj\Debug\Img2AscII.csproj.FileListAbsolute.txt

     文件        977  2016-10-28 14:54  Img2AscII\Img2AscII\obj\Debug\Img2AscII.csproj.GenerateResource.Cache

     文件      14336  2016-10-28 14:54  Img2AscII\Img2AscII\obj\Debug\Img2AscII.exe

     文件        180  2016-10-28 14:54  Img2AscII\Img2AscII\obj\Debug\Img2AscII.Form1.resources

     文件      28160  2016-10-28 14:54  Img2AscII\Img2AscII\obj\Debug\Img2AscII.pdb

     文件        180  2016-10-28 14:54  Img2AscII\Img2AscII\obj\Debug\Img2AscII.Properties.Resources.resources

     文件        490  2016-10-24 16:45  Img2AscII\Img2AscII\Program.cs

     文件       1342  2016-10-24 16:45  Img2AscII\Img2AscII\Properties\AssemblyInfo.cs

     文件       2870  2016-10-24 16:45  Img2AscII\Img2AscII\Properties\Resources.Designer.cs

     文件       5612  2016-10-24 16:45  Img2AscII\Img2AscII\Properties\Resources.resx

     文件       1096  2016-10-24 16:45  Img2AscII\Img2AscII\Properties\Settings.Designer.cs

     文件        249  2016-10-24 16:45  Img2AscII\Img2AscII\Properties\Settings.settings

     文件        996  2016-10-24 16:45  Img2AscII\Img2AscII.sln

    ..A..H.     38912  2016-10-28 14:55  Img2AscII\Img2AscII.v12.suo

     目录          0  2016-10-24 16:45  Img2AscII\Img2AscII\obj\Debug\TempPE

     目录          0  2016-11-09 11:29  Img2AscII\Img2AscII\bin\Debug

     目录          0  2016-10-24 18:18  Img2AscII\Img2AscII\bin\Release

     目录          0  2016-11-09 11:29  Img2AscII\Img2AscII\obj\Debug

     目录          0  2016-11-09 11:29  Img2AscII\Img2AscII\bin

     目录          0  2016-11-09 11:29  Img2AscII\Img2AscII\obj

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

评论

共有 条评论