Hello sameera,
Welcome to MSDN forums!
I've looked at your screen shot, but if we could not find a way to reproduce issue we not be able to reach the root cause of this issue easily.
However, let's try to narrow the issue down first. As the screen shot shows I'm not sure if the issue is caused by your customization, so, does this issue remains if you turn off your customization? Is there any other application level add-in is enabled in your Excel? When this appears what happens if you move Excel window or minimum/maximum Excel window? Will the issue disappear?
Anyway, we could try to force whole window redraw, this may help the issue?
[DllImport("user32.dll")]
static extern bool InvalidateRect(IntPtr hWnd, RECT lpRect, bool bErase);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[DllImport("user32.dll")]
static extern bool UpdateWindow(IntPtr hWnd);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
RECT rec;
GetWindowRect(Process.GetCurrentProcess().MainWindowHandle, out rec);
InvalidateRect(Process.GetCurrentProcess().MainWindowHandle, rec, false);
UpdateWindow(Process.GetCurrentProcess().MainWindowHandle);
Hope this helps you.
Thanks.
Tim Li
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact EMAIL GONE
Please remember to mark the replies as answers if they help and unmark them if they provide no help.