CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Join Date
    Oct 2012
    Posts
    59

    PictureBox settings.

    I need this: see in the picture.

    Name:  2k.jpg
Views: 2012
Size:  82.8 KB

    Please help me....

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: PictureBox settings.

    Ok, since you don't show any code all I can say is 'why don't you draw that...'
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Oct 2012
    Posts
    59

    Re: PictureBox settings.

    Quote Originally Posted by S_M_A View Post
    Ok, since you don't show any code all I can say is 'why don't you draw that...'
    You see in vb 2010 i upload png picture and change design time control manualy. It no has any code. Its easy and fast. But in Vb6 if i upload png picture white area still show because that area is pictureBox. I Vb6design time is no manualy change pictureBox settings just like in Vb2010. So in order to manage do what i want to do in vb6 i need write code witch can make pictureBox white area transparent o disapear. I dont know how that code must be writen.

  4. #4
    Join Date
    Oct 2012
    Posts
    59

    Re: PictureBox settings.

    Name:  Untitled.jpg
Views: 1968
Size:  80.9 KB

    In this picture you see program with pictureBox witch is one of zodiac sings. Now i need add 12 zodiac sings and make that every sing show from curent answer.

    My programs code is this:

    Code:
    If strAux >= "0321" And strAux <= "0420" Then
     SDate.Caption = "Avinas"
     psavt.Caption = "Įkvėpimas ir Drąsa"
     psavn.Caption = "Impulsyvumas ir Nedisciplinuotumas"
     kri.Caption = "Kantrybės"
     trm.Caption = "Greit užsidega, greit perdega"
     Tal.Caption = "Impulsas, Veiksmas, Energija"
     Apie.Caption = " Apie tuos, kuriuos valdo impulsas"
     tp.Caption = "Liūtas, Avinas, Jautis, Šaulys, Vandenis, Žuvys"
     sns.Caption = "Vėžiu, Svarstyklėmis ir Ožiaragiu"
     jr.Caption = "Nepriklausomybė"
     dev.Caption = "Aš esu"
     tll.Caption = "Plaktukas"
    end if
    I try add 12 picturebox with different names and make picBox visible = false.
    Then i write this code:
    Code:
    If strAux >= "0321" And strAux <= "0420" Then
     SDate.Caption = "Aries"
     picBox1.visible = true (aries picture)
     end if
    And it work. When answer was "Avinas" then picBox show aries sing. And that i do with 12 zodiac sings. But now i came with problems:
    1. Third zodiac sing not apears.
    2. When first zodiac sings apear lets say "Aries" second time apear "Taurus" but when need show zodiac from "Taurus" sign to "Aries" it not work. Then i try write this code:

    Code:
    If strAux >= "0321" And strAux <= "0420" Then
     SDate.Caption = "Aries"
     picBox1.visible = true (aries)
     picBox2.visible = false (taurus)
    end if
    
    If strAux >= "0421" And strAux <= "0521" Then
    SDate.Caption = "Taurus"
     picBox1.visible = false (aries)
     picBox2.visible = true (taurus)
    It work with only two picture. When i try in the same way add another zodiac in not apears. So can you know problem? I think it is code writen not corecly.
    Last edited by Halosar7; October 14th, 2012 at 08:10 AM.

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: PictureBox settings.

    picBox1.visible = true (aries)

    what I have highlighted in red should either not be there or should have a comment character in front of it. As is it is not valid code
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Oct 2012
    Posts
    59

    Re: PictureBox settings.

    Quote Originally Posted by DataMiser View Post
    picBox1.visible = true (aries)

    what I have highlighted in red should either not be there or should have a comment character in front of it. As is it is not valid code
    I know that. In this code i put sample with name like (aries) so you can better understand witch code is wat. In program code is this.

    Code:
    If strAux >= "0321" And strAux <= "0420" Then
     SDate.Caption = "Aries"
     picBox1.visible = true 
     picBox2.visible = false 
    end if
    
    If strAux >= "0421" And strAux <= "0521" Then
    SDate.Caption = "Taurus"
     picBox1.visible = false 
     picBox2.visible = true
    You see picturebox1 is "aries", picturebox2 is "taurus" so in code end i writen wat is wat because when you see in picturebox1 you dont understand what purpose that code must be.

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: PictureBox settings.

    Wrong way to compare STRING FIELDS. Use a Function() and convert IF POSSIBLE.
    Code:
    strAux >= "0321"
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: PictureBox settings.

    Quote Originally Posted by Halosar7 View Post
    I know that. In this code i put sample with name like (aries) so you can better understand witch code is wat. In program code is this.
    If you want to add comments to your code you should use the comment character so we know it is a comment otherwise we can not know that and as written the code would not have worked which is why I pointed it out.

    where is strAux being assigned a value? Why are you using strings to compare a numeric value?
    Always use [code][/code] tags when posting code.

  9. #9
    Join Date
    Oct 2012
    Posts
    59

    Re: PictureBox settings.

    Quote Originally Posted by DataMiser View Post
    where is strAux being assigned a value? Why are you using strings to compare a numeric value?
    "Why are you using strings to compare a numeric value" - i using this because it is astrology program witch show info by date of birth. In picture you see 8 square, then must be writen numbers.

    "where is strAux being assigned a value" - strAux being assigned to this value:

    Code:
    If IsNumeric(Text1.Text) And _
           IsNumeric(Text2.Text) And _
           IsNumeric(Text3.Text) And _
           IsNumeric(Text4.Text) And _
           IsNumeric(Text5.Text) And _
           IsNumeric(Text6.Text) And _
           IsNumeric(Text7.Text) And _
           IsNumeric(Text8.Text) Then
            If Val(Text1.Text) <> 1 And Val(Text1.Text) <> 2 Then
                MsgBox "Metai turi prasidėti skaičiuomi 1 ar 2", vbInformation, "Dėmesio!"
            Exit Sub
        End If
            If Val(Text5.Text & Text6.Text) < 1 Or _
           Val(Text5.Text & Text6.Text) > 12 Then
            MsgBox "Mėnesiai turi būti tarp 01 ir 12", vbInformation, "Dėmesio!"
            Exit Sub
        End If
            If Val(Text7.Text & Text8.Text) < 1 Or _
           Val(Text7.Text & Text8.Text) > 31 Then
            MsgBox "Dienos turi būti tarp 01 ir 31", vbInformation, "Dėmesio!"
            Exit Sub
        End If
            intTotal1 = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) + Val(Text8.Text)
            strTotal1 = Format(intTotal1, "00")
            intTotal2 = Val(Left(strTotal1, 1)) + Val(Right(strTotal1, 1))
            If intTotal2 > 9 Then
                strTotal2 = Format(intTotal2, "00")
                intTotal2 = Val(Left(strTotal2, 1)) + Val(Right(strTotal2, 1))
        End If
            Label1.Caption = Format(intTotal2)
           Dim strAux As String
    strAux = Text5.Text & Text6.Text & Text7.Text & Text8.Text
    If strAux >= "0321" And strAux <= "0420" Then
    Last edited by Halosar7; October 14th, 2012 at 12:45 PM.

  10. #10
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: PictureBox settings.

    I still have no clue why you would use strings when the values are numeric but that is beside the point what you are really looking for is a way to do a transparent image with a picture box. This is something I have not tryied to do. I know by default it is not supported but there are ways it can be done. Rather than me searching and giving you a link I suggest you do a search for somethign like VB6 transparent Picturebox and see what you turn up.
    Always use [code][/code] tags when posting code.

  11. #11
    Join Date
    Oct 2012
    Posts
    59

    Re: PictureBox settings.

    Quote Originally Posted by DataMiser View Post
    I still have no clue why you would use strings when the values are numeric but that is beside the point what you are really looking for is a way to do a transparent image with a picture box. This is something I have not tryied to do. I know by default it is not supported but there are ways it can be done. Rather than me searching and giving you a link I suggest you do a search for somethign like VB6 transparent Picturebox and see what you turn up.
    I did it my self with 12 picture. Only thing left is find out how remove picturebox white backround around picture. You can see first picture in this topic. If you are interesting what code i write solve my 12 picture, that is it this:

    Code:
    Pic1.Visible = True
     Pic2.Visible = False
     Pic3.Visible = False
     Pic4.Visible = False
     Pic5.Visible = False
     Pic6.Visible = False
     Pic7.Visible = False
     Pic8.Visible = False
     Pic9.Visible = False
     Pic10.Visible = False
     Pic11.Visible = False
     Pic12.Visible = False
    
    End if
    
    Pic2.Visible = True
     Pic3.Visible = False
     Pic4.Visible = False
     Pic5.Visible = False
     Pic6.Visible = False
     Pic7.Visible = False
     Pic8.Visible = False
     Pic9.Visible = False
     Pic10.Visible = False
     Pic11.Visible = False
     Pic12.Visible = False
     Pic1.Visible = False
     
    End If
    
    Pic3.Visible = True
    Pic4.Visible = False
    Pic5.Visible = False
    Pic6.Visible = False
    Pic7.Visible = False
    Pic8.Visible = False
    Pic9.Visible = False
    Pic10.Visible = False
    Pic11.Visible = False
    Pic12.Visible = False
    Pic1.Visible = False
    Pic2.Visible = False
    I do this with all 12 picture. Of course first i need disable all picture visible = false in desing property.

  12. #12
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: PictureBox settings.

    Because you probably NESTED all the loops into one. First fails, and it skips the rest...

    Might want to POST the code as a sample, and upload that for someone (brave) to test it.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  13. #13
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: PictureBox settings.

    Like I said you are trying to do a transparent picture box which is not supported by default. Making pictures visible or invisible has nothing to do with it. Did you try the search I suggested? You indicated that you could do it in VB.Net, why are you not using VB.Net?
    Always use [code][/code] tags when posting code.

  14. #14
    Join Date
    Oct 2012
    Posts
    59

    Re: PictureBox settings.

    Quote Originally Posted by DataMiser View Post
    I said you are trying to do a transparent picture box
    You misunderstand, my all program is transparent. PictureBox is not set that way and as a result we see white area around picture. Better way to deal with this is upload a png picture then set transparent picturebox backround. It works i tray do that. Problems is whether you set picturebox transparent or not, it will be that box backround. If you try set picturebox opacisy to zero then disapears that box.

    I solve my problems, now program is build to exe file. I run it and tested, it works without any errors. I dont use VB.Net because i have vb6 and vb2010 express.

    Who better, vb6 or vb.net? Vb2010 express too difficult to me.

  15. #15
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: PictureBox settings.

    VB2010 is VB.Net, in fact all versions of VB after 1998 are VB.Net
    VB6 is VB1998

    I'm not surprised that I missunderstood, very hard to determine what you are saying in most of the posts here. It sure sound slike you are trying to get a transparent background on a picture box though.
    Always use [code][/code] tags when posting code.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured