Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

gridview font-size, change dynamically

Posted on 2014-07-31
3
Medium Priority
?
1,040 Views
Last Modified: 2014-08-03
The intent here is to keep overall width of two side-by-side gridviews fixed at 412px. With 2-digit numbers in the month columns all is fine; however, when there are 3 digits to be reported the gridviews overlap each other (please see the attached image).

Question: Is it possible to decrease font size when the numbers are greater then 99 (for the cell or for the entire row)?

Is it possible to keep gridvies width at 412px fixed so that it will not shrink down when smaller font-size and 1-digit data combination exists?


Thank you.
GridviwGap.png
0
Comment
Question by:Mike Eghtebas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Assisted Solution

by:rajeeshmca
rajeeshmca earned 600 total points
ID: 40233646
Hi,

Fix the width of the grids in %.

For your above situation, just try providing fixed width for the columns and Set controls to AllowWrap=True

Regards
Rajeesh
0
 
LVL 10

Accepted Solution

by:
FamousMortimer earned 1400 total points
ID: 40233946
Hi,

You can do something like this but it may not be so efficient if the datagridview has many cells.

Dim smallfont As New Font(dgv.Font.Name, 10)
        For Each row As DataGridViewRow In dgv.Rows
            For Each c As DataGridViewCell In row.Cells
                If IsNumeric(c.Value) Then
                    If c.Value > 99 Then
                        c.Style.Font = smallfont
                        Exit For
                    End If
                End If
            Next
        Next

Open in new window

0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40238297
Thank you.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question