.NET Forum / Windows Forms / WinForm Controls / December 2006
Another very easy grid header question
|
|
Thread rating:  |
Earl - 11 Sep 2004 08:34 GMT I've noticed the headers for my right aligned columns seem to run into the grid lines and cut off the last letter of the header text. Digging thru the Google archives, I saw that this question has been asked a lot but never answered. Is this as good as it gets or is there a solution?
Kevin Yu [MSFT] - 11 Sep 2004 09:57 GMT Hi Earl,
We have reviewed this issue and are currently researching on it. We will update you ASAP. Thanks for your patience!
Kevin Yu
 Signature ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
"Jeffrey Tan[MSFT]" - 14 Sep 2004 10:38 GMT Hi Earl,
I am not very sure of your problem, can you attach some screen shoot to give us your issue a view?
Also, if your problem is the column width not enough issue, you can use a customized DataGridColumnStyle, and set its width to you wanted value.
Thank you for your patience and cooperation. If you have any questions or concerns, please feel free to post it in the group. I am standing by to be of assistance.
Best regards, Jeffrey Tan Microsoft Online Partner Support
 Signature Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Earl - 15 Sep 2004 09:33 GMT This is a common issue throughout any datagrids I use in my app.
http://home.comcast.net/~brikshoe/example_of_right_aligned_datagrid_issue.jpg
> Hi Earl, > [quoted text clipped - 13 lines] > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. "Jeffrey Tan[MSFT]" - 16 Sep 2004 04:34 GMT Hi Earl,
Thanks for your feddback.
Yes, I have seen your problem. But I still can not find a way to reproduce out your issue, can you show me some code snippet to reproduce this issue out? Then I will help you better.
Thank you for your patience and cooperation. If you have any questions or concerns, please feel free to post it in the group. I am standing by to be of assistance.
Best regards, Jeffrey Tan Microsoft Online Partner Support
 Signature Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Earl - 16 Sep 2004 05:52 GMT Thanks Jeffrey. For brevity, I've left out all the other columns I'm attaching to the table style.
Private Sub AdjustTableStyle()
Dim tblStyle As New DataGridTableStyle tblStyle.MappingName = "dtSupplyCosts"
dgSupplyHistory.TableStyles.Clear() dgSupplyHistory.TableStyles.Add(tblStyle) ....
Dim tbcQuantity As DataGridTextBoxColumn = CType(tblStyle.GridColumnStyles("Quantity"), DataGridTextBoxColumn) tbcQuantity.Alignment = HorizontalAlignment.Right tbcQuantity.Width = 60 tbcQuantity.HeaderText = "Quantity." tbcQuantity.NullText = "" .....
End Sub
You may also wish to peruse some of the following threads: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&q=datagrid%2Bcolumn%2Balignme nt%2Bright&meta=group%3Dmicrosoft.public.dotnet.*
One in particular caught my attention: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=dIWJJQ4tCHA.896%40cpm sftngxa09&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26q%3Ddatagrid%252B column%252Balignment%252Bright%252BOS%26meta%3Dgroup%253Dmicrosoft.public.dotnet.*
Although that is at best an unrealistic solution, and in my case, was not the problem at all. However, it may help in finding the resolution to what appears to be a common issue.
> Hi Earl, > [quoted text clipped - 13 lines] > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. "Jeffrey Tan[MSFT]" - 17 Sep 2004 03:05 GMT Hi Earl,
Thanks very much for your feedback.
I think there is not much problem about your code. But after viewing the below thread: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=dIWJJQ4tCHA.896%4 0cpmsftngxa09&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26q%3Ddatag rid%252Bcolumn%252Balignment%252Bright%252BOS%26meta%3Dgroup%253Dmicrosoft.p ublic.dotnet.*
I think my colleague Justin Wan has showed the root cause to us, it should be the display font DPI problem.
Can you show me DataGrid.Font.Size property of your application? Also, what is your setting of your system in: "Display Properties"->"Settings"->Advanced->General->DPI Setting?
Also, I suggest you set a bigger font size for the DataGrid to see if problem can be resolved. A lower DPI may also help to resolve the problem.
Thank you for your patience and cooperation. If you have any questions or concerns, please feel free to post it in the group. I am standing by to be of assistance.
Best regards, Jeffrey Tan Microsoft Online Partner Support
 Signature Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Earl - 20 Sep 2004 02:30 GMT Thanks for the thoughts Jeffrey. I had of course read all that about the interaction of various font sizes and DPI which was why I posed the question -- "is that as good as it gets?"
The development system is set at "Normal(96 dpi)" and the datagrid was at 8 pt. I did try various combinations of font and DPI, and some were better than others (9 pt is better although the letters are visible yet still touching the right gridline), and none were what I would term as acceptable. In any event it is unrealistic to have the user change the font size and DPI on their system to cure an ill with the datagrid in one application. That's killing the horse simply because the dog gave it the mange.
> Hi Earl, > [quoted text clipped - 27 lines] > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. "Jeffrey Tan[MSFT]" - 20 Sep 2004 07:06 GMT Hi Earl,
Thanks for your feedback.
Based on your feedback, I think your problem may not be the same issue as that google link problem. Because that google link's problem will ONLY occur when the system font size changes to large size 120DPI instead of normal 96DIP, while your development environment is in "Normal(96 dpi)" and 8PT font. Which should not have this problem. So these 2 issues have different environment, and may not be the same issue.
Normally, we should have no problem on using DataGrid column width with right alignment in "Normal(96 dpi)" and 8PT font, so I still can not reproduce your problem. I suggest you find a way to create a sample reproduce project for me, then I will help you to find the cause for this issue. Without reproduce out this issue, we will have no clue to work it out.
Thank you for your patience and cooperation. If you have any questions or concerns, please feel free to post it in the group. I am standing by to be of assistance.
Best regards, Jeffrey Tan Microsoft Online Partner Support
 Signature Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 22 Sep 2004 10:28 GMT Hi Earl,
Does my reply make sense to you? Is your problem resolved?
Please feel free to feedback. Thanks
Best regards, Jeffrey Tan Microsoft Online Partner Support
 Signature Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Earl - 22 Sep 2004 10:49 GMT Thanks for your assistance Jeffrey. It does not appear that there is a resolution so I am spending no further time dealing with it and am simply looking for the best alternatives to the datagrid control at this time.
> Hi Earl, > [quoted text clipped - 7 lines] > Get Secure! - www.microsoft.com/security > This posting is provided "as is" with no warranties and confers no rights. "Jeffrey Tan[MSFT]" - 23 Sep 2004 06:21 GMT Hi Earl,
Thanks very much for your feedback.
Actually, for your issue, I still did not find a way to reproduce out. Does this problem occur in other machines on your side? Winform DataGrid is a very general control in .Net, which should not have this display issue, at least in most situation. I think this problem should due to some system issue of your specific machine. To determine this, if you want, you may create a sample little project for me to reproduce it.
Thank you for your patience and cooperation. If you have any questions or concerns, please feel free to post it in the group. I am standing by to be of assistance.
Best regards, Jeffrey Tan Microsoft Online Partner Support
 Signature Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Scott - 04 Jan 2005 13:37 GMT One workaround I used was to make the DataGrid header background the same colour as the column separators. That way, the header text doesn't appear to run into the separator - although it is really.
I run 96dpi and 8pt fonts and this problem comes up every time in varying degrees depending on the characters used in the header text. If you take a look at left aligned header text there is a small margin of blank space between the column separator and the start of the header text. With right aligned header text there is no margin. To me, it looks like someone forgot to put the margin on the right side if right aligned. It's probably still adding margin on the left side. :-)
I read one post that said it's related to the version of .NET Framework you run. Anyone know which version does NOT have this problem?
Scott.
> Thanks for your assistance Jeffrey. It does not appear that there is a > resolution so I am spending no further time dealing with it and am simply [quoted text clipped - 11 lines] > > Get Secure! - www.microsoft.com/security > > This posting is provided "as is" with no warranties and confers no rights. may wang - 15 Jan 2005 01:43 GMT Actually this is not a issue on specific machine. I am new to datagrid, but I saw this problem is asked everywhere. I tried this piece of code: public override string HeaderText { get { switch (this.Alignment) { case HorizontalAlignment.Right: return base.HeaderText + " "; default: return base.HeaderText; } } set { base.HeaderText = value; } }
And it works fine until you clicked the header so now the header text is drawn at the right side of the small arrow image and the dot character will be seen. I am thinking this can be fixed by detecting if the current column has sorted image. There must be some way to detect it, right?
But anyway, it is too much trouble and I hope somebody can find a easy way for this.
Munteanu Ghenadie - 08 Dec 2006 08:29 GMT Hi. I have the similar problem. If aligment is Right, the last leter is cut. But is not clear, in wich cases. Sometimes it is cut, sometimes not, sometimes only a half of the letter. It is a lot of questions about, but not clear answer was done. The solutzion with addind a point (" .") also doeasn't work, because in the same cases the point arent cut.. misty) Best regards gmunteanu
From http://www.developmentnow.com/g/30_2004_9_0_0_122732/Another-very-easy-grid-head er-question.ht
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|