Click to See Complete Forum and Search --> : [RESOLVED] How many combonations... best way to do this?
Static
Jan 26th, 2006, 03:02 PM
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?
jcis
Jan 26th, 2006, 03:06 PM
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 :)
Static
Jan 26th, 2006, 03:24 PM
Lol.. yeah I just tried this:
For a = 0 To 1
For b = 0 To 1
For c = 0 To 1
For d = 0 To 1
For e = 0 To 1
For f = 0 To 1
Debug.Print a & b & c & d & e & f
Next
Next
Next
Next
Next
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...
jcis
Jan 26th, 2006, 03:36 PM
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.
zaza
Jan 26th, 2006, 03:40 PM
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
Static
Jan 26th, 2006, 03:48 PM
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 ??
jcis
Jan 26th, 2006, 03:50 PM
.Scalemode = VbPixels? .AutoRedraw =True?
Static
Jan 26th, 2006, 10:12 PM
um no ;) lol
It was working fine.. but I needed to use Picture2 :rolleyes:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.