Ejemplo n.º 1
0
        void InternalSetMessage(string strMessage)
        {
            if (m_messageBar is StatusStrip)
            {
                // ((StatusStrip)m_messageBar).Text = strMessage;
                Safe_SetStatusStripText(((StatusStrip)m_messageBar), strMessage);
            }
#if NO
            else if (m_messageBar is StatusBar)
            {
                // StatusBar 派生自 Control
                StatusBar statusbar = ((StatusBar)m_messageBar);

                Safe_SetStatusBarText(statusbar, strMessage);
            }
            else if (m_messageBar is Label)
            {
                // ((Label)m_messageBar).Text = strMessage;
                Safe_SetLabelText(((Label)m_messageBar), strMessage);
            }
#endif
            else if (m_messageBar is Control)
            {
                // ((TextBox)m_messageBar).Text = strMessage;
                Safe_SetTextBoxText(((Control)m_messageBar), strMessage);
            }
            else if (m_messageBar is ToolStripStatusLabel)
            {
                // TODO: ToolStripStatusLabel 也是继承自 ToolStripItem。此处代码可以删除了

                // ((ToolStripStatusLabel)m_messageBar).Text = strMessage;
                Safe_SetToolStripStatusLabelText((ToolStripStatusLabel)m_messageBar,
                    strMessage);
            }
            else if (m_messageBar is ToolStripItem)
            {
                Safe_SetToolStripItemText((ToolStripItem)m_messageBar,
                    strMessage);
            }

            if (this.OnDisplayMessage != null)
            {
                DisplayMessageEventArgs e = new DisplayMessageEventArgs();
                e.Message = strMessage;
                this.OnDisplayMessage(this, e);
            }
        }
Ejemplo n.º 2
0
        void InternalSetMessage(string strMessage)
        {
            if (m_messageBar is StatusStrip)
            {
                // ((StatusStrip)m_messageBar).Text = strMessage;
                Safe_SetStatusStripText(((StatusStrip)m_messageBar), strMessage);
            }
            else if (m_messageBar is StatusBar)
            {
                StatusBar statusbar = ((StatusBar)m_messageBar);

                Safe_SetStatusBarText(statusbar, strMessage);
            }
            else if (m_messageBar is Label)
            {
                // ((Label)m_messageBar).Text = strMessage;
                Safe_SetLabelText(((Label)m_messageBar), strMessage);
            }
            else if (m_messageBar is TextBox)
            {
                // ((TextBox)m_messageBar).Text = strMessage;
                Safe_SetTextBoxText(((TextBox)m_messageBar), strMessage);
            }
            else if (m_messageBar is ToolStripStatusLabel)
            {
                // ((ToolStripStatusLabel)m_messageBar).Text = strMessage;
                Safe_SetToolStripStatusLabelText((ToolStripStatusLabel)m_messageBar,
                    strMessage);
            }

            if (this.OnDisplayMessage != null)
            {
                DisplayMessageEventArgs e = new DisplayMessageEventArgs();
                e.Message = strMessage;
                this.OnDisplayMessage(this, e);
            }
        }