Comments (11)
I've had a play around and it seems that it's a simple fix. Within the ColumnHeaderCell constructor we can deal with sizes over 16 pixels by setting the _filterButtonImageSize larger when a larger font/scaling is used. Adding the following to the constructor fixes the issue.
if(oldCell.Size.Height > 32) _filterButtonImageSize = new Size(oldCell.Size.Height/2, oldCell.Size.Height/2);
This check makes sure it's no smaller than 16x16 and retains the discreet apearance of a drop down arrow in the corner even when scaled on rows with large fonts that are some 48px.
For my app which deals with family history and thus the user base skews older they tend to want larger fonts and higher screen resolutions so I've examples where they have the scaling at 300% and fonts bumped up to 48px and so a cell height of over 100px a fixed 16x16 icon looks tiny when the cell height is 100px hence need for scaling.
If you'd be so kind as to apply this simple one liner fix to the main body of the code it would be appreciated and save me having to use a forked version.
from advanceddatagridview.
Thanks for helps. That makes sense, the font percentage behaviour I mean.
I'm can not test it for a few days. It will be a pleasure to apply this fix to the master branch and then release a new version.
from advanceddatagridview.
Hello,
Have you try to set the AutoScaleMode to Dpi?
Can you try to run the AdvancedDataGridViewSample project, if you look at the Program.cs file there you can find a simple Dpi setting mode.
from advanceddatagridview.
I tried this but got nowhere. I've had a user report the same issue and I'm fairly sure his machine isn't a high DPI machine so I think I was wrong thinking it was that. I think it's the fixed 16x16 size that appears to be used.
from advanceddatagridview.
It would appear that it has same issue when used on regular screens where the scaling is high or the font is set large. The button isn't scaling to the font used, it appears to be 16x16 regardless of size of columnheader font. It looks like the aim was to make it similar to Excel in which case perhaps the simplest solution is to set the size of the icon to match the height of the columnheadercell.
from advanceddatagridview.
Hello @ShammyLevva,
seems to work your mod but I prefer to do it on percentage, so try this one if it fits for you too:
In ColumnHeaderCell constructor ColumnHeaderCell
after _filterEnabled = filterEnabled;
add
_filterButtonImageSize = new Size((int)Math.Round(oldCell.Size.Height * 0.8), (int)Math.Round(oldCell.Size.Height * 0.8));
In ColumnHeaderCell method GetFilterBounds
replace (withOffset ? cell.Bottom: cell.Height) - _filterButtonImageSize.Height - _filterButtonMargin.Bottom);
with
(withOffset ? cell.Bottom + 2 : cell.Height) - _filterButtonImageSize.Height - _filterButtonMargin.Bottom);
from advanceddatagridview.
Looks good. It is worth testing on an unusual edge case though. If the column header is allowed to wrap text and goes to a 2nd line ie: the cell height is double the normal height as it has 2 lines of text. In that case the button looks unusually big. So it might be better using a percentage of the font height rather than the cell height. Perhaps even 100% of the font height given that the font height will be smaller than the cell height and thus close to your chosen 80%?
from advanceddatagridview.
I get what you mean, let me find some spare time to work on it... maybe next days. I'll keep you updated.
from advanceddatagridview.
I finally had time to check it. Let me know if it works to you.
In ColumnHeaderCell constructor ColumnHeaderCell
after _filterEnabled = filterEnabled;
add
float fontHeight = 23;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
fontHeight = g.MeasureString("O", oldCell.DataGridView.Font).Height;
}
_filterButtonImageSize = new Size((int)(fontHeight * 1.3), (int)(fontHeight * 1.3));
In ColumnHeaderCell method GetFilterBounds
replace (withOffset ? cell.Bottom: cell.Height) - _filterButtonImageSize.Height - _filterButtonMargin.Bottom);
with
(withOffset ? cell.Bottom : cell.Height) / 2 - _filterButtonImageSize.Height / 2);
from advanceddatagridview.
Have you check it?
from advanceddatagridview.
Published in version 1.2.x.12
from advanceddatagridview.
Related Issues (20)
- Setting FilterAndSortEnabled = false does not prevent changed cells being removed from collection HOT 7
- how to speed up filter menu in adgv? HOT 1
- AdvancedDatagridView - 1.2.28405.11 - Problem when clicking on filter / search drop down HOT 2
- Filter/Sort doesn't work on DataGridViewComboBoxColumn HOT 2
- How to use Advanced DataGridView Search Tool Bar HOT 1
- filter button_click events HOT 4
- Verticle Scroll Bars Disappear HOT 2
- Filter Support On Toolbar HOT 4
- create progressbar in advancedatagridview
- Filtering columns with fonts like wingdings HOT 11
- how to paginating data in advanced data grid view? HOT 1
- Column Header Size Issue with ADGV created in previous version. HOT 16
- Query - Is this possible? HOT 4
- Feature Request - New Row at Top HOT 2
- Treenoad loads very slow when much unique datarow (column "ID") HOT 1
- More enhancement doubt for ADGV HOT 1
- Filter DatagridViewImageColumn HOT 2
- How to reference AdvancedDataGridView in VB.NET that uses .NET 6.0 HOT 1
- Can't Wait For RTL Version, Share Plz .... !
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advanceddatagridview.