2012-05-09 22 views

Trả lời

9

Bạn đang tìm NSAlert, phần lớn tương đương với MessageBox.

Bạn có thể hiển thị NSAlert bằng cách sử dụng NSAlert.RunModal() hoặc sử dụng NSAlert.BeginSheet() nếu bạn muốn nó hiển thị dưới dạng trang tính trên một cửa sổ cụ thể.

ví dụ:

var alert = new NSAlert { 
    MessageText = "Hello, this is an alert!", 
    AlertStyle = NSAlertStyle.Informational 
}; 

alert.AddButton ("OK"); 
alert.AddButton ("Cancel"); 

var returnValue = alert.RunModal(); 
// returnValue will be 1000 for OK, 1001 for Cancel 

Bạn có thể có một cái nhìn như thế nào để sử dụng nó nhiều hơn một chút từ góc độ MonoMac đây:

https://github.com/picoe/Eto/blob/master/Source/Eto.Platform.Mac/Forms/MessageBoxHandler.cs

Các vấn đề liên quan