示例#1
0
        public void EnableProtection(bool bEnable)
        {
            if (m_tbPassword == null)
            {
                Debug.Assert(false); return;
            }

            if (!MonoWorkarounds.IsRequired(5795))
            {
                if (bEnable)
                {
                    FontUtil.AssignDefault(m_tbPassword);
                }
                else
                {
                    FontUtil.SetDefaultFont(m_tbPassword);
                    FontUtil.AssignDefaultMono(m_tbPassword, true);
                }
            }

            if (m_tbPassword.UseSystemPasswordChar == bEnable)
            {
                return;
            }
            m_tbPassword.UseSystemPasswordChar = bEnable;

            ShowCurrentPassword(-1, -1);
        }
示例#2
0
        private void SetRtbData(string strData, bool bRtf, bool bFixedFont,
                                bool bLinkify)
        {
            if (strData == null)
            {
                Debug.Assert(false); strData = string.Empty;
            }

            m_rtbText.Clear();             // Clear formatting (esp. induced by Unicode)

            if (bFixedFont)
            {
                FontUtil.AssignDefaultMono(m_rtbText, false);
            }
            else
            {
                FontUtil.AssignDefault(m_rtbText);
            }

            if (bRtf)
            {
                m_rtbText.Rtf = StrUtil.RtfFix(strData);
            }
            else
            {
                m_rtbText.Text = strData;
            }

            if (bLinkify)
            {
                UIUtil.RtfLinkifyUrls(m_rtbText);
            }

            if (!bRtf)
            {
                Font f = (bFixedFont ? FontUtil.MonoFont : FontUtil.DefaultFont);
                if (f != null)
                {
                    m_rtbText.SelectAll();
                    m_rtbText.SelectionFont = f;
                }
                else
                {
                    Debug.Assert(false);
                }
            }

            m_rtbText.Select(0, 0);
        }