效果:spa
點擊後不獲得焦點且不影響當前焦點所在位置,相似系統計算器中按鈕的效果。code
能夠實現無焦點的按鈕、複選框、單選框等控件。blog
using System.Reflection Private void SetButton(Button button) { MethodInfo methodinfo = button.GetType().GetMethod("SetStyle",BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod); methodinfo.Invoke(button,BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod,null,new object[] {ControlStyles.Selectable,false},Application.CurrentCulture); }