Selecting a color from background

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    Selecting a color from background

    Hi all,
    I have a background to my form i want to select that color and apply to my text forecolr.
    Thanx
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Hve you tried for this.

    [CODE=vb]Private Sub Command1_Click( )
    Text1.ForeColor = Me.BackColor
    End Sub[/CODE]

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by Ali Rizwan
      I have a background to my form i want to select that color and apply to my text forecolr.
      I know I ask this all the time, but I can't remember - what version of VB are you using? VB6 and VB.Net handle colours very differently.

      Also, do you just want to pick up the BackColor, or pull out the colour of a pixel in a background picture?

      Comment

      • Ali Rizwan
        Banned
        Contributor
        • Aug 2007
        • 931

        #4
        Originally posted by Killer42
        I know I ask this all the time, but I can't remember - what version of VB are you using? VB6 and VB.Net handle colours very differently.

        Also, do you just want to pick up the BackColor, or pull out the colour of a pixel in a background picture?
        Thanx
        Yeah i want to pick a color of a pixel. Actually my form has a background made on Photoshop and i want to pick the color of that and then set that color to my button or to my textbox.
        Using VB6.
        Thanx

        Comment

        • Ali Rizwan
          Banned
          Contributor
          • Aug 2007
          • 931

          #5
          Originally posted by debasisdas
          Hve you tried for this.

          [CODE=vb]Private Sub Command1_Click( )
          Text1.ForeColor = Me.BackColor
          End Sub[/CODE]
          Thanx.
          I know this command but if i have a wallpaper (JPG) on the background of my form then how can i pick the color of that background?
          Thanx

          Comment

          • Ali Rizwan
            Banned
            Contributor
            • Aug 2007
            • 931

            #6
            Hello all,

            The background on my form is not on the whole form it is just on a side of the form.

            Thanx

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              In VB6, you would have just used the form's .Point() method to pick up the colour at a specified location. But I think this works differently in later versions.

              Comment

              • Ali Rizwan
                Banned
                Contributor
                • Aug 2007
                • 931

                #8
                Originally posted by Killer42
                In VB6, you would have just used the form's .Point() method to pick up the colour at a specified location. But I think this works differently in later versions.
                Thanks
                Killer it'll help me. I'll try it.
                Thanks.
                Last edited by Killer42; Oct 11 '07, 10:00 PM.

                Comment

                Working...