c# 桌面端開發新手一枚
用 winform 做了一個模擬鎖屏程式,啟動時是一個將桌面完全遮罩的全屏視窗,視窗上有一個密碼輸入框,當輸入正確的密碼后,我會將此視窗最小化,這時用戶可以正常操作桌面,一段時間后,我會重新最大化視窗將桌面遮罩(模擬鎖屏的效果)。以上在 win7下都能正常運行符合預期,但是在 win10 下當重新最大化視窗時視窗所設定的背景圖(或者背景色)就會有大片地沒有渲染出來,無論我將背景設定成一個純背景圖還是純色都不行。
各位前輩幫忙看看錯誤在哪里?
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(153)))), ((int)(((byte)(204)))));
this.BackgroundImage = global::ScreenManage.Properties.Resources._LockBgImage;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(924, 788);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(1, 1);
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
uj5u.com熱心網友回復:
試試更新顯卡驅動程式。一般來說不同作業系統環境下的顯示例外,大多與顯卡驅動有關。uj5u.com熱心網友回復:
你試試,不要寫最小化,最大化。把代碼改成,顯示,隱藏。
this.Hide();
this.Show();
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/244494.html
標籤:C#
