protected override void PaintImage(Telerik.WinControls.Paint.IGraphics graphics) { if (this.ElementState != ElementState.Loaded || !this.AllowImageAlignment) { base.PaintImage(graphics); return; } ImageList associatedImageList = this.ElementTree.ComponentTreeHandler.ImageList; if (associatedImageList != null && this.ImageIndex > -1 && this.ImageIndex < associatedImageList.Images.Count) { RadPanelBarGroupElement group = this.GetGroupElement(); if (group != null) { if (group.GetPanelBarElement() != null) { if (group.GetPanelBarElement().ElementTree != null) { if (this.Image == null) { this.Image = associatedImageList.Images[this.ImageIndex]; } } } } } else { if (associatedImageList != null && !String.IsNullOrEmpty(this.ImageKey)) { RadPanelBarGroupElement group = this.GetGroupElement(); if (group != null) { if (group.GetPanelBarElement() != null) { if (group.GetPanelBarElement().ElementTree != null) { if (this.Image == null) { this.Image = associatedImageList.Images[this.ImageKey]; } } } } } } int offset = InitialOffset + captionOffset; if (this.Image == null) { return; } if (this.ElementTree.Control.RightToLeft == System.Windows.Forms.RightToLeft.Yes) { offset = this.Size.Width - InitialOffset - captionOffset - Image.Size.Width; } switch (this.ImageAlignment) { case ContentAlignment.BottomLeft: graphics.DrawBitmap(this.Image, offset, (this.Size.Height - this.Image.Height)); break; case ContentAlignment.BottomCenter: graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, (this.Size.Height - this.Image.Height)); break; case ContentAlignment.BottomRight: graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, (this.Size.Height - this.Image.Height)); break; case ContentAlignment.MiddleLeft: graphics.DrawBitmap(this.Image, offset, (this.Size.Height - this.Image.Height) / 2); break; case ContentAlignment.MiddleRight: graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, (this.Size.Height - this.Image.Height) / 2); break; case ContentAlignment.MiddleCenter: graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, (this.Size.Height - this.Image.Height) / 2); break; case ContentAlignment.TopLeft: graphics.DrawBitmap(this.Image, offset, 0); break; case ContentAlignment.TopCenter: graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, 0); break; case ContentAlignment.TopRight: graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, 0); break; } }