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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl - Right Aligning Cell Background Image

Thread ID:





45760 Jun 28,2006 10:22 AM UTC Jun 28,2006 04:13 PM UTC WinForms 1
Tags: GridControl
Badri Rajani Kanth
Asked On June 28, 2006 10:22 AM UTC

Dear Syncfusion, We are working with Syncfusion 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

Administrator [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon