Results 1 to 8 of 8

Thread: [RESOLVED] How many combonations... best way to do this?

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Resolved [RESOLVED] How many combonations... best way to do this?

    Ok I am creating an excel add-in... it has 6 options (checkboxes)

    any combonation can be used (these turn on and off print options)

    I want to make the toolbar button display an image representing whats turned on / off...

    I need to know How many combonations are possible with 6 checkboxes? (No value of 2 (greyed) allowed .. so it will be just 1/0)

    is it 27 combos? or am I waaay off? my brain is shot right now! lol

    but what would be the best way to figure out which button pic to use?

    I am thinking.. each checkbox TAG will have a 1 or 0, then build a string..
    111010 and name the image in the res file accordingly?

    sound good?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: How many combonations... best way to do this?

    2^6 I think, (64).

    I am thinking.. each checkbox TAG will have a 1 or 0, then build a string..
    111010 and name the image in the res file accordingly?
    sound good?
    Sounds like a good idea
    Last edited by jcis; Jan 26th, 2006 at 04:14 PM.

  3. #3

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: How many combonations... best way to do this?

    Lol.. yeah I just tried this:
    VB Code:
    1. For a = 0 To 1
    2.     For b = 0 To 1
    3.         For c = 0 To 1
    4.             For d = 0 To 1
    5.                 For e = 0 To 1
    6.                     For f = 0 To 1
    7.                         Debug.Print a & b & c & d & e & f
    8.                     Next
    9.                 Next
    10.             Next
    11.         Next
    12.     Next
    13. Next

    and I got 64 lines.. is that right? would I need to create 64 diff BMPS!???
    or... is there some way to have a 16x16 picbox and "draw" smaller bmps onto it??
    like I could have 2 bmps for each chkbox.. then when a checkbox is checked...
    add or remove the bmp from the picbox?

    hmm...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: How many combonations... best way to do this?

    If you want to draw them (it's a simple graphic?) it would be easy, but if you want to use bitmaps (from file or res file) maybe you could have only one bitmap (big bitmap) containing all mini bitmaps, then use PaintPicture to scrcopy the one you need each time.

  5. #5
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: How many combonations... best way to do this?

    Or you could use 2 bitmaps, one containing 6 "down" buttons and the other containing 1 "up" button. Then you paste the "up" button over the "down" button in the requisite places, which will be an integer number x the width of the "up" button picture according to the pattern of 1 and 0. Or you could actually do it in terms of a number:

    1234 means paint the "up" button in positions 1,2,3 and 4.
    256 means paint it in positions 2,5 and 6 etc


    Or just use 6 togglebuttons...

    zaza

  6. #6

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: How many combonations... best way to do this?

    Ok heres my thought
    I have 2 images.. 1 on 1 off

    they are in the RES file..
    how do I load (or Draw) the little bmps into certain places in the picbox..

    Picture1.Cls
    Picture1.PaintPicture LoadResPicture("F_ON", vbResBitmap), 12, 2

    doesnt error.. but nothing appeared in Picture1 ??
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: How many combonations... best way to do this?

    .Scalemode = VbPixels? .AutoRedraw =True?

  8. #8

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: How many combonations... best way to do this?

    um no lol

    It was working fine.. but I needed to use Picture2
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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