부모 폼에서로드하는 자식 폼이 있습니다. 부모 폼은 MDI 부모가 아닙니다. 다음 작업을 수행하고 싶습니다.C# Window Forms 컨트롤 스타일, 스타일을 통해 포커스 제거 변경
포커스가있는 컨트롤, 특히 Buttons 및 RadioButtons를 중심으로 점선/점선 사각형을 비활성화하고 싶습니다.
현재 나는 다음과 같은 코드를 사용하고 : 내하는 SetStyle 방법은 말할public static void SetStyle(System.Windows.Forms.Control control, ControlStyles styles,
bool newValue)
{
// .. set control styles for the form
object[] args = { styles, newValue };
typeof(System.Windows.Forms.Control).InvokeMember("SetStyle",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod,
null, control, args);
}
없이 어디
foreach (System.Windows.Forms.Control control in this.Controls)
{
// Prevent button(s) and RadioButtons getting focus
if (control is Button | control is RadioButton)
{
HelperFunctions.SetStyle(control, ControlStyles.Selectable, false);
}
}
는,이 작동하지 않습니다. 내가 여기서 무엇을 놓치고 있는지 잘 모르겠습니다. 모든 제안 및/또는 조언을 크게 주시면 감사하겠습니다.