We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridGroupingControl - Right Aligning Cell Background Image

Dear Syncfusion, We are working with Syncfusion 3.2.1.0 GridGroupingControl. In some cells, we want to display text as left/center aligned and image(icon) as right aligned. We are handling _QueryCellStyleInfo event with the below given code. e.Style.BackgroundImageMode = GridBackgroundImageMode.Normal; e.Style.BackgroundImage = Image///loaded from library e.Style.Text = cellText; e.Style.TextAlign = GridTextAlign.Left; But we see the image also left aligned and text starting after image..We could not find Right aligning option for image.. Can you please help? Rgds Rajani Kanth Badri

1 Reply

AD Administrator Syncfusion Team June 28, 2006 04:13 PM UTC

Hi Rajani, To draw the Image with Right align in a textbox cell, You need to handle the TableControlDrawCell event. Here is a code snippet. if(e.Inner.RowIndex > 0 && e.Inner.ColIndex == 2) { Point pt = new Point(e.Inner.Bounds.X + e.Inner.Bounds.Width - img.Size.Width , e.Inner.Bounds.Y ); Rectangle RightRect = new Rectangle( pt,img.Size); e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,e.Inner.Style); e.Inner.Graphics.DrawImage(img,RightRect); e.Inner.Cancel = true; } } Here is a sample. http://www.syncfusion.com/Support/user/uploads/ImageTextBoxwithAlignment_626e184f.zip Let me know if this helps. Best Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon