wpf2018. 8. 31. 12:53
public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
 
        protected override void OnSourceInitialized(EventArgs e)
        {
            IconHelper.RemoveIcon(this);
        }
    }



public static class IconHelper
    {
        [DllImport("user32.dll")]
        static extern int GetWindowLong(IntPtr hwnd, int index);
 
        [DllImport("user32.dll")]
        static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
 
        [DllImport("user32.dll")]
        static extern bool SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, 
                   int x, int y, int width, int height, uint flags);
 
        [DllImport("user32.dll")]
        static extern IntPtr SendMessage(IntPtr hwnd, uint msg, 
                   IntPtr wParam, IntPtr lParam);
 
        const int GWL_EXSTYLE = -20;
        const int WS_EX_DLGMODALFRAME = 0x0001;
        const int SWP_NOSIZE = 0x0001;
        const int SWP_NOMOVE = 0x0002;
        const int SWP_NOZORDER = 0x0004;
        const int SWP_FRAMECHANGED = 0x0020;
        const uint WM_SETICON = 0x0080;
 
        public static void RemoveIcon(Window window)
        {
            // Get this window's handle
            IntPtr hwnd = new WindowInteropHelper(window).Handle;
 
            // Change the extended window style to not show a window icon
            int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
            SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);
 
            // Update the window's non-client area to reflect the changes
            SetWindowPos(hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | 
                  SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
        }
 
    }


Posted by 동동(이재동)
wpf2018. 8. 29. 17:25

app.xaml.cs 에서 onStartup에서 


RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;


렌더모드를 소프트웨어 온리로 바꿨더니


Mediaelement 의 4k GPU 사용량이 100에서 많이 줄어들었다.


DID같은경우는 너무 GPU가 높으니 하드웨어 렌더링보다는 소프트웨어 렌더링을 이용해야겠다.



참고 : https://blogs.msdn.microsoft.com/jgoldb/2010/06/22/software-rendering-usage-in-wpf/



Posted by 동동(이재동)
wpf2018. 8. 7. 12:23
<Viewbox StretchDirection="DownOnly" >
     <Label Content="Enable" FontSize="10" FontStretch="Normal" />
</Viewbox>


Posted by 동동(이재동)