请问如何改变用MessageBox产生的提示框的背景颜色啊???急、急、急

解决方案 »

  1.   

    最简单的办法是自己实现一个类似messagebox的窗体,因为MessageBox是API函数,所以要改那个窗体的背景色就比较麻烦,不如自己实现一个messagebox窗体来的简单
      

  2.   

    function MyMessageDialog(const Msg: string; DlgType: TMsgDlgType; 
      Buttons: TMsgDlgButtons; Captions: array of string): Integer; 
    var 
      aMsgDlg: TForm; 
      i: Integer; 
      dlgButton: TButton; 
      CaptionIndex: Integer; 
    begin 
      { Create the Dialog } 
      { Dialog erzeugen } 
      aMsgDlg := CreateMessageDialog(Msg, DlgType, Buttons); 
      captionIndex := 0; 
      { Loop through Objects in Dialog } 
      { Über alle Objekte auf dem Dialog iterieren} 
      for i := 0 to aMsgDlg.ComponentCount - 1 do 
      begin 
       { If the object is of type TButton, then } 
       { Wenn es ein Button ist, dann...} 
        if (aMsgDlg.Components[i] is TButton) then 
        begin 
          dlgButton := TButton(aMsgDlg.Components[i]); 
          if CaptionIndex > High(Captions) then Break; 
          { Give a new caption from our Captions array} 
          { Schreibe Beschriftung entsprechend Captions array} 
          dlgButton.Caption := Captions[CaptionIndex]; 
          Inc(CaptionIndex); 
        end; 
      end; 
      Result := aMsgDlg.ShowModal; 
    end; procedure TForm1.Button1Click(Sender: TObject); 
    begin 
      if MyMessageDialog('How much...?', mtConfirmation, mbOKCancel, 
        ['1', '2']) = mrOk then 
        ShowMessage('"1" clicked') 
      else 
        ShowMessage('"2" clicked'); 
    end; 
      

  3.   

    加一句﹕  aMsgDlg.Color :=clRed;
      

  4.   

    可以直接写个公用的form处理这些消息.