对C#的exe更改图标
图标 标题都在属性里面
置顶
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked == true)
this.TopMost = true;
else
this.TopMost = false;
}
最大化https://blog.csdn.net/qywl2014/article/details/77992875
意思是要最大化的时候窗口一起变化,有的是VS设置属性
感觉不好用 用代码自己写
1
public partial class CPU卡调试神器FM1208 : Form
{
static int button23_Click_flag=1;
float xvalues;//MOVE
float yvalues;//MOVE
2
private void CPU卡调试神器FM1208_Load(object sender, EventArgs e)
{//MOVE
this.Resize += new EventHandler(MainForm_Resize); //添加窗体拉伸重绘事件
xvalues = this.Width;//记录窗体初始大小
yvalues = this.Height;
SetTag(this);
}
private void MainForm_Resize(object sender, EventArgs e)//重绘事件
{//MOVE
float newX = this.Width / xvalues;//获得比例
float newY = this.Height / yvalues;
SetControls(newX, newY, this);
}
private void SetControls(float newX, float newY, Control cons)//改变控件的大小
{//MOVE
foreach (Control con in cons.Controls)
{
string[] mytag = con.Tag.ToString().Split(new char[] { ':' });
float a = Convert.ToSingle(mytag[0]) * newX;
con.Width = (int)a;
a = Convert.ToSingle(mytag[1]) * newY;
con.Height = (int)a;
a = Convert.ToSingle(mytag[2]) * newX;
con.Left = (int)a;
a = Convert.ToSingle(mytag[3]) * newY;
con.Top = (int)a;
Single currentSize = Convert.ToSingle(mytag[4]) * newY;
con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
if (con.Controls.Count > 0)
{
SetControls(newX, newY, con);
}
}
}
/// <summary>
/// 遍历窗体中控件函数
/// </summary>
/// <param name="cons"></param>
private void SetTag(Control cons)
{//MOVE
foreach (Control con in cons.Controls) //遍历窗体中的控件,记录控件初始大小
{
con.Tag = con.Width + ":" + con.Height + ":" + con.Left + ":" + con.Top + ":" + con.Font.Size;
if (con.Controls.Count > 0)
{
SetTag(con);
}
}
}
https://blog.csdn.net/songling418/article/details/20489501
private void button24_Click(object sender, EventArgs e)
{
string strError;
if (richTextBox1.Text.Trim().Length<20)//此时不允许保存
{
strError = "数据小于20此时不能保存!";
MessageBox.Show(strError, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string path = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
path += "Info.md";
System.IO.File.WriteAllText(path, richTextBox1.Text);
//(@"C:\Users\Gong Jin Hua\Desktop\TEM\ggg.txt", richTextBox1.Text);
}