Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

Formatting the cell of DataGrid for Pocket PC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark - 19 Jul 2006 14:56 GMT
I need to format the cells of one Column of DataGrid, on the Pocket PC
with Windows CE vers.  4.2
The problem is that in the libreries of C# for Windows CE, there isn't
the paint method of DataGridTextBoxColumn, which i used for paint the
cell.
Howewer i don't know the alternative metodology to format  each cell of
one column, differently.
I help you for some council!!!!!!!!!!!
joelcochran@gmail.com - 19 Jul 2006 16:43 GMT
> I need to format the cells of one Column of DataGrid, on the Pocket PC
> with Windows CE vers.  4.2
[quoted text clipped - 4 lines]
> one column, differently.
> I help you for some council!!!!!!!!!!!

Create a DataGirdTableStyle, then create and add DataGridColumn objects
to it, each with its own formatting.  Here is a working sample from a
Mobile5 app I have written:

<code>
           this.dt = new DataTable();

           DataColumn col_seq = new DataColumn("Seq",
Type.GetType("System.Int32"));
           this.dt.Columns.Add(col_seq);

           DataColumn col_desc = new DataColumn("Description",
Type.GetType("System.String"));
           this.dt.Columns.Add(col_desc);

           DataColumn col_value = new DataColumn("Value",
Type.GetType("System.Decimal"));
           this.dt.Columns.Add(col_value);

           DataGridTableStyle style = new DataGridTableStyle();
           DataGridTextBoxColumn SeqColumn = new
DataGridTextBoxColumn();
           SeqColumn.MappingName = "Seq";
           SeqColumn.HeaderText = "Seq";
           SeqColumn.Width = 50;
           style.GridColumnStyles.Add(SeqColumn);

           DataGridTextBoxColumn LhsColumn = new
DataGridTextBoxColumn();
           LhsColumn.MappingName = "Description";
           LhsColumn.HeaderText = "Description";
           LhsColumn.Width = 270;
           style.GridColumnStyles.Add(LhsColumn);

           DataGridTextBoxColumn ValueColumn = new
DataGridTextBoxColumn();
           ValueColumn.MappingName = "Value";
           ValueColumn.HeaderText = "Value";
           ValueColumn.Width = 100;
           style.GridColumnStyles.Add(ValueColumn);

           this.dg.TableStyles.Add(style);
           this.dg.DataSource = this.dt;
</code>

HTH,

Joel
Mark - 20 Jul 2006 11:39 GMT
Hi Joel

you're nice, but my problem is formatting the each cell of DataGrid.
I used your council, but, with only the methods of
DataGridTextBoxColumn, i don't paint the background of the each cell,
so i need to find a method which i can use to format the background of
each cells of DataGrid. Partucularly, i found the method paint of
DataGridTextBoxColumn, but il isn't in the C# libraries for Windows CE.

Thank you very much!

Waiting your answear.

hello Mark
joelcochran@gmail.com - 25 Jul 2006 15:05 GMT
Hi Mark,

Sorry, by formatting the cells I thought you meant sizing, naming, etc.
I believe that if you want to format the individual cells you may need
to extend DataGridTextBoxColumn (if it isn't sealed) and override the
OnPaint method.  Otherwise, I don't know how you would do what you
want.

Best of luck,

Joel

> Hi Joel
>
[quoted text clipped - 10 lines]
>
> hello Mark
Mark - 26 Jul 2006 09:01 GMT
Hi Joel
but i find absurd that there isn't a specific method to paint the
individual cells. I noticed that the selection of row of DataGrid was
painted in blue color and i thought that it had to exist a particular
good method, on the pocket PC, to paint the background of cell. If
you'll have some answer in the future, i would like to know its.

Bye Bye
Mark

Free Magazines

Get 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 ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.