ImageLibrary.GetStandartImage(int x, int y) wrong implementation in SharePoint 2013

Apr 21, 2013 at 8:58 AM
Edited Apr 21, 2013 at 8:59 AM
During the test of EasyRibbion it turned out that wrong offsets are being used for ribbon icons. After going some research it tuned out that the formatmap32x32.png image has been changed in the SharePoint 2013 version: there is a 1px border from all the sides of the images and also there is a 2px offset in-between of the images. So the calculations of the offset in the VisualBaseControlTempate.cs should be done in the following manner:
 if (this.Image.X.HasValue)
                {
                    if (this.Image.Url16 != null)
                        controlElement.Add(new XAttribute("Image16by16Left", -1 * ((this.Image.X.Value * 18) + 1)));
                    if (this.Image.Url32 != null)
                        controlElement.Add(new XAttribute("Image32by32Left", -1 * ((this.Image.X.Value * 34) + 1)));
                }

                if (this.Image.Y.HasValue)
                {
                    if (this.Image.Url16 != null)
                        controlElement.Add(new XAttribute("Image16by16Top", -1 * ((this.Image.Y.Value * 18) + 1)));
                    if (this.Image.Url32 != null)
                        controlElement.Add(new XAttribute("Image32by32Top", -1 * ((this.Image.Y.Value * 34) + 1)));
                } 
Coordinator
Apr 21, 2013 at 10:14 AM
Edited Apr 21, 2013 at 10:16 AM
I'll be happy include your patch.
Thanks for feedback!
Coordinator
Jun 17, 2013 at 11:14 AM
MaxMelcher approve your fix, and I commit it.
Thanks for fix!