基本信息
源码名称:多重复制小工具(源码)
源码大小:0.08M
文件格式:.zip
开发语言:C#
更新时间:2020-01-15
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
可以快速复制文本框中的值
可以快速复制文本框中的值
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace MultiCopy
{
public partial class Form1 : Form
{
private FormDock formDock = null;
#region 写INI文件
private string FileName;
[DllImport("kernel32")]
private static extern bool WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, byte[] retVal, int size, string filePath);
public void WriteIni(string Section, string Ident, string Value)
{
if (!WritePrivateProfileString(Section, Ident, Value, FileName))
{
throw (new ApplicationException("写入配置文件出错"));
}
}
#endregion
#region 读取INI文件指定
public string ReadIni(string Section, string Ident, string Default)
{
Byte[] Buffer = new Byte[65535];
int bufLen = GetPrivateProfileString(Section, Ident, Default, Buffer, Buffer.GetUpperBound(0), FileName);
//必须设定0(系统默认的代码页)的编码方式,否则无法支持中文
string s = Encoding.GetEncoding(0).GetString(Buffer);
s = s.Substring(0, bufLen);
return s.Trim();
}
#endregion
public Form1()
{
InitializeComponent();
formDock = new FormDock(this,300);
}
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text != "")
Clipboard.SetDataObject(textBox1.Text);
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox2.Text != "")
Clipboard.SetDataObject(textBox2.Text);
}
private void button3_Click(object sender, EventArgs e)
{
if (textBox3.Text != "")
Clipboard.SetDataObject(textBox3.Text);
}
private void button4_Click(object sender, EventArgs e)
{
if (textBox4.Text != "")
Clipboard.SetDataObject(textBox4.Text);
}
private void button5_Click(object sender, EventArgs e)
{
if (textBox5.Text != "")
Clipboard.SetDataObject(textBox5.Text);
}
private void button6_Click(object sender, EventArgs e)
{
if (textBox6.Text != "")
Clipboard.SetDataObject(textBox6.Text);
}
private void button7_Click(object sender, EventArgs e)
{
if (textBox7.Text != "")
Clipboard.SetDataObject(textBox7.Text);
}
private void button8_Click(object sender, EventArgs e)
{
if (textBox8.Text != "")
Clipboard.SetDataObject(textBox8.Text);
}
private void button9_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
}
private void button10_Click(object sender, EventArgs e)
{
if (textBox9.Text != "")
Clipboard.SetDataObject(textBox9.Text);
}
private void button11_Click(object sender, EventArgs e)
{
if (textBox10.Text != "")
Clipboard.SetDataObject(textBox10.Text);
}
private void Form1_Load(object sender, EventArgs e)
{
Directory.CreateDirectory(Application.StartupPath "\\Config");//创建文件夹fs
FileName = Application.StartupPath "\\Config\\copyCfg.ini";
textBox1.Text = ReadIni("T1", "t1", "");
textBox2.Text = ReadIni("T2", "t2", "");
textBox3.Text = ReadIni("T3", "t3", "");
textBox4.Text = ReadIni("T4", "t4", "");
textBox5.Text = ReadIni("T5", "t5", "");
textBox6.Text = ReadIni("T6", "t6", "");
textBox7.Text = ReadIni("T7", "t7", "");
textBox8.Text = ReadIni("T8", "t8", "");
textBox9.Text = ReadIni("T9", "t9", "");
textBox10.Text = ReadIni("T10", "t10", "");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
WriteIni("T1", "t1", textBox1.Text);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
WriteIni("T2", "t2", textBox2.Text);
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
WriteIni("T3", "t3", textBox3.Text);
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
WriteIni("T4", "t4", textBox4.Text);
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
WriteIni("T5", "t5", textBox5.Text);
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
WriteIni("T6", "t6", textBox6.Text);
}
private void textBox7_TextChanged(object sender, EventArgs e)
{
WriteIni("T7", "t7", textBox7.Text);
}
private void textBox8_TextChanged(object sender, EventArgs e)
{
WriteIni("T8", "t8", textBox8.Text);
}
private void textBox9_TextChanged(object sender, EventArgs e)
{
WriteIni("T9", "t9", textBox9.Text);
}
private void textBox10_TextChanged(object sender, EventArgs e)
{
WriteIni("T10", "t10", textBox10.Text);
}
}
}