Control in non-client area of form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peepoohead7
    New Member
    • Dec 2008
    • 9

    Control in non-client area of form

    How do I put a control on the non-client area of a form?

    Can a component be painted onto the non-client area? (Bounds)
    Last edited by Frinavale; Dec 30 '08, 08:01 PM. Reason: Moved to C# forum
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Originally posted by peepoohead7
    How do I put a control on the non-client area of a form?
    Google is your friend:

    This looks like what I think you are wanting.

    Comment

    • peepoohead7
      New Member
      • Dec 2008
      • 9

      #3
      How did Microsoft / DevExpress / CodeJock do the application button and QAT?

      They put it onto the non-client area of the form, and nothing looks wrong different with microsoft office (word, excel, powerpoint) or the codejock sample I got. So how did they put the control onto the non-client area of the form?

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        Was the answer to your question first time you asked not what you were looking for?

        You really should keep to one thread per question.

        Comment

        • peepoohead7
          New Member
          • Dec 2008
          • 9

          #5
          It works, but when I put text box onto the control and type into it, anything's thats colored black will become transparent. And maximizing / restoring the window messes it up (although I'll try to solve that). So how do I not let the black color on the controls turn transparent?

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            Originally posted by peepoohead7
            It works, but when I put text box onto the control and type into it, anything's thats colored black will become transparent. And maximizing / restoring the window messes it up (although I'll try to solve that). So how do I not let the black color on the controls turn transparent?

            Set the text color to something other than black?

            Use the resize (SizeChanged, SizeChangedComp lete, etc) events to relocate the text box.

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              MERGED.
              Please don't double post.
              MODERATOR


              You want a textbox in the title bar? Interesting.
              I would have just turned off the border/titlebar and made my own at that point i think.
              Is there a picture/screenshot of what you are trying to do, that link only showed a colored titlebar,which i have also never seen really.

              Comment

              • peepoohead7
                New Member
                • Dec 2008
                • 9

                #8
                Here are some examples of what I'm trying to do:

                This

                and This.

                Only Windows Vista can paint those windows, but somehow they got the orb and the toolbar onto the title bar. Tlhintoq, your link was what I was looking for, except for the problem I described previously. I'll do some more searching.

                Comment

                • Plater
                  Recognized Expert Expert
                  • Apr 2007
                  • 7872

                  #9
                  Oh so its a vista thing, no wonder i had never seen it

                  Comment

                  • peepoohead7
                    New Member
                    • Dec 2008
                    • 9

                    #10
                    I read in this article that:

                    Office completely removes the non-client area, and renders everything in its client area, so it doesn't have a caption (except a fake one).

                    Notice how the glow and the text are different, it's because they're not rendered by the DWM.
                    I compared the pixels on the top left corner of Word and a program (same location, same size, same background) and it was a bit different.

                    If I set the text to a different color the text will still appear transparent :(

                    Comment

                    • peepoohead7
                      New Member
                      • Dec 2008
                      • 9

                      #11
                      I got it! Using the link you gave me, I overrid the WndProc property like this:

                      Code:
                      protected override void WndProc(ref Message m)
                              {
                                  if (m.Msg == 0x83)
                                  {
                                      Point point = new Point(m.LParam.ToInt32());
                                      m.Result = new IntPtr(-1);
                                      return;
                                  }
                      
                                  Graphics g = Graphics.FromHwnd(Handle);
                                  g.DrawString("String",
                                      new Font("Lucida Console", 10f),
                                      new SolidBrush(Color.Black),
                                      PointF.Empty);
                      
                                  base.WndProc(ref m);
                              }
                      Now all I have to do is to remake the buttons and resizing.
                      Thanks for your help. :)

                      Comment

                      Working...