Hi,
I am using Syncfusion.Windows.Forms.Grid.GridControl in C# windows form in VS2008. I simply drag and drop the syncfusion grid control from the toolbar to my form and added the below lines of code to register the events of CurrentCellControlGotFocus and CurrentCellControlLostFocus.
when i am running my application and clicked on any cell of my application, i got black rectangle in my form as shown in the attached image.
Kindly guide me how to remove the black rectangle.
public partial class SyncFusionSample : Form
{
[DllImport("user32.dll", EntryPoint = "SetWindowLong")]
public static extern UInt32 SetWindowLongPtr(IntPtr hWnd, int nIndex, UInt32 dwNewLong);
[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
public static extern UInt32 GetWindowLongPtr(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
public SyncFusionSample()
{
InitializeComponent();
this.gridControl1.CurrentCellControlGotFocus += new ControlEventHandler(gridControl1_CurrentCellControlGotFocus);
this.gridControl1.CurrentCellControlLostFocus += new ControlEventHandler(gridControl1_CurrentCellControlLostFocus);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; /*WS_EX_COMPOSITED*/
return cp;
}
}
void gridControl1_CurrentCellControlLostFocus(object sender, ControlEventArgs e)
{
UInt32 m_Check = GetWindowLongPtr(Process.GetCurrentProcess().MainWindowHandle, -20 /*GWL_EXSTYLE*/);
UInt32 constValue = 0x02000000;/*WS_EX_COMPOSITED*/
if ((m_Check & constValue) != constValue)
{
SetWindowLongPtr(Process.GetCurrentProcess().MainWindowHandle, -20, m_Check | constValue);
}
}
void gridControl1_CurrentCellControlGotFocus(object sender, ControlEventArgs e)
{
UInt32 m_Check = GetWindowLongPtr(Process.GetCurrentProcess().MainWindowHandle, -20);
UInt32 constValue = 0x02000000;
if ((m_Check & constValue) == constValue)
{
SetWindowLongPtr(Process.GetCurrentProcess().MainWindowHandle, -20, m_Check & ~constValue);
}
}
}
SyncFusion GridcontrolProblem_2fe80bfa.zip