0
在我的Windows Mobile 6.0应用程序中,我有一个ImageButton control given by Microsoft。如何在Windows Mobile应用程序中创建专注的ImageButton?
我想让我的ImageButton控件具有像任何标准按钮一样的焦点边框。我如何做到这一点?
在我的Windows Mobile 6.0应用程序中,我有一个ImageButton control given by Microsoft。如何在Windows Mobile应用程序中创建专注的ImageButton?
我想让我的ImageButton控件具有像任何标准按钮一样的焦点边框。我如何做到这一点?
我想在代码的一些操作后提出答案。
关键是要检查控制是否聚焦在OnPaint方法并绘制透明或黑色边框:
gxOff.DrawRectangle(new Pen((this.Focused) ? Color.Black : Color.Transparent), rc);
和OnGotFocus和OnLostFocus事件调用invalidate():
protected override void OnGotFocus(EventArgs
{
base.OnGotFocus(e);
this.Invalidate();
}
protected override void OnLostFocus(EventArgs e)
{
base.OnLostFocus(e);
this.Invalidate();
}
希望它会帮助某人:)