using System; using System.Windows.Forms; using static Vanara.PInvoke.User32; namespace Vanara.Extensions { /// Extension methods for . public static partial class ComboBoxExtension { /// Sets the text displayed on a when no item has been selected. /// The instance. /// The cue banner text. /// This method is only support on Windows Vista and later. public static void SetCueBanner(this ComboBox cb, string cueBannerText) { if (System.Environment.OSVersion.Version.Major >= 6) { if (!cb.IsHandleCreated) return; SendMessage(cb.Handle, (uint)ComboBoxMessage.CB_SETCUEBANNER, IntPtr.Zero, cueBannerText); cb.Invalidate(); } else throw new PlatformNotSupportedException(); } } }