我想在表单上显示RadDesktopAlert(不在桌面上)。因此我使用第二个构造函数将其容器设置为form。但为此提出了nullException。容器
我是否在表格中显示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();
}
答案 0 :(得分:2)
为此,您需要将ScreenPosition设置为Manual,然后设置弹出位置
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();