We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid control problem while changing the windows style

Thread ID:

Created:

Updated:

Platform:

Replies:

91246 Nov 10,2009 11:57 AM UTC Nov 11,2009 09:23 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Muthupandi S
Asked On November 10, 2009 11:57 AM UTC

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

Ranjeet Kumar [Syncfusion]
Replied On November 11, 2009 09:23 AM UTC

Hi Mutpan,

Thanks for your interest in Syncfusion products.

The black rectangular box display in grid cell can be removed by handling the CellClick Event instead of CurrentCellControlGotFocus event that you was handling previously.

void gridControl1_CellClick(object sender, GridCellClickEventArgs 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);
}


}


BlackBoxRemoval-1396366434.zip

Regards,
Ranjeet Kumar

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;