private void InitButtonStyle(ExpandButtonStyle style) { _expandButtonStyle = style; switch (_expandButtonStyle) { case ExpandButtonStyle.MagicArrow: var bmp = Properties.Resources.Upload; bmp.RotateFlip(RotateFlipType.Rotate180FlipNone); pictureBox1.Image = bmp; break; case ExpandButtonStyle.Circle: bmp = Properties.Resources.icon_expand; pictureBox1.Image = bmp; break; case ExpandButtonStyle.Triangle: pictureBox1.Image = Properties.Resources._1downarrow1; break; case ExpandButtonStyle.FatArrow: bmp = Properties.Resources.up_256; bmp.RotateFlip(RotateFlipType.Rotate180FlipNone); pictureBox1.Image = bmp; break; case ExpandButtonStyle.Classic: bmp = Properties.Resources.icon_struct_hide_collapsed; bmp.RotateFlip(RotateFlipType.Rotate180FlipNone); pictureBox1.Image = bmp; break; default: throw new ArgumentOutOfRangeException("style"); } // collapsed bitmap: _collapsed = pictureBox1.Image; // expanded bitmap is rotated collapsed bitmap: _expanded = MakeGrayscale3(pictureBox1.Image); _expanded.RotateFlip(RotateFlipType.Rotate180FlipNone); // finally set appropriate bitmap for current state pictureBox1.Image = _isExpanded ? _expanded : _collapsed; }