Hi
I think you may just try to override the property below
Control.ShowFocusCues Property
Property Value
true if the control should display focus rectangles; otherwise, false.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwindowsformscontrolclassshowfocuscuestopic.asp
protected override bool ShowFocusCues
{
get
{
return false;
}
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Ronnie Smith - 30 Aug 2005 20:08 GMT
Hi Peter,
Thanks for the suggestion but - no joy - it didn't work.
Any other ideas?
Thanks,
Ronnie
> Hi
>
[quoted text clipped - 20 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 31 Aug 2005 03:18 GMT
Hi
Here is my test code for your reference, you may have a try and let me know
the result.
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace CustomControlButton
{
/// <summary>
/// Summary description for UserControl1.
/// </summary>
public class CustomButton : System.Windows.Forms.Button
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public CustomButton()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitComponent call
}
protected override bool ShowFocusCues
{
get
{
return false;
}
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// UserControl1
//
this.Name = "CustomButton";
}
#endregion
}
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Ronnie Smith - 31 Aug 2005 20:51 GMT
I tried your code Peter and of course it works EXCEPT for my situation where
I have the FlatStyle property set to Flat. Try it and you'll see the
rectangle appear with a mouse click. Perhaps there is something else we need
to override?
> Hi
>
[quoted text clipped - 73 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 01 Sep 2005 04:50 GMT
Hi
This is a known issue, so far the Flat and standard button has different
draw function so that Flat Button did not check the ShowFocusCues property
when draw button down.
We are planning to fix the problem in the next release.(Whidbey)
So far I think you may have to draw the button yourself to workaround the
problem.
Here is a link as a reference for you.
http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/brow
se_thread/thread/92854dc07796453/a00e896d5b41699b?lnk=st&q=ShowFocusCues+Fla
t&rnum=2&hl=zh-CN#a00e896d5b41699b
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Ronnie Smith - 01 Sep 2005 17:14 GMT
Thanks Peter. Sorry I wasn't more specific with my original query. I should
have mentioned that it was a flat button from the start.
Best regards,
Ronnie
> Hi
>
[quoted text clipped - 16 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 02 Sep 2005 04:37 GMT
Hi
You are welcomed!
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.