简体   繁体   English

C#-NotifyIcon如果textbox.text =“ hello”

[英]C# - NotifyIcon if textbox.text = “hello”

I want to show a notifyicon if for this code: 如果要使用此代码,我想显示一个notifyicon:

if (textbox.text == "hello");

Anyone have an idea on how i can do this? 有人对我该怎么做有想法吗?

Check this link 检查此链接

Notify Icon In C# Form 通知图标以C#形式

This code worked for me(set on a button click) 此代码对我有用(单击按钮即可设置)

private void button1_Click(object sender, EventArgs e)
    {
        if (textBox1.Text == "hello")
        {
            notifyIcon1.BalloonTipText = "hi";
            notifyIcon1.ShowBalloonTip(100);
        }
    }

Remember to add an icon to the notifyicon element. 请记住将图标添加到notifyicon元素。

It looks something like this probably. 看起来可能像这样。

if (textBox1.Text.ToLower() == "hello")
   notifyIcon1.Visible = true;
else
   notifyIcon1.Visible = false;

it shows and hides the notificationicon control 它显示和隐藏notificationicon控件

NOTE: add this to an event if you want it to perform automatically or call it explicitly using a method. 注意:如果您希望事件自动执行或使用方法显式调用,则将其添加到事件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM