private void SetRadioButtonRgn() {
IntPtr hRgn = Win32.CreateRoundRectRgn(0, 1, radioButton1.Height, radioButton1.Height + 1, radioButton1.Height, radioButton1.Height);
//for (int i = 1; i <= 6; i++) {
// MessageBox.Show(this.Controls["radioButton" + i].Handle.ToString());
// Win32.SetWindowRgn(this.Controls["radioButton" + i].Handle, hRgn, true);
// //System.Threading.Thread.Sleep(500);
//}
//for (int i = 0; i < this.Controls.Count; i++) {
// if(this.Controls[i] is RadioButton)
// Win32.SetWindowRgn(this.Controls[i].Handle, hRgn, true);
//}
Win32.SetWindowRgn(this.Controls["radioButton1"].Handle, hRgn, true);
Win32.SetWindowRgn(this.Controls["radioButton2"].Handle, hRgn, true);
}在窗体上 有六个radiobutton我想对他们进行切割只有那个选择的原点
在上面代码中 用字符串去索引的 只对第一个有用 用int索引的 只生效最后执行的一个 其他都是失败
然后 复制的两个代码值和 字符串索引的结果一样只生效最先执行的那个 其他的都失败
求解、、
如果 真是这个问题的话 那么也不会出现第一个有效和最后一个有些 只会出现对radiobutton1有效
虽然 自己用自定义控件搞定了 不过对这个问题 还是比较好奇
最开始 我以为是出在 Handle 上面的问题
因为 以前在循环中提取某系列东西的Handle属性的时候出过错 如果循环里面 插入一个 thread.Sleep的话循环一次 暂停一下却又不出错 表示对于这些奇葩问题 很郁闷 不知道是不是我真哪里搞错了