How to set the background color of an MDI Form

Posted by Peter van Dam on 14-Feb-2013 04:03

When you create a new ABL MDI Form you get a form where the area for the MDI children has a dark gray background.

How can you changes this color? Setting the Form BackColor does not work.


Using a BackgroundImage *does* work, but what I would like to do is set a background color in addition to a centered image for the company logo.

I cannot find anything on the internet or in the documentation about this. What am I missing?

All Replies

Posted by jquerijero on 18-Feb-2013 14:18

The MDI Parent has a MDIClient control that displays the gray background. You can loop through the MDI Parent's control collection and check if the control type is MDIClient then assign it a new background color.

Posted by bart.syryn on 24-Feb-2016 08:08

Hi Peter,

I hope i may ask a question about your thread 'how to set the background color of an MDI Form'.

I also would like to accomplish this, and the reply you've got was 'loop through the MDI Parent's control collection'. However I'm trying to do this, but I didn't succeeded.

Were you able to accomplish this ? Are you willing to share an example piece of code ?

Kind regards

Bart

Posted by Mike Fechner on 24-Feb-2016 12:45

Here's code that we use to add a watersign image to the Mdi client area - changing the background color should be very similar. We run this code in the MDI container forms OnLoad method override - after the SUPER:OnLoad (e).

    		DO i = 0 TO THIS-OBJECT:Controls:Count - 1:
    
    		    IF TYPE-OF (THIS-OBJECT:Controls[i], System.Windows.Forms.MdiClient) THEN DO:
    		      
    		        CAST (THIS-OBJECT:Controls[i], System.Windows.Forms.MdiClient):BackgroundImage 
    		              = System.Drawing.Bitmap:FromFile (cFileName) . 
    		        
    		        LEAVE . 
    		    END.
    		END.

Posted by bart.syryn on 25-Feb-2016 02:29

Hi Mike,

Thanks ! That did the trick !

Kind regards

Bart

This thread is closed