specifying look and feel of controls - c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    specifying look and feel of controls - c#

    I'm pretty sure this is an easy question, I just can't figure out how to set the look and feel of my controls, so I am getting the default, and I want my controls to match on different platforms. I tried setting borderthickness for 30 minutes only to realize that it works on some look-and-feel, but not others (see attachments).
    Attached Files
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Do you have the EnableVisualSty lesthing turned on (and if so, maybe you want it off?)
    I would imagine something to do with these two settings could have an effect?
    Application.Ena bleVisualStyles ();
    Application.Set CompatibleTextR enderingDefault (false);
    Last edited by Plater; Oct 16 '08, 08:11 PM. Reason: corrected vistualthemes to visualstyles

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      I couldn't find enablevisualthe mes - not sure where to look. I worked around by specifying the look of the buttons, but then I lose all the mouseover and click looks unless I do a lot of extra work.

      Jared

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Did you use ownerDraw?

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          Originally posted by Plater
          Did you use ownerDraw?
          no, it's actually xaml, and I'm never sure which things cross-over easily between WPF and traditional C#, but I'm sure I didn't use ownerDraw.

          Jared

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            How about using images? Skin it?

            Comment

            • jhardman
              Recognized Expert Specialist
              • Jan 2007
              • 3405

              #7
              I guess I could. I don't have any big objections, but shouldn't it be easier to just specify which look-and-feel to use? I can do that in Java with no problem, and I'm no Java expert.

              Jared

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #8
                Originally posted by jhardman
                I couldn't find enablevisualthe mes - not sure where to look. I worked around by specifying the look of the buttons, but then I lose all the mouseover and click looks unless I do a lot of extra work.

                Jared
                Sorry Jared ,but I'm not very familiar with WPF (yet).


                Just for your information, EnableVisualSty les is part of the Application Class.
                You need to set it before the application is loaded....so you want to do it as one of the first lines executed in your application

                Eg
                [code=cpp]
                [STAThread]
                static void Main()
                {
                Application.Ena bleVisualStyles ();
                /*............*/
                }[/code]

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  Jhardman, did you ever solve your problems?

                  I have been using XAML and since I don't have Blend, I have been doing my styles by hand. If you still need help figuring out skinning/styling I might be of assistance now that I have a little more experience with it.

                  I am trying to figure out a few things of my own regarding styles (how do you change the colour etc without losing depth of controls...ever ything is "flat" now. And I'm wondering how to set the height and width of elements to a percentage of the window size!)

                  -Frinny

                  Comment

                  • ThatThatGuy
                    Recognized Expert Contributor
                    • Jul 2009
                    • 453

                    #10
                    It happens. The a usual WPF button will look different in different platforms of Windows.
                    Like it will look 3D in themed XP.. and it will look Aero in Windows 7.
                    So the best option available is to always define a custom template for the control you're using.
                    You need to use <Control.Templa te>, In this you need to define the way the button needs to be painted.

                    Comment

                    Working...