public bool getPenBtnInfo(int index, out int size, out Color colour, out OverlayPaintArea.penType type)
        {
            // some basic default values.
            size   = 2;
            colour = Color.Black;
            type   = OverlayPaintArea.penType.softpen;
            penInfo tmpInfo;

            switch (index)
            {
            case 1:
                tmpInfo = (penInfo)pen1Btn.data;
                break;

            case 2:
                tmpInfo = (penInfo)pen2Btn.data;
                break;

            case 3:
                tmpInfo = (penInfo)pen3Btn.data;
                break;

            case 4:
                tmpInfo = (penInfo)pen4Btn.data;
                break;

            case 5:
                tmpInfo = (penInfo)pen5Btn.data;
                break;

            case 6:
                tmpInfo = (penInfo)pen6Btn.data;
                break;

            case 7:
                tmpInfo = (penInfo)pen7Btn.data;
                break;

            default:
                return(false);
            }
            if (tmpInfo == null)
            {
                return(false);
            }
            size   = tmpInfo.size;
            colour = tmpInfo.color;
            type   = tmpInfo.type;
            return(true);
        }
        private bool settingPenInfo = false; // to block onPenUpdated wnen it's jut a set change

        public void SetPenBtnInfo(int index, int size, Color colour, OverlayPaintArea.penType type)
        {
            penInfo tmpInfo = new penInfo(size, colour, type);
            Bitmap  tmpImg  = penImageFromInfo(tmpInfo);
            bool    isSel   = false;

            switch (index)
            {
            case 1:
                pen1Btn.data  = tmpInfo;
                pen1Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen1Btn)
                {
                    isSel = true;
                }
                break;

            case 2:
                pen2Btn.data  = tmpInfo;
                pen2Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen2Btn)
                {
                    isSel = true;
                }
                break;

            case 3:
                pen3Btn.data  = tmpInfo;
                pen3Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen3Btn)
                {
                    isSel = true;
                }
                break;

            case 4:
                pen4Btn.data  = tmpInfo;
                pen4Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen4Btn)
                {
                    isSel = true;
                }
                break;

            case 5:
                pen5Btn.data  = tmpInfo;
                pen5Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen5Btn)
                {
                    isSel = true;
                }
                break;

            case 6:
                pen6Btn.data  = tmpInfo;
                pen6Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen6Btn)
                {
                    isSel = true;
                }
                break;

            case 7:
                pen7Btn.data  = tmpInfo;
                pen7Btn.Image = tmpImg;
                if (pen1Btn.getSelected() == pen7Btn)
                {
                    isSel = true;
                }
                break;
            }
            if ((surface != null) && (isSel))
            {
                this.surface.setPen(size, colour, type);
                settingPenInfo           = true;
                colourBtn.BackColor      = colour;
                typeSelect.SelectedIndex = (int)type - 1;
                sizeSelect.Value         = size;
                settingPenInfo           = false;
            }
        }
 internal penInfo(int s, Color c, OverlayPaintArea.penType t)
 {
     size  = s;
     color = c;
     type  = t;
 }