Solved

gridview font-size, change dynamically

Posted on 2014-07-31
3
923 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 150 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 350 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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

710 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