Issues with UI bleeding through from background

edited May 2015
I have a multi-monitor setup as I imagine most people have. When using LinqPad I find that sometimes if I have moved the linqpad application to one of my other monitors, the results when running queries gives me a wierd effect. It's like parts of whatever application is behind the LinqPad application are bleeding through parts of the screen. I have found a small work around, which is to adjust the results pane after executing and the problem goes away until I run another query. I do believe this only happens when I have docked the application to a monitor that it did not originally open on. So I am not sure if it is a resolution issue or what, but it can get to be annoying after a while.


  • Just FYI...the area highlighted is this website bleeding through the LinqPad application. It actually created an additional window and pushed the results grid down like a 100 or so pixels.
  • Can you give a step-by-step repro?
  • I often get this too. Resizing the window fixes the results pane. It only happens in results grid view for me. I assumed it was because of my triple monitor setup.
  • I have always gotten this as well. No a huge deal but gets a little annoying. Any sort of resize command clears it up.
  • I can give you a step by step repro for this annoying issue (the only annoyance on what is one of my favorite dev products):
    Open LINQPad on a Windows 10 machine with multiple monitors.
    Move LINQPad to a monitor that is not the default.
    Open the sample query "A simple query expression".
    Switch the query to display results in the data grid (Ctrl-Shift-G)
    Run the query.
    The results window will be misplaced and there will be a "hole" in the main LINQPad window where the results grid should be. (I can post a screenshot, if needed)
    Move or Resize the LINQPad window and the results grid will pop back into place.

    Based on experimentation, I can tell you if make the LINQPad window narrow enough (roughly 400 pixels wide on my setup), the results grid will briefly open misplaced and then relocate back to its proper place. If the initial position of the grid window is off-screen, you won't even notice.

    Also, this doesn't happen on the monitor you designate as the "main monitor" in the Windows Display Settings. Unfortunately for me, I never use LINQPad on my main monitor because I move my Surface Pro 3 daily between two different multi-monitor setups (home and work). I prefer keeping the Surface as the main monitor to avoid Windows display hell when I move between the two setups.
  • Sorry, I've just tried this around a dozen times on a Windows 10 laptop connected to an external monitor via DisplayPort, and can't reproduce. Are you using anything else special, such as virtual desktops? And I take it you're using LINQPad 5?
  • edited May 2017
    Another repro:

    (Not related to main monitor since it occurs on both primary and secondary screen)

    - Run "A simple query expression" in data grid mode
    - Maximize/restore window a few times (hotkey: Win+Up, Win+Down, maybe 10 times)



    I think both issues are related to incorrect data grid panel dimensioning and placement.

    Also note that it's possible to maximize the data grid using Win+Up when grid has focus.. this is a hidden feature :)
  • Joe,

    Thanks for the reply. I'm running the latest release version of LINQPad 5. I'm running plain vanilla Windows 10 on a Surface Pro 3. No virtual desktops or anything like that.
    I have developed a work around that other folks may want to try.

    Provided "as is" without warranty of any kind, either expressed or implied, including limitation warranties of merchantability, fitness for a particular purpose, and noninfringement.

    Create a C# program script like this:

    [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
    public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);
    [DllImport("user32.dll", SetLastError = true)]
    static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
    static extern bool UpdateWindow(IntPtr hWnd);

    void Main()

    const short SWP_NOZORDER = 0X4;
    const int SWP_SHOWWINDOW = 0x0040;

    Process[] processes = Process.GetProcesses(".");
    foreach (var process in processes)
    var windowTitle = process.MainWindowTitle;
    var handle = process.MainWindowHandle;
    RECT lpRect = new RECT();
    if (process.MainWindowTitle == "LINQPad 5")
    GetWindowRect(handle, out lpRect);
    SetWindowPos(handle, 0, lpRect.Left + 1, lpRect.Top + 1, lpRect.Right - lpRect.Left, lpRect.Bottom - lpRect.Top, SWP_NOZORDER | SWP_SHOWWINDOW);
    Save it to your query directory. I called mine GridFix.Linq. Now, add this line to the end of a query that sends its results to the grid:
    Util.Run("GridFix.Linq", QueryResultFormat.Text);
    The script moves the LINQPad window 1 pixel down and 1 pixel to the right. This has the effect of making the grid pop back into place. The reason you need to use Util.Run is that the code has to execute after the grid has painted. I originally tried this as a method in MyExtensions, but that didn't work consistently.
    By the way, I know this is a horrible hack, but it works, at least until LINQPad 6 comes out and you have to update the string to match for the MainWindowTitle.

    For convenience, I also created a script named a.linq (so it sorts to the top of My Queries) that looks like this:

    //For queries that send results to the grid

    Util.Run("GridFix.Linq", QueryResultFormat.Text);
    I'll be using that as a template for most of my LINQPad work. And don't forget the small print above...

    By the way, is there any way to change the default blank template to include this line?
  • Try the latest beta:

    I'm not certain it will fix the problem (because I can't repro), but there's a reasonable chance, based on the workaround you posted.
  • The beta (5.22.04 - AnyCPU) does not appear to solve the issue. However, I think I have uncovered the root cause, which also might explain why you can't repro the issue.
    In my setup, my main display is the Surface Pro 3's screen. Because it is a high resolution screen (2160 x 1440), the default display settings include magnification to 150% ("Change the size of text, apps, and other items: 150% (Recommended)"). My external monitors are 1920 x 1080 and default to 100%.
    The distance of the grid window from its proper position (when the main LINQPad window is on one of my external monitors) is directly proportional to the magnification setting on my main monitor. If I reduce the magnification of the main screen to 125%, the grid window is still positioned incorrectly, but it is not as far off. If I set the main screen to 100%, the grid shows up where it is supposed to be.

    I hope this is helpful and I do appreciate your willingness to investigate the issue.
  • Thanks - I've now got a repro. It appears to be a bug in Windows 10 - it fails to virtualize the window size/position in certain conditions.

    I've written a workaround into the 5.22.05 beta which works on my setup:

    Let me know how you get along.
  • Initial testing is positive. It seems to have fixed the issue. Thanks!
  • Issue has been fixed on my system as well with latest beta.
    (Different screen sizes, different DPI's, both 100% scaling)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!