messagebox 这样的操作

(
  -- setup dotnet classes / objects
  local mb = dotNetClass "System.Windows.Forms.MessageBox"
  local buttons = dotNetClass "System.Windows.Forms.MessageBoxButtons"
  local icons = dotNetClass "System.Windows.Forms.MessageBoxIcon"
  local defaultButton = dotNetClass "System.Windows.Forms.MessageBoxDefaultButton"
  local dialogResult = dotNetClass "System.Windows.Forms.DialogResult"
  
  local result = mb.show "Do you want to save before quitting ?" "Quit" buttons.YesNoCancel icons.Information defaultButton.Button3
  
  -- evaluate result of messageBox (which button has been pressed by the user)
  if ( result == dialogResult.Yes ) then
  (
   format "YES\n"
  )
  else if ( result == dialogResult.No ) then
  (
   format "NO\n"
  )
  else if ( result == dialogResult.Cancel ) then
  (
   format "CANCEL\n"
  )
  
 )

posted on 2011-10-08 19:08  盖天00  阅读(194)  评论(0编辑  收藏  举报

导航