Slow program running and mouse movement when WPF is in full screen mode

Source: Internet
Author: User
<Window X: class = "wpfapp. window1"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Windowstate = "maximized"
Topmost = "true"
Windowstyle = "NONE"
Allowstransparency = "true"
Title = "window1" Height = "300" width = "300">
<Grid>

</GRID>
</WINDOW>

 

Start the animation. The program runs slowly and the mouse moves slowly.

 

 

Solution:

In the window attribute of XAML, windowstyle retains its default value,

The Win32 API function is directly used in the window loading response function to modify the style of the window.

 

This is a temporary solution found on the Internet.

<Window X: class = "wpfapp. window1"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Windowstate = "maximized"
Topmost = "true"
Loaded = "onmainload"

Title = "window1" Height = "300" width = "300">
<Grid>

</GRID>
</WINDOW> Private void onmainload (Object sender, routedeventargs E)

{

Int nstyle = WIN32API. getwindowlong (New windowinterophelper (this). Handle;, WIN32API. gwl_style );

Nstyle & = ~ WIN32API. ws_caption;

WIN32API. setwindowlong (New windowinterophelper (this). Handle;, WIN32API. gwl_style, nstyle );

}

 

Public class WIN32API

{

[Dllimport ("user32.dll")]

Public static extern int setwindowlong (intptr hwnd, int nindex, int new );

[Dllimport ("user32.dll")]

Public static extern int getwindowlong (intptr hwnd, int nindex );

}

 

Public const int gwl_style =-16;

Public const int gwl_exstyle =-20;

Public const int ws_caption = 0x00c00000;


 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.