2012-05-16 117 views
2

我想在窗體上顯示RadDesktopAlert(不在桌面上)。因此我使用第二個構造函數來設置它的容器來形成。但爲此提出nullException。容器
我在正確的行顯示RadDesktopAlert的形式(最好說在表格中)?
和爲什麼容器爲空?
這裏是我的代碼在窗體上顯示RadDesktopAlert

 private void Form1_Load(object sender, EventArgs e) 
     { 
     Telerik.WinControls.UI.RadDesktopAlert q = new Telerik.WinControls.UI.RadDesktopAlert(this.Container);//null exception: Container is null 
     q.ScreenPosition = Telerik.WinControls.UI.AlertScreenPosition.BottomCenter; 
     q.ContentText = "what ever"; 
     q.Show(); 
     } 

回答

2

要做到這一點,你需要的ScreenPosition設置爲手動,然後設置彈出位置

 Telerik.WinControls.UI.RadDesktopAlert q = new Telerik.WinControls.UI.RadDesktopAlert();//null exception: Container is null 
     q.ScreenPosition = Telerik.WinControls.UI.AlertScreenPosition.Manual; 
     q.Popup.Location = new Point(this.Location.X + 20, this.Location.Y + 20); 
     q.ContentText = "what ever"; 
     q.Show();