2012-05-16 86 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();