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.
Unfortunately, activation email could not send to your email. Please try again.

GridRecordNavigationControl button size

Thread ID:

Created:

Updated:

Platform:

Replies:

68019 Sep 6,2007 11:32 AM Sep 13,2007 10:16 AM Windows Forms 11
loading
Tags: GridControl
Ranu Gupta
Asked On September 6, 2007 11:32 AM

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

haneefm [Syncfusion]
Replied On September 6, 2007 07:43 PM

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

Ranu Gupta
Replied On September 7, 2007 09:35 AM

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

Ranu Gupta
Replied On September 7, 2007 10:52 AM

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

Ranu Gupta
Replied On September 7, 2007 10:55 AM

Sorry.. forgot the attachment

GridRecordNavControlButtonSize3.zip

haneefm [Syncfusion]
Replied On September 7, 2007 11:12 AM

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

Ranu Gupta
Replied On September 7, 2007 11:46 AM

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

Ranu Gupta
Replied On September 10, 2007 01:26 PM

Hi again,

Any thought on the above issue?

Thanks,
Ranu Gupta

Ranu Gupta
Replied On September 11, 2007 07:49 AM

Hi again,

Could you please help me resolve this issue?

Thanks,
Ranu

Ranu Gupta
Replied On September 12, 2007 07:45 AM

Hi,

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

Thanks,
Ranu

haneefm [Syncfusion]
Replied On September 12, 2007 07:10 PM

Hi Ranu,

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

Best regards,
Haneef

Ranu Gupta
Replied On September 13, 2007 10:16 AM

Thanks Haneef.

Regards,
Ranu

CONFIRMATION

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.

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.

;