Thread: "Skinning" your application

  1. #1
    #junkie
    Join Date
    Oct 2004
    Posts
    240

    "Skinning" your application

    Well simply put, i want to make my application have a skin that is the same for every computer.

    Even if it is as simple as the standard WinXP skin, i just want something that will be the same.

    Can anyone give me any information on how this can be done so i can research it myself? Thanks!
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  2. #2
    Registered User
    Join Date
    Jan 2004
    Posts
    37
    Are you going to be running this application on only Windows operating systems or are you going to run it on Linux\Unix and Windows targets?

    LT

  3. #3
    #junkie
    Join Date
    Oct 2004
    Posts
    240
    Windows only, sorry for not clarifying
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  4. #4
    Registered User
    Join Date
    Jan 2004
    Posts
    37
    I'm believe that you are going to have to paint the non-client areas of your applicaiton so that it looks how you want it to. You will find that there are no classes or events in the Framework Class Library that allows you to do this. This means that you are going to have to do some P/Invoke (AKA Platform Invocation) Here is a great place to start. If you can't get to where you want from here then just post back.

    http://www.geekswithblogs.net/kobush...rderForms.aspx

    Les

  5. #5
    #junkie
    Join Date
    Oct 2004
    Posts
    240
    i'll give it a shot, though i am quite beginner in this realm, i'll see what happends
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  6. #6
    Registered User
    Join Date
    Jan 2004
    Posts
    37
    All so look into the function SetWindowTheme() in the dll uxtheme.dll. MSDN has the details of this function.

    LT

  7. #7
    Registered User
    Join Date
    Jan 2004
    Posts
    37
    There is an article in September's MSDN magazine on this topic. Read the Spice It Up article by Bill Wagner.

    September MSDN Magazine

    LT

  8. #8
    #junkie
    Join Date
    Oct 2004
    Posts
    240
    thanks for the update
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  9. #9
    #junkie
    Join Date
    Oct 2004
    Posts
    240
    Thats magazine only right? Might have to actually buy a magazine for once in a long time lol
    01110111011000010110110001100100011011110010000001 11000101110101011010010111010000100000011011000110 10010110011001100101001000000111100101101111011101 0100100000011011100111010101100010

  10. #10
    Registered User
    Join Date
    Jan 2004
    Posts
    37
    It isn't that great of an article, so don't buy it just for that article.

    LT

  11. #11
    Registered User
    Join Date
    Nov 2004
    Location
    Slovenia, Europe
    Posts
    115
    15.2 Drawing Shaped Forms and Windows Controls

    Normally, all Windows controls and forms are rectangular, but what if we want to draw them in nonrectangular shapes? We can do this by setting the Region property. The Region property of a form or a control represents that window's region, which is a collection of pixels within a form or control where the operating system permits drawing; no portion of a form that lies outside of the window region is displayed. To draw nonrectangular shapes, we trick the system into drawing only the region of a control.

    Let's draw a circular form. We can use the GraphicsPath class to draw graphics paths. In this application we'll create a circular form and a circular picture box, which will display an image. To test this application, we follow these simple steps:

    We create a Windows application and add a button and a picture box to the form. Then we set the Text property of the button control to "Exit" and write the following line on the button click event handler:

    Code:
    this.Close();
    Next we add a reference to the System.Drawing.Drawing2D namespace so that we can use the GraphicsPath class:

    Code:
    using System.Drawing.Drawing2D;
    On the form-load event handler, we create a Bitmap object from a file and load the bitmap in the picture box as shown in the following code snippet.

    Code:
    Image bmp = Bitmap.FromFile("aphoto.jpg"); pictureBox1.Image = bmp;
    The last step is to set the form and picture box as circular. We can modify the InitializeComponent method and add code as in Listing 15.5 at the end of the method, or we can add the code on the form-load event handler. We just set the Region property of the form and picture box to the region of our GraphicsPath object.

    Listing 15.5 Setting a form and picture box control as circular

    Code:
    private void Form1_Load(object sender, System.EventArgs e) { // Create a rectangle Rectangle rect = new Rectangle(0,0,100,100); // Create a graphics path GraphicsPath path = new GraphicsPath(); // Add an ellipse to the graphics path path.AddEllipse(rect); // Set the Region property of the picture box // by creating a region from the path pictureBox1.Region = new Region(path); rect.Height += 200; rect.Width += 200; path.Reset(); path.AddEllipse(rect); this.Region = new Region(path); // Create an image from a file and // set the picture box's Image property Image bmp = Bitmap.FromFile("aphoto.jpg"); pictureBox1.Image = bmp; }
    When we build and run the application; the output will look like Figure 15.3. Because we have eliminated the normal title bar controls, we must implement an Exit button.
    [C++]
    IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
    2nd compiler: g++ (GCC 3.4.3/4.0.0)
    3rd compiler: Borland 5.5
    [C#]
    IDE: Microsoft Visual C# Express 2005
    2nd IDE: SharpDevelop
    2nd compiler: csc in Command Prompt
    .NET Framework: 2.0
    [PHP]
    Core: 5.1.0 beta 3
    IDE: PHPEdit
    2nd IDE: Notepad
    Favourite extensions: exif,gd2,mysql
    Favourite PEAR packages: DB, XML_RSS, ID3
    Favourite databases: SQLite, MySQL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cleanup of the application...
    By Petike in forum Windows Programming
    Replies: 1
    Last Post: 08-16-2008, 05:23 PM
  2. Problem with com application
    By amardon in forum C++ Programming
    Replies: 3
    Last Post: 10-06-2005, 05:50 AM
  3. MFC run application by clicking on file...
    By dug in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2004, 04:33 AM
  4. Win application not very portable
    By swed in forum Windows Programming
    Replies: 5
    Last Post: 10-01-2001, 11:17 AM