Solved

coloring the message dialog..

Posted on 2000-04-21
6
160 Views
Last Modified: 2010-04-04
Is there a way to display a message dialog with customised colours.?
I am using the "messagedlg()" command.
0
Comment
Question by:tanm
6 Comments
 
LVL 2

Expert Comment

by:rene100
ID: 2737884
Hi

I think this isn't possible, because MessageDlg() uses a windows-api-function to display the messagebox....
The colors of the msgbox are determined by the system settings, so you could change these settings..


regards
rene
0
 

Accepted Solution

by:
d32coder earned 10 total points
ID: 2738182
No, but you can create a new Form that emulates the messagebox.  That way you can customize it completely.

This is not considered good code but it will give you more options.
0
 

Expert Comment

by:PascalCP
ID: 2738306
Hi,

It is not possible without creating your own form ! Because windows is calling an API .
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Expert Comment

by:SuperSy
ID: 2739213
Not necessarily ... I think you can override the CreateMessageDialog() for that ...

Let me check.
0
 

Expert Comment

by:SuperSy
ID: 2739235
Ok ... my answer is "Yes", according to the question.  The question simply says "Is there a way...?" and yes, there is.  Not with MessageDlg(), but there sure is.  And except for the color, the dialog looks exactly like the one with MessageDlg().

If you are willing to change all the MessageDlg() commands in your app to, say, MyMessageDlg(), you can change the background of your boxes to a different color.  

Of course, you have to write your own MyMessageDlg like this:

function MyMessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons) do
  begin
    try // ..finally
      HelpContext := HelpCtx;
      // Let's try red
      Color := $000000FF;
      Result := ShowModal;
    finally
      free;
    end; // try
  end;
end;

If you try, you can see that only the background is red; the buttons are still grey.  

Now that I think of it, what I did is exactly what d32coder said... I have created a new Form that emulates the messagebox, with a coloring twist.  I just created the form using code supplied by Delphi.

I personally will consider this good enough code.  ^_^

By the way, if you want to change the button colors as well, do post a comment here.  
0
 

Author Comment

by:tanm
ID: 2739515
Brilliant! That's is precisely what i need..
Thanks very much..
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Copy file in dll not working but working on exe ! 18 93
Delphi XE10, MySQL Query 4 143
How to build JSON File in Delphi 6 3 34
MS Access from Delphi 31 29
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question