Is it possible to change Font.Size in tabPages?

I got an error that this property is readOnly. Is it possible to change the font size in a tabPage It is very inconvenient to have just one size and it is very large as it is.

Thanks.




Answer this question

Is it possible to change Font.Size in tabPages?

  • D.C

    You need to change the font for the tab page to change the size.



    Font fnt = new Font(tabPage2.Font.FontFamily, 12);
    tabPage2.Font = fnt;




  • WooJin

    Thanks boban.s. I just like tabControls:) Well, I sort of solved the problem by redefining it.

    I have 6 pages already in place before I start generating those new, expendable ones. I found out that no matter what you do you cannor change the font setting defined on the FIRST tabpage. Therefore I just changed the font size on the first page and it gave me pretty much what I wanted. The change has to be done in the project explorer on the first tabPage1 property but not among collections of tabControl--over there it does not do anything either.

    So I am done with it.

    Thanks.



  • darthziv

    Probably cracking will not go that easy, it is posible but not as setting a property. You will nead to play with graphic methods, DrawItem and ....
    Why not use buttons and pannels instead of tabcontrol.



  • SJ100

    Nope, it does not work. I also tried to define the font via System.Drawning namespace like:

    Font fnt = new System.Drawing.Font ( "Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (( byte )(0)) );

    tb1.Font = fnt;

    It take the statements but the font remains the same. Alas.

    Thanks.



  • Will8754

    Thank you, Ken.

    I just tried it. Amazingly it did not do a thing. It did not change the size at all. I put the size down to 9 because I need really small fonts. It took both statements all right though. There should be some additional secret in there but what

    Thanks a lot. I think I am very close to cracking it.

    Many thanks.



  • Is it possible to change Font.Size in tabPages?