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

GridRecordNavigationControl button size

Hi,

I am modifying gridRecordNavigationControl1.MaxLabel to display " of " + gridDataBoundGrid.Model.RowCount. But due to some reason, complete text doesn’t display in some of my grids. I am therefore trying to increase size of the Button in the NavigationBar using following code:

int buttonWidth = gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Size.Width;

int buttonHeight = gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Size.Height;

gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Size = new Size(buttonWidth + 50, buttonHeight);

gridRecordNavigationControl1.MaxLabel = "record777777777";

But size of the button doesn’t increase and I can see just "777777" in the label. How can I fix this?

Also, is there anyway that I can right align this label as I see some space after "777777", which I don’t see when I do –
gridRecordNavigationControl1.MaxLabel = "record";

Attached is a sample of my problem. I am using Syncfusion version - 5.102.0.51.

Thanks a lot,
Ranu


GridRecordNavControlButtonSize.zip

11 Replies

HA haneefm Syncfusion Team September 6, 2007 11:43 PM UTC

Hi Ranu,

You can add a label, such that it sits over top of the current information, and then change this label anyway you want. Please try the below code snippet that shows a try at this.

Label customLabel = new Label();
customLabel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
customLabel.Text = "record777777777";
customLabel.Location = new Point(gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[1].Bounds.X + 20, 0);
customLabel.Width = gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[5].Bounds.X - customLabel.Location.X;
gridRecordNavigationControl1.NavigationBar.Controls.Add(customLabel);

Best regards,
Haneef


RG Ranu Gupta September 7, 2007 01:35 PM UTC

Hi Haneef,

Thanks a lot for your pointer. I have modified my code like this:

Label customLabel = new Label();
customLabel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
customLabel.Text = "777777888";
customLabel.Font = new Font("verdana", (float)8.0);
float width;
using (Graphics g = CreateGraphics())
{
width = g.MeasureString(customLabel.Text, customLabel.Font).Width;
}
customLabel.Location = new Point(gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Bounds.X, 0);
gridRecordNavigationControl1.NavigationBar.Controls.Add(customLabel);
gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Bounds = new Rectangle(gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Bounds.X - 20, gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Bounds.Y, (int)width, gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Bounds.Height);

But now I lost ‘Last’ and ‘AddNew’ buttons on the navigation bar. If I reduce width of Buttons[4], I get ‘Last’ and ‘AddNew’ buttons back. Attached is the sample.

Our requirement is to display “Record” in NavigationBar.ButtonBarChild.Buttons[2], current record position in NavigationBar.ButtonBarChild.Buttons[3], and “ of n” (where “n” is ‘total number of records’) in NavigationBar.ButtonBarChild.Buttons[4]. Currently, when total number of records is in more than 2 digits, I can not see the last digits of this number in many of my grids.

Is it possible that we can increase size of Buttons[4] without loosing any buttons on the navigation bar? I guess we will have to increase size of the ButtonBarChild as well. Do you think that is the right solution? If yes, how can that be achieved?

Thanks in advance,
Ranu

GridRecordNavControlButtonSize2.zip


RG Ranu Gupta September 7, 2007 02:52 PM UTC

Hi Haneef,

I was playing around with the above code a little more and came up with something interesting. The following lines of code displays the label (no need for setting bounds of the Buttons[4] as it does not have any effect) on top of the ‘Next’, ‘Last’ and ‘Add New’ buttons.

Label customLabel = new Label();
customLabel.Anchor = AnchorStyles.Left | AnchorStyles.Top;
customLabel.Text = "777777888";
customLabel.Font = new Font("verdana", (float)8.0);
float width;
using (Graphics g = CreateGraphics())
{
width = g.MeasureString(customLabel.Text, customLabel.Font).Width + 4;
}
customLabel.Location = new Point(gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons[4].Bounds.X, 0);
customLabel.Width = (int)width;
gridRecordNavigationControl1.NavigationBar.Controls.Add(customLabel);

Increasing NavigationBarWidth increases size of Buttons[3] only, leading to the same outcome - label overlapping ‘Next’, ‘Last’ and ‘Add New’ buttons.

I have figured out how to move ‘Next’, ‘Last’ and ‘Add New’ towards right, using the gridRecordNavigationControl1_Paint method. Can you advise me on how can I make the horizontal scroll bar smaller so that there is enough room for the ‘Next’, ‘Last’ and ‘Add New’ buttons on its left hand side?

Attaching sample of the modified code.

Thanks,
Ranu


RG Ranu Gupta September 7, 2007 02:55 PM UTC

Sorry.. forgot the attachment

GridRecordNavControlButtonSize3.zip


HA haneefm Syncfusion Team September 7, 2007 03:12 PM UTC

Hi Ranu,

You can increase the width of the NavigationBar using the below code snippet and let me know if this helps.

gridRecordNavigationControl1.NavigationBarWidth = 300; //small the horizantal scrollbar.

Best regards,
Haneef


RG Ranu Gupta September 7, 2007 03:46 PM UTC

Hi Haneef,

Thanks for your quick rely but I have already tried that and mentioned so in the above message as well. Increasing width of the NavigationBar increases width of Button[3] only. Width of all other buttons stay the same and my label still overlaps the 'Next', 'Last' and 'Add New' buttons.

I can move buttons by setting their Bounds.X property in the paint method of the gridRecordNavigationControl. Please see the file I attached in the last message.

The problem I am having is in reducing size of the horizontal scroll bar and moving it towards right so that I have more room for the 'Next', 'Last' and 'Add New' buttons.

Could you please give me a pointer about how to do that?

Thanks a lot,
Ranu


RG Ranu Gupta September 10, 2007 05:26 PM UTC

Hi again,

Any thought on the above issue?

Thanks,
Ranu Gupta


RG Ranu Gupta September 11, 2007 11:49 AM UTC

Hi again,

Could you please help me resolve this issue?

Thanks,
Ranu


RG Ranu Gupta September 12, 2007 11:45 AM UTC

Hi,

This issue is still not resolved. Could you please have a look at it? This is urgent.

Thanks,
Ranu


HA haneefm Syncfusion Team September 12, 2007 11:10 PM UTC

Hi Ranu,

Your incident(#37296) has been updated. Please follow this incident for more details.

Best regards,
Haneef


RG Ranu Gupta September 13, 2007 02:16 PM UTC

Thanks Haneef.

Regards,
Ranu

Loader.
Live Chat Icon For mobile
Up arrow icon