473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

DataGridColumnStyle paint override fails on last cell in row

I made a class that extends DataGridColumnStyle. In the
Paint override I draw a border around each cell in the
column.

All cells look fine except for the last one (final row).
The lines I draw in the far right and bottom of the cell
don't show. I can draw 1 pixel up from the bottom and 1
pixel left of the right border. What is preventing me
from painting the border around this last cell?
Nov 15 '05 #1
3 2893
Hello Mark,

I'm afraid custom-drawn cells are not supposed to draw borders around
themselves. The grid has a feature called "GridLines" which will draw a
border around every cell in the grid.

Then, there's a "gotcha" with coordinates passed to DrawRect (or however it
is called in .NET) routines, related to just right-bottom corner. I'd
suggest reviewing MSDN docs to ensure how EXACTLY the passed coordinates are
interpreted by this routine.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ma*********@hill.af.mil" <an*******@discussions.microsoft.com> wrote in
message news:02****************************@phx.gbl...
I made a class that extends DataGridColumnStyle. In the
Paint override I draw a border around each cell in the
column.

All cells look fine except for the last one (final row).
The lines I draw in the far right and bottom of the cell
don't show. I can draw 1 pixel up from the bottom and 1
pixel left of the right border. What is preventing me
from painting the border around this last cell?


Nov 15 '05 #2
Who draws the grid lines? DataGrid? I need to override
whomever paints the lines so I can tailor the cell
borders.
-----Original Message-----
Hello Mark,

I'm afraid custom-drawn cells are not supposed to draw borders aroundthemselves. The grid has a feature called "GridLines" which will draw aborder around every cell in the grid.

Then, there's a "gotcha" with coordinates passed to DrawRect (or however itis called in .NET) routines, related to just right- bottom corner. I'dsuggest reviewing MSDN docs to ensure how EXACTLY the passed coordinates areinterpreted by this routine.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ma*********@hill.af.mil" <an*******@discussions.microsoft.com> wrote inmessage news:02****************************@phx.gbl...
I made a class that extends DataGridColumnStyle. In the Paint override I draw a border around each cell in the
column.

All cells look fine except for the last one (final row). The lines I draw in the far right and bottom of the cell don't show. I can draw 1 pixel up from the bottom and 1
pixel left of the right border. What is preventing me
from painting the border around this last cell?


.

Nov 15 '05 #3
It's most likely the grid itself that draws the cell borders. However, you
cannot override this particular drawing step - you can only override the
whole grid painting routine.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

<an*******@discussions.microsoft.com> wrote in message
news:14*****************************@phx.gbl...
Who draws the grid lines? DataGrid? I need to override
whomever paints the lines so I can tailor the cell
borders.


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DraguVaso | last post by:
Hi, I 'wrote' my own DataGrid, using the normal DataGrid, and overriding some of the DataGridTextBoxColumn-methods (mostly the Paint-method). I based most of my changes on the Windows Form FAQ:...
2
by: DraguVaso | last post by:
Hi, In the override of the Paint-method of a DataGridTextBoxColumn I want to show an image with BitBlt, to see what I can gain there on performance. The problem is: It doesn't show me the image...
1
by: Craig | last post by:
I've tried to override the paint method and I can't get the overriden paint method to get called. I put the the method below within the class, but it never gets called when I open up my form. By...
0
by: vooose | last post by:
Consider a UserControl to which you do userControl.Paint += new PaintEventHandler(paint_method) If you don't like that way, and prefer to override onPaint( ) then the problem stated below...
3
by: pacemkr | last post by:
Is it possible to force a control to paint to a Graphics object (or Device Context, or a bitmap, anywhere aside from the form) that I provide. I am writing a windows form class that supports...
3
by: Mike Cooper | last post by:
I have been staring at the above error for over a week now! I have a an inherited data class looking like thus: Public Class DataGridBoolColumnInherit Inherits...
1
by: nate axtell | last post by:
In VB .Net I made a custom CheckBox column style (for the Datagrid control) that maps to two DataTable columns , one it uses for the Checked status and the other it uses for the Enabled status. I am...
0
by: =?Utf-8?B?TWljaGFlbCBKLiBWaXNpbnRpbg==?= | last post by:
Hi All, I am implementing the Paint Method override described in the Help (DataGridTextBoxColumn.PaintMethod). I believe that I have implemented the procedure example displayed in the Help...
0
by: ziketo | last post by:
Hi, I searched a lot about changing the DataGridView cell borders. BYTES helped me so I will write down the solution: 1. You should override the class DataGridViewTextBoxCell, and the new class...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.