WPF and screen resolution

831 views
Skip to first unread message

Georg Breithaupt

unread,
Apr 13, 2013, 11:25:26 AM4/13/13
to cefs...@googlegroups.com
I changed the DPI on my machine. Which is now 116ppi. So a result, the WPF version is very blurred. Does anyone have an idea if you can avoid or solve.
Thank you!


anthony taranto

unread,
Apr 13, 2013, 12:18:45 PM4/13/13
to cefs...@googlegroups.com
There were some changes in the most recent version that I thought might fix this, but it didn't.



--
You received this message because you are subscribed to the Google Groups "CefSharp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefsharp+u...@googlegroups.com.
To post to this group, send email to cefs...@googlegroups.com.
Visit this group at http://groups.google.com/group/cefsharp?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Georg Breithaupt

unread,
Apr 13, 2013, 12:36:50 PM4/13/13
to cefs...@googlegroups.com
I you the binary version, because i can't compile it with my Visual Studio 2010, maybe thats the reason?

Or if you can give me the location in the source code, I can look and see if I can solve it.

Georg Breithaupt

unread,
Apr 13, 2013, 1:03:09 PM4/13/13
to cefs...@googlegroups.com
Ok is see this change:

 Size WebView::ArrangeOverride(Size size)
    {
        CefRefPtr<CefBrowser> browser;
        if (TryGetCefBrowser(browser))
        {
            Point point = _matrix->Transform(Point(size.Width, size.Height));
            browser->SetSize(PET_VIEW, (int)size.Width, (int)size.Height);
			HidePopup();
        }
        else
        {
            Dispatcher->BeginInvoke(DispatcherPriority::Loaded,
                gcnew ActionHandler(this, &WebView::InvalidateArrange));
        }

        return ContentControl::ArrangeOverride(size);
    }


I thing, you need to convert the size.Width and size.Height from WPF-coodinates to real screen-coodinates?
Anything like this:

Window window = Application.Current.MainWindow;
Matrix m = PresentationSource.FromVisual(window).CompositionTarget.TransformToDevice;
DpiFactorX = 1 / m.M11;
DpiFactorY = 1 / m.M22;



Am Samstag, 13. April 2013 17:25:26 UTC+2 schrieb Georg Breithaupt:

Deyan Varchev

unread,
Apr 15, 2013, 8:02:28 AM4/15/13
to cefs...@googlegroups.com
If the problem you are seeing is blurred text/images and not real size issues/positions , the change you offer is not going to solve it. The way CefSharp for WPF works is by rendering off the screen and putting that into a WPF image control. Most probably, what you experience is caused by the approximation WPF is doing. Can you try resizing the container/Window that you have put the webview in? Does this fix the blur (at least in some cases)? 

As you can see Cef works with int values for size while WPF has doubles there. Thus in some cases web view image size does not match WPF control size and blur appears. 
Here you can read an answer to similar issue - http://stackoverflow.com/questions/5645274/image-in-wpf-getting-blurry
You can try and apply those settings to some containing item that holds the web view.

Hope this helps.

Michael DeRosa

unread,
May 8, 2013, 2:06:11 PM5/8/13
to cefs...@googlegroups.com
Any updates on this? I wanted to update to the latest version of CefSharp, but this has been holding me back. I played around with this a bit per some of the suggestions in here and haven't been able to get anything working. Strange since the "fix" that was included did work for me in an older version of CefSharp (I had built my my own DLLs using that fix with the latest changes in mid Feb). 

As mentioned by Deyan Varchev , changing the size of the window will make content appear less blurry but it's never as clear as it should be.

Trond Andersen

unread,
Sep 10, 2013, 6:44:01 AM9/10/13
to cefs...@googlegroups.com
kl. 20:06:11 UTC+2 onsdag 8. mai 2013 skrev Michael DeRosa følgende:
Any updates on this? I wanted to update to the latest version of CefSharp, but this has been holding me back. I played around with this a bit per some of the suggestions in here and haven't been able to get anything working. Strange since the "fix" that was included did work for me in an older version of CefSharp (I had built my my own DLLs using that fix with the latest changes in mid Feb). 

As mentioned by Deyan Varchev , changing the size of the window will make content appear less blurry but it's never as clear as it should be.

Any news regarding this. The WPF component is unusable for us in the current form since we get this blurry problem. I can use the forms component, but then I do not have to possibility to use opacity which is currently an requirement.

-- 
Trond

Per Lundberg

unread,
Sep 10, 2013, 3:21:34 PM9/10/13
to cefs...@googlegroups.com
God afton Trond,

Please make an issue on GitHub about this. For me, it has never been an issue because in my use case people are using standard DPI settings (100% I presume).
It shouldn't be so hard to fix, I hope. If you like - feel free to investigate it & make a pull request. It's approximately this line that should get fixed:


As you see there, we are already setting the BitmapScalingMode but it could be worthwhile to experiment a bit with the other flags also.

Best regards,
Per

Trond Andersen

unread,
Sep 11, 2013, 3:54:30 AM9/11/13
to cefs...@googlegroups.com
Hello Per.

Thank you for your response.

I've created issue 166. As of now I have tried the suggestion which is included in this thread, but it hasn't worked for me.

I can absolutely try out different adjustment to the code if needed, but when the suggestion didn't work for me, I'm not sure how to proceed with this issue since my WPF skills are limited.

-- 
Trond
Reply all
Reply to author
Forward
0 new messages