P
P
Pavel2016-10-07 05:41:10
C++ / C#
Pavel, 2016-10-07 05:41:10

NotifyIcon text over 64 characters C#. How to do?

notifyIcon.Text = "blah blah blah...";
Swears that more than 64 characters.
How to make it show more and not swear?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kestik, 2016-10-07
@kestik

This is a bug that can be worked around as follows (when using this method, the limit will be 127 characters):

NotifyIcon icon = new NotifyIcon();
string text = "bla-bla-bla";

// Оберните код ниже в метод для удобства.
Type t = typeof(NotifyIcon);
BindingFlags hidden = BindingFlags.NonPublic | BindingFlags.Instance;
t.GetField("text", hidden).SetValue(icon, text);
if ((bool)t.GetField("added", hidden).GetValue(icon))
{
  t.GetMethod("UpdateIcon", hidden).Invoke(icon, new object[] { true });
}

R
Rou1997, 2016-10-07
@Rou1997

Is there such a limitation at the WinAPI level? If yes, then it’s bad, and if not, then either act through reflection to get around the bug in .NET, it also has the source code open now, and if something is not there, it can be easily decompiled, or with WinAPI directly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question