This is a migrated thread and some comments may be shown as answers.

How do I change the Font Size on the tabs?

6 Answers 431 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Terry Delongchamp
Top achievements
Rank 1
Terry Delongchamp asked on 27 Sep 2011, 05:54 PM
I did some searching around, but couldn't find an answer to this.

I have a PageView with 2 tabs that I have set to use the Office2007Silver theme.  I have added images to both of the tab and while those look nice the text on the tabs is too small and I would like to increase it.

I have tried changing the font size in several places, but none of them change the font.

I tried directly in the properties of the PageView object. 

I also expanded the PageView Tasks and clicked "Edit UI Elements" because this section helped me change properties of buttons I'd applied a theme to.  I tried the PageViewLabelElements, StripButtonElements... eventually I changed the font size for every single element in this section, but nothing changed.

So where/how do I change the font size on a tab on a PageView object that has a theme applied to it?

/<evin

6 Answers, 1 is accepted

Sort by
0
Terry Delongchamp
Top achievements
Rank 1
answered on 28 Sep 2011, 08:43 PM
The solution on this page:
http://www.telerik.com/community/forums/winforms/page-view/want-the-page-name-to-be-in-black-color.aspx

is close.  I can use it to change the color of the text on the tabs, but unfortunately "page.item.font.size" is a read-only property.

Is there really no way to change the font size in the designer?

/<evin
0
Ivan Petrov
Telerik team
answered on 30 Sep 2011, 04:14 PM
Hi Terry,

Thank you for writing.

If you do not have a theme applied, you can change the font size by directly changing the Font property of the RadGridView. In your case, with a theme applied, you have to directly change the font of the tab items. Consider the following code snippet which achieves this:

Font newfont = new Font(this.radPageView1.Font.FontFamily, 20);
RadPageViewStripElement stripElement = (RadPageViewStripElement)this.radPageView1.ViewElement;
 
foreach (RadPageViewStripItem item in stripElement.ItemContainer.ItemLayout.Children)
{
  item.Font = newfont;
}

I hope this will help. if you have further questions, I would be glad to help.

Regards,
Ivan Petrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Terry Delongchamp
Top achievements
Rank 1
answered on 30 Sep 2011, 04:59 PM
That did the trick, thanks.  I will add a new section to my page load event to go through and change all of the tabs.

I have the same issue with the RadGridView column headers.  How can I edit the font there for a grid that has a style applied to it?

/<evin
0
Ivan Petrov
Telerik team
answered on 04 Oct 2011, 12:06 PM
Hello Terry,

Thank you for your reply.

You can use the RadGridView ViewCellFormatting event to change the font of the grid header cells. Here is a code snippet which demonstrates this:

public Form1()
{
  this.radGridView1.ViewCellFormatting += new CellFormattingEventHandler(radGridView1_ViewCellFormatting);
}
 
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
  if (e.CellElement is GridHeaderCellElement)
  {
    e.CellElement.Font = new Font(e.CellElement.Font.FontFamily, 20);
  }
}

Should you have further questions do not hesitate to ask. Greetings,
Ivan Petrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Kevin
Top achievements
Rank 1
answered on 04 Oct 2011, 03:01 PM
How would that be written in VB? 

When I try the if statement below it tells me "GridHeaderCellElement is a type and cannot be used as an expression".

/<evin
0
Kevin
Top achievements
Rank 1
answered on 04 Oct 2011, 03:08 PM
OK, I figured it out... should have just given it an extra half hour. =)

The VB version of the IF statement would be:
   
If TypeOf(e.CellElement) Is GridHeaderCellElement Then
    e.CellElement.Font = New Font("Arial", 12, FontStyle.Bold, GraphicsUnit.Point)
End If

Thank you for your help.

/<evin

 

Tags
PageView
Asked by
Terry Delongchamp
Top achievements
Rank 1
Answers by
Terry Delongchamp
Top achievements
Rank 1
Ivan Petrov
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or