Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Chnage backgrounf color of a form

Chnage backgrounf color of a form

Scheduled Pinned Locked Moved C#
csharphelp
12 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V VC_RYK

    Hi All I am very new to C#,and i have to set background color of my form, i am trying to do like Assembly myAssembly = Assembly.GetExecutingAssembly(); Stream testImage= myAssembly.GetManifestResourceStream("Test.jpg"); but here it crashing. can anybody help me out thanks in advance RYK

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #3

    ?? I don't know what you want, but if you want to change background color of a form, just do like this: MyForm myForm = new MyForm(); // Here is your form myForm.BackColor = System.Drawing.Color.Red; // Change the background color to red.

    V 1 Reply Last reply
    0
    • L Lost User

      ?? I don't know what you want, but if you want to change background color of a form, just do like this: MyForm myForm = new MyForm(); // Here is your form myForm.BackColor = System.Drawing.Color.Red; // Change the background color to red.

      V Offline
      V Offline
      VC_RYK
      wrote on last edited by
      #4

      No No, i want to set a image file

      P 1 Reply Last reply
      0
      • V VC_RYK

        No No, i want to set a image file

        P Offline
        P Offline
        pampam110
        wrote on last edited by
        #5

        Use BackGroundImage Property of ur form!(Singl-Click on ur form, then press F4. and use BackGroundImage Property to set an image. :)

        []D @ []v[] []D @ []v[]

        V 2 Replies Last reply
        0
        • P pampam110

          Use BackGroundImage Property of ur form!(Singl-Click on ur form, then press F4. and use BackGroundImage Property to set an image. :)

          []D @ []v[] []D @ []v[]

          V Offline
          V Offline
          VC_RYK
          wrote on last edited by
          #6

          There is no any option bcakgroungimage that is what i was asking

          P P OriginalGriffO 3 Replies Last reply
          0
          • P pampam110

            Use BackGroundImage Property of ur form!(Singl-Click on ur form, then press F4. and use BackGroundImage Property to set an image. :)

            []D @ []v[] []D @ []v[]

            V Offline
            V Offline
            VC_RYK
            wrote on last edited by
            #7

            and i am using VS 2005

            L 1 Reply Last reply
            0
            • V VC_RYK

              There is no any option bcakgroungimage that is what i was asking

              P Offline
              P Offline
              padmanabhan N
              wrote on last edited by
              #8

              no MR.VC_RYK there is a property just arrange the properties in alpahbetical order and just below BackColor the BackgroundImage will be found........search and use it....

              Padmanabhan

              modified on Friday, May 29, 2009 4:25 AM

              1 Reply Last reply
              0
              • V VC_RYK

                There is no any option bcakgroungimage that is what i was asking

                P Offline
                P Offline
                pampam110
                wrote on last edited by
                #9

                it is impossible...! i check it right now...when u select ur form, from the form properties(F4), Click on BackgroundImage, then use Import... and select ur image with ( *.gif, *.jpg, *.jpeg, *.bmp, *.wmf, *.png ) suffixes. I hope u see it! :thumbsup:

                []D @ []v[] []D @ []v[]

                1 Reply Last reply
                0
                • V VC_RYK

                  There is no any option bcakgroungimage that is what i was asking

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #10

                  The BackgroundImage property has been a part of every control since .NET 1.0, so I am sure it exists in yours! Are you sure you have a form, not a console application? Can you open the designer view on it? If so, then check the properties are listed A-Z and that you aren't viewing the events. If really desparate, try using intellisense and check it programatically:

                  frmMine fm = new frmMine();
                  fm.BackgroundImage = @"C:\Pic.jpg";

                  If this comes up with errors, then paste your code here, with the error message.

                  No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  1 Reply Last reply
                  0
                  • V VC_RYK

                    and i am using VS 2005

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #11

                    I'm using VS2008 and it's working just fine...

                    1 Reply Last reply
                    0
                    • V VC_RYK

                      Hi All I am very new to C#,and i have to set background color of my form, i am trying to do like Assembly myAssembly = Assembly.GetExecutingAssembly(); Stream testImage= myAssembly.GetManifestResourceStream("Test.jpg"); but here it crashing. can anybody help me out thanks in advance RYK

                      A Offline
                      A Offline
                      AhsanS
                      wrote on last edited by
                      #12

                      For Setting the background image of your form YourFormNAme.BackGroundImage = YOUR-Application-NameSpace.Properties.Resources.YOUR-Resource-Name;

                      Ahsan Ullah Senior Software Engineer MCTS 2.0

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups