Hi All,
I am implementing the Paint Method override described in the Help
(DataGridTextBo xColumn.PaintMe thod). I believe that I have implemented the
procedure example displayed in the Help verbatim. I receive no errors, and
the debugger shows all of the code being executed, but my new color never
appears when I click on the cell of the grid.
Are there any general things I can look for besides things like making sure
my rectangle is not of infintesimally small size, etc? I am pasting the MS
code below.
Thanks,
Michael
Private Sub PaintCell(ByVal sender As Object, ByVal e As MouseEventArgs)
' Use the HitTest method to get a HitTestInfo object.
Dim hi As DataGrid.HitTes tInfo
Dim grid As DataGrid = CType(sender, DataGrid)
hi = grid.HitTest(e. X, e.Y)
' Test if the clicked area was a cell.
If hi.Type = DataGrid.HitTes tType.Cell Then
' If it's a cell, get the GridTable and ListManager of the
' clicked table.
Dim dgt As DataGridTableSt yle = grid.TableStyle s(0)
'Dim cm As CurrencyManager = CType(Me.Bindin gContext _
'(MyDataSet.Tab les(dgt.Mapping Name)), CurrencyManager )
Dim cm As CurrencyManager = CType(Me.Bindin gContext _
(grid.DataSourc e, grid.DataMember ), CurrencyManager )
' Get the Rectangle of the clicked cell.
Dim cellRect As Rectangle
cellRect = grid.GetCellBou nds(hi.Row, hi.Column)
' Get the clicked DataGridTextBox Column.
Dim gridCol As MyGridColumn = CType _
(dgt.GridColumn Styles(hi.Colum n), MyGridColumn)
' Get the Graphics object for the form.
Dim g As Graphics = grid.CreateGrap hics()
' Create two new Brush objects: a fore brush and back brush.
Dim fBrush As New SolidBrush(Colo r.Blue)
Dim bBrush As New SolidBrush(Colo r.Yellow)
' Invoke the Paint method to paint the cell with the brushes.
gridCol.PaintCo l(g, cellRect, cm, hi.Row, bBrush, fBrush, False)
End If
End Sub
-- 0 1429 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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:
- http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q745q
- http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q758q
- http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q837q
Basicly it works like this: Every time a cell has...
|
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 in the DataGrid-Cell's, but a
black background...
Does anybody has any idea what I am doing wrong?
Thanks a lot in advance,
|
by: Mark.Larsen |
last post by:
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?
|
by: Daniel Walzenbach |
last post by:
Hi,
I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp, Selecting Rows by Clicking Anywhere).
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
|
by: ruca |
last post by:
Hi,
Can anyone give me examples of how can I hightlight cells of my datagrid? I
know that I must use ItemBound event and probably JavaScript.
The thing is that I have a anual calendar, constructed in a DataGrid. Then
what I want is select a range of two dates in that same calendar to do any
action.
| |
by: Suzanne |
last post by:
Hi all,
I'm having problems with datagrids and the currentcellchanged event.
My problem is this: I have a datagrid on a form, if the user changes
the text in a cell on the datagrid then tries to close the form via a
button on the toolbar (with going to another cell in the datagrid)I
want to be able to popup a messagebox to the user asking them if they
want to keep their changes.
At the momment I'm accomplishing this by a property that...
|
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 System.Windows.Forms.DataGridBoolColumn
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal
bounds As Rectangle, ByVal As CurrencyManager, ByVal rowNum
As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal
alignToRight As Boolean)
|
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 having a couple problems so far.
1. with the way the Paint method works: When I scroll to the right, the custom column gets Drawn on top of the left-most "Selecting" column (the one where the green arrows are displayed). How can I possibly modify...
|
by: tg |
last post by:
Visual Studio 2003
My problem is that I am dynamically creating a datagrid on pageload.
The datagrid is completely dynamic as it is based on the number of columns
returned from a recordset. The number of columns could change very often.
Within this datagrid that is created, each cell needs to be colored
different colors based on a the value within the cell. For example, if the
number is less than 90, color the cell red, if it is...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |