½ÌѧÎÄ¿âÍø - ȨÍþÎĵµ·ÖÏíÔÆÆ½Ì¨
ÄúµÄµ±Ç°Î»ÖãºÊ×Ò³ > ¾«Æ·Îĵµ > »¥ÁªÍø×ÊÁÏ >

ʵÑéÁù windows±à³Ì(3)

À´Ô´£ºÍøÂçÊÕ¼¯ ʱ¼ä£º2026-08-24
µ¼¶Á£º £¨2£©µ¥»÷¡°È·¶¨¡±°´Å¥£¬¿É½«textBoxÖеÄÎÄ×ÖÌí¼Óµ½label2ÖУ» £¨3£©label2ÖеÄÎÄ×Ö¿É×ÖÌå´óС¿ÉÇл»Èý´Î£¨Ð ¢ÖС¢´ó£©£¬³õʼ״̬ÏÂ×ÖÌåΪ¡°Ð ±£¬Ôò¡°ËõС×ÖÌ塱°´Å¥²»¿ÉÓã¬Ã¿´Îµ¥»÷¡°Ôö´ó×ÖÌ塱°´Å¥£¬¿ÉʹÔö´ó×ÖÌ

£¨2£©µ¥»÷¡°È·¶¨¡±°´Å¥£¬¿É½«textBoxÖеÄÎÄ×ÖÌí¼Óµ½label2ÖУ» £¨3£©label2ÖеÄÎÄ×Ö¿É×ÖÌå´óС¿ÉÇл»Èý´Î£¨Ð¡¡¢ÖС¢´ó£©£¬³õʼ״̬ÏÂ×ÖÌåΪ¡°Ð¡¡±£¬Ôò¡°ËõС×ÖÌ塱°´Å¥²»¿ÉÓã¬Ã¿´Îµ¥»÷¡°Ôö´ó×ÖÌ塱°´Å¥£¬¿ÉʹÔö´ó×ÖÌåÒ»ºÅ£¬µ±×ÖÌåÔö´óΪ¡°´ó¡±Ê±£¬¡°Ôö´ó×ÖÌ塱°´Å¥²»¿ÉÓã¬Ã¿´Îµ¥»÷¡°ËõС×ÖÌ塱°´Å¥£¬¿Éʹ×ÖÌåËõСһºÅ£»

£¨4£©¡°±ä»»×ÖÌåÑÕÉ«¡±°´Å¥£¬¿Éʹlabel2ÖеÄ×ÖÌåÑÕÉ«Ëæ»ú¸Ä±ä¡£ 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; namespace Test3 {

public partial class Form1 : Form {

public int Add = 0; //Ôö´ó×ÖÌå±êÖ¾£º0´ú±íС£¬1´ú±íÖУ¬2´ú±í´ó public Form1() {

this.StartPosition = FormStartPosition.CenterScreen; //´°¿Ú¾ÓÖÐÏÔʾ InitializeComponent(); }

//È·¶¨°´Å¥

private void button1_Click(object sender, EventArgs e) {

if (textBox1.Text == \ {

MessageBox.Show(\ÇëÊäÈëÎÄ×Ö£¡\ÌáʾÐÅÏ¢\MessageBoxIcon.Warning);

return; }

if (Add == 0) {

button3.Enabled = false; //ÉèÖÃËõС×ÖÌå²»¿ÉÓà }

richTextBox1.Text = textBox1.Text; //ÏÔʾÎÄ×Ö textBox1.Text = \Çå¿ÕÎÄ×Ö

textBox1.Focus(); //¶¨Î»ÊäÈë½¹µã }

//Ôö´ó×ÖÌå°´Å¥

private void button2_Click(object sender, EventArgs e) {

richTextBox1.SelectAll(); //ȫѡÎÄ×Ö

//richTextBox1.Select(0, 0); //È¡ÏûȫѡÎÄ×Ö if (richTextBox1.Text == \ {

MessageBox.Show(\µ±Ç°Îı¾¿òÎÞÎÄ×Ö\\ÌáʾÐÅÏ¢\MessageBoxButtons.OK, MessageBoxIcon.Warning);

return; }

richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont.FontFamily, richTextBox1.SelectionFont.Size + 1, richTextBox1.SelectionFont.Style);

Add++; if (Add !=0) {

button3.Enabled = true; //ÉèÖÃËõС×ÖÌå¿ÉÓà }

if (Add == 2) {

button2.Enabled = false; //ÉèÖÃÔö´ó×ÖÌå²»¿ÉÓà } }

//ËõС×ÖÌå°´Å¥

private void button3_Click(object sender, EventArgs e) {

richTextBox1.SelectAll(); //ȫѡÎÄ×Ö richTextBox1.SelectionFont = Font(richTextBox1.SelectionFont.FontFamily, richTextBox1.SelectionFont.Size richTextBox1.SelectionFont.Style);

Add--;

if (Add == 0) {

button3.Enabled = false; //ÉèÖÃËõС×ÖÌå²»¿ÉÓà }

if (Add < 2) {

button2.Enabled = true; //ÉèÖÃÔö´ó×ÖÌå¿ÉÓà } }

//±ä»»×ÖÌåÑÕÉ«°´Å¥

private void button4_Click(object sender, EventArgs e) {

richTextBox1.SelectAll(); //ȫѡÎÄ×Ö //richTextBox1.SelectionColor = Color.Red;

//ÉèÖÃ×ÖÌåÑÕÉ«£ºGetRandomColor()·½·¨ÊÇΪÁË»ñÈ¡Ëæ»úÑÕÉ« richTextBox1.SelectionColor = GetRandomColor();

new -1,

}

//¼ÓÔØ´°¿Ú

private void Form1_Load(object sender, EventArgs e) { }

//»ñÈ¡Ëæ»úÑÕÉ«

public Color GetRandomColor() {

Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // C#µÄËæ»úÊý

System.Threading.Thread.Sleep(RandomNum_First.Next(50));

Random RandomNum_Sencond = new Random((int)DateTime.Now.Ticks); // ΪÁËÔÚ°×É«±³¾°ÉÏÏÔʾ£¬¾¡Á¿Éú³ÉÉîÉ« int int_Red = RandomNum_First.Next(256);

int int_Green = RandomNum_Sencond.Next(256);

int int_Blue = (int_Red + int_Green > 400) ? 0 : 400 - int_Red - int_Green; int_Blue = (int_Blue > 255) ? 255 : int_Blue;

return Color.FromArgb(int_Red, int_Green, int_Blue); } } }

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Threading.Tasks; using System.Windows.Forms;

namespace WindowsFormsApplication3 {

public partial class Form1 : Form {

public Form1() {

InitializeComponent(); }

private void label1_Click(object sender, EventArgs e) { }

private void button1_Click(object sender, EventArgs e) {

textBox2.Text = textBox1.Text; }

public inti = 1;

private void button2_Click(object sender, EventArgs e) {

if (i< 3) {

textBox2.Font = new Font(\ËÎÌå\i++;

} }

private void button3_Click(object sender, EventArgs e) {

if (i> 1) {

textBox2.Font = new Font(\ËÎÌå\i--;

} }

private void button4_Click(object sender, EventArgs e) {

textBox2.ForeColor = Color.Red; } } }

4.ÊÔ±àдWindowsÓ¦ÓóÌÐò£¬Íê³ÉÏÂÁÐÒªÇó£º

£¨1£©Form1´°ÌåÉè¼Æ½çÃæÈçÏ£º

£¨2£©´°Ìå×ó²àΪһ¸ö¿¿×óÍ£¿¿µÄpanel£¬ÆäÖаüº¬Ò»¸ölabel¿Ø¼þ£» £¨3£©³õÊÔ״̬ʱ£¬¡°Ë®Æ½Òƶ¯¡±Ñ¡ÖУ¬µ±Óû§µ¥»÷¡°¿ªÊ¼Òƶ¯¡±°´Å¥Ê±£¬labelÔÚpanelÖÐˮƽ´Ó×óÏòÓÒÒÆ¶¯£¬µ¥»÷¡°ÔÝÍ£ÒÆ¶¯¡±°´Å¥Ê±£¬labelÍ£ÔÚԭλÖò»¶¯£»

£¨4£©ÔÚlabelÒÆ¶¯¹ý³ÌÖУ¬ÈôÓû§Çл»Òƶ¯·½Ê½£¬Ôòµ¯³ö¶Ô»°¿ò£¬ÌáʾÏÈÔÝÍ£ÒÆ¶¯£»ÔÚlabelÔÝÍ£ÒÆ¶¯Ê±£¬Óû§Çл»Òƶ¯·½Ê½£¬labelÔÚԭλÖÃÒÔ ¡­¡­ ´Ë´¦Òþ²Ø£º2644×Ö£¬È«²¿ÎĵµÄÚÈÝÇëÏÂÔØºó²é¿´¡£Ï²»¶¾ÍÏÂÔØ°É ¡­¡­

ʵÑéÁù windows±à³Ì(3).doc ½«±¾ÎĵÄWordÎĵµÏÂÔØµ½µçÄÔ£¬·½±ã¸´ÖÆ¡¢±à¼­¡¢ÊղغʹòÓ¡
±¾ÎÄÁ´½Ó£ºhttps://www.jiaowen.net/wendang/443947.html£¨×ªÔØÇë×¢Ã÷ÎÄÕÂÀ´Ô´£©

Ïà¹ØÍÆ¼ö£º

Copyright © 2020-2025 ½ÌÎÄÍø °æÈ¨ËùÓÐ
ÉùÃ÷ :±¾ÍøÕ¾×ðÖØ²¢±£»¤ÖªÊ¶²úȨ£¬¸ù¾Ý¡¶ÐÅÏ¢ÍøÂç´«²¥È¨±£»¤ÌõÀý¡·£¬Èç¹ûÎÒÃÇ×ªÔØµÄ×÷Æ·ÇÖ·¸ÁËÄúµÄȨÀû,ÇëÔÚÒ»¸öÔÂÄÚ֪ͨÎÒÃÇ£¬ÎÒÃǻἰʱɾ³ý¡£
¿Í·þQQ£º78024566 ÓÊÏ䣺78024566@qq.com
ËÕICP±¸19068818ºÅ-2
Top
¡Á ÓοͿì½ÝÏÂÔØÍ¨µÀ£¨ÏÂÔØºó¿ÉÒÔ×ÔÓɸ´ÖƺÍÅŰ棩
VIP°üÔÂÏÂÔØ
ÌØ¼Û£º29 Ôª/Ô ԭ¼Û:99Ôª
µÍÖÁ 0.3 Ôª/·Ý ÿÔÂÏÂÔØ150·Ý
ȫվÄÚÈÝÃâ·Ñ×ÔÓɸ´ÖÆ
VIP°üÔÂÏÂÔØ
ÌØ¼Û£º29 Ôª/Ô ԭ¼Û:99Ôª
µÍÖÁ 0.3 Ôª/·Ý ÿÔÂÏÂÔØ150·Ý
ȫվÄÚÈÝÃâ·Ñ×ÔÓɸ´ÖÆ
×¢£ºÏÂÔØÎĵµÓпÉÄܳöÏÖÎÞ·¨ÏÂÔØ»òÄÚÈÝÓÐÎÊÌ⣬ÇëÁªÏµ¿Í·þЭÖúÄú´¦Àí¡£
¡Á ³£¼ûÎÊÌ⣨¿Í·þʱ¼ä£ºÖÜÒ»µ½ÖÜÎå 9:30-18:00£©