110,538
社区成员
发帖
与我相关
我的任务
分享
private void text_content_TextChanged(object sender, EventArgs e)
{
int i=0;
int count=Encoding.Unicode.GetByteCount(text_content.Text)/ 64;
textBox_charnumber.Text = Encoding.Unicode.GetByteCount(text_content.Text).ToString();//输出text_content里的字符数。
for ( i = 0; i <= count; i++)//定义了64个按钮。
{
btn[i].BackColor = Color.Green;
}
if (btn[63].BackColor == Color.Green)
{
MessageBox.Show("内存已满");//如何实现当按钮全为绿色的时候 text_content不能输入只能删除?
return;
}
}
private void text_content_KeyUp(object sender, KeyEventArgs e)
{
if (user.Text.Length > 10)
{
SendKeys.Send("\b");
return;
} int i = 0;
int count = Encoding.Unicode.GetByteCount(text_content.Text) / 64;
textBox_charnumber.Text = Encoding.Unicode.GetByteCount(text_content.Text).ToString();//输出text_content里的字符数。
for (i = 0; i <= count; i++)//定义了64个按钮。
{
btn[i].BackColor = Color.Green;
}
}