自动生成仿古文字
|低|举|疑|床|静
|头|头|是|前|夜
|思|望|地|明|思
|故|明|上|月|
|乡|月|霜|光|
自定义分隔符:
☽低☽举☽疑☽床☽静
☽头☽头☽是☽前☽夜
☽思☽望☽地☽明☽思
☽故☽明☽上☽月☽
☽乡☽月☽霜☽光☽
上面这些怎么自动生成呢!
下面共享C#源代码,需要改进的请自行修改,该版本纯属测试。
- 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.Drawing.Imaging;
- namespace easysayit
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- textBox2.Text = "";
- if (textBox1.Text == "")
- { textBox1.Text = "sosecret.net 专注个人隐私保护"; }
- int line = 10;
- int colum = 10;
- line = int.Parse(textBox4.Text);
- colum = int.Parse(textBox3.Text);
- string a = textBox1.Text;
- //hengtoshu(a, line, colum);
- string s = hengtoshu (a, line, colum);
- //textBox2.Text += s;
- }
- private string hengtoshu(string origin, int line, int colum)
- {
- char[] ori = origin.ToCharArray();
- char[] after = new char[line * (colum * 2 + 1) + line + 4];
- //-----------------添加分隔符---------------
- for (int i = 1; i <= line * (colum * 2 + 1) + line + 1; i++)
- {
- char ins = char.Parse (textBox5.Text);
- after[i - 1] = ins;
- }
- //--------------------添加换行符-------
- for (int i = 1; i <= line; i++)
- {
- after[colum * 2 + 1 + (i - 1) * (colum * 2 + 2)-1] = '/r';
- after[colum * 2 + 1 + (i - 1) * (colum * 2 + 2)] = '/n';
- }
- after[line * (colum * 2 + 1) + line-1] ='/r';
- after[line * (colum * 2 + 1) + line] = '/n';
- after[line * (colum * 2 + 1) + line+1] = '/r';
- after[line * (colum * 2 + 1) + line+2] = '/n';
- //---------------------添加空格------------
- bool flag = false;
- for (int i = 1, count = 0, off = 0; i <= colum; i++, off += 2)
- {
- for (int j = 1; j <= line; j++, count++)
- {
- if (count < ori.Length)
- { after[colum * 2 - 1 - off + (colum * 2 + 2) * (j - 1)] = ori[count]; }
- else
- {
- after[colum * 2 - 1 - off + (colum * 2 + 2) * (j - 1)] = ' ';
- flag = true;
- }
- }
- }
- //------------------------------
- textBox2.Text += new string(after);
- if (!flag)
- {
- origin = origin.Remove(0, colum * line);
- hengtoshu (origin, line, colum);
- return "sosecret.net";
- }
- else { return "sosecret.net"; }
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- System.Diagnostics.Process.Start("http://www.sosecret.net");
- }
- private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
- {
- form2 form2 = new form2();
- form2.ShowDialog();
- }
- private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- }
- private void menuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- }
- }