状态条标签文字 [英] statusstrip label text

查看:83
本文介绍了状态条标签文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,专家,

我的主要表单中有一个带有各种标签文本的状态条.我想通过另一种形式在此statusstrip上显示一条消息.但是不能.

请帮助我.


--- Anil Kumar Bhakta

Hi Experts,

I have a statusstrip with various label-text in my main form. I want to show the a messages on this statusstrip from another form. But can''t do.

Kindly help me please.


--- Anil Kumar Bhakta

推荐答案

尝试创建一个委托,然后使用它从调用表单中对其进行设置.
Try to create a delegate, Then use it to set it from the calling form.


有两种方法可以解决此问题,但最简单的方法是以public形式创建状态条.
There are a couple of ways to address this, but the easiest is to make the statusstrip in the form public.


您可以使用委托,但更正确的方法是使用接口.
例如:

You can use the delegate, but more correctly are using interfaces.
For example:

public interface IMessenger
{
    void ShowMessage(string text);
}




并从此接口继承主形式或其他类.
在适当的类/表单中,例如设置属性"Messenger",进行设置和使用.这种方式比委托人更灵活.




And inherit maybe main form, or maybe other classes from this interface.
In the appropriate classes/forms make for example a property ''Messenger'', set it and use. This way is more flexible than delegates.


这篇关于状态条标签文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆