Selecting multiple ranges

Help
Tom Way
2012-11-15
2013-04-30
  • Tom Way

    Tom Way - 2012-11-15

    I am trying to select multiple ranges, and it seems at present HexBox (and maybe this is a fundamental Windows control feature) only allows one selection at a time.

    For example, I'd like to do this:

    for (int i=10; i<400; i+=20)
         hexBox1.Select(i, 10);
    

    The result of running that snippet is that only the last selection appears to be selected.

    Is there any way to preserve selections, or some other way to select multiple ranges?

     
  • Bernhard Elbl

    Bernhard Elbl - 2012-11-16

    Select is working like in TextBox control. So multiple selections are not possible. You would need to change the Paint-methods of hexbox to allow something like color regions.

     
  • Tom Way

    Tom Way - 2012-11-20

    Ah, okay. Yes, I was looking at the Paint methods. It looks like to enable multiple ranges of hex values to be selected I would have to keep a list of start and end points, rather than a single start and end point, and then iterate through the list painting color regions for each rather than clearing one before drawing the next.

    But I'm not feeling that ambitious today. 8-)

    Thanks!

     

Log in to post a comment.