Parent Window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DaveL

    Parent Window

    i Want to set Color Back ground for a
    Application Mdi Window (parent)

    i set the form.IsMdiConta iner=true;

    and i can't Change colors of the main window
    is there a way to do this

    Thanks
    Dave


  • DaveL

    #2
    Re: Parent Window

    Nevermind got it working
    thanks below code to color and draw center text
    and footer text

    private void ShellWindow_Pai nt(object sender, PaintEventArgs e)
    {

    MdiClient oWin = null;
    // get the midi frame control
    for (int tt = 0; tt < this.Controls.C ount; tt++)
    {
    if (this.Controls[tt] is MdiClient)
    {
    oWin = (MdiClient)this .Controls[tt];
    // break;
    }

    }


    Graphics oGraphics = oWin.CreateGrap hics();

    oWin.BackColor = System.Drawing. Color.Blue ; //.RoyalBlue;
    //.FromArgb(35,7, 143); //.Brushes.AliceB lue;
    oWin.Refresh();
    // Create string to draw.
    //e.MeasureString (drawString, this.Font);
    // Create font and brush.
    Font oFont = new System.Drawing. Font("Arial Wide", 30,
    FontStyle.Bold | FontStyle.Itali c);
    System.Drawing. SizeF TxtSize = oGraphics.Measu reString(Header ,
    oFont);
    SolidBrush GreyBrush = new
    SolidBrush(Syst em.Drawing.Colo r.Black);
    SolidBrush BlackBrush = new
    SolidBrush(Syst em.Drawing.Colo r.White);
    // Create point for upper-left corner of drawing.
    //x=widht
    //y=height

    float x = (this.ClientSiz e.Width / 2) - (TxtSize.Width / 2);
    float y = (this.ClientSiz e.Height / 2) - (TxtSize.Height / 2);
    // Set format of string.
    StringFormat drawFormat = new StringFormat();
    drawFormat.Form atFlags =
    StringFormatFla gs.MeasureTrail ingSpaces;
    //draw Shadow
    oGraphics.DrawS tring(Header, oFont, GreyBrush, x + 3, y + 3,
    drawFormat);
    // Draw string to screen.

    oGraphics.DrawS tring(Header, oFont, BlackBrush, x, y,
    drawFormat);
    //draw Owner Notice bottom Right

    oFont = new Font("Arial Wide", 10, FontStyle.Bold |
    FontStyle.Under line); // FontStyle.Under line);


    TxtSize = oGraphics.Measu reString(Footer , oFont);
    oGraphics.DrawS tring(Footer, oFont, BlackBrush,
    oWin.ClientSize .Width - TxtSize.Width,
    oWin.ClientSize .Height
    - TxtSize.Height, drawFormat);
    }


    private void Form1_Resize(ob ject sender, EventArgs e)
    {
    //force a Repaint for color and Text to be re aligned
    this.Invalidate ();
    }




    "DaveL" <dvs_bis@sbcglo bal.netwrote in message
    news:Z1VAk.510$ hc1.177@flpi150 .ffdc.sbc.com.. .
    >i Want to set Color Back ground for a
    Application Mdi Window (parent)
    >
    i set the form.IsMdiConta iner=true;
    >
    and i can't Change colors of the main window
    is there a way to do this
    >
    Thanks
    Dave
    >
    >

    Comment

    Working...