472,811 Members | 1,448 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Customizing FlexGrid w/ a check box

VR
I am trying to embed a check box into a FlexGrid's cell,
but having a problem when I start scrolling the grid.

Here is my MyCheckBox class...

class MyCheckBox : CheckBox
{
void Init
(
AxMSFlexGridLib.AxMSFlexGrid oGrid,
int iRow,
int iCol
)
{
...

this.Name = "GridCheckBox";
this.TabIndex = 3;

this.Text = "";
this.CheckAlign =
System.Drawing.ContentAlignment.MiddleCenter;

this.Top = ... // calculate based on iRow, iCol
this.Left = ... // calculate based on iRow, iCol
this.Height = ... // calculate based on iRow, iCol
this.Width = ... // calculate based on iRow, iCol

oGrid.Controls.Add(this);
}
}

Whenever I need a checkbox in a grid's cell I create one
and add it to the grid:

class MyGrid : AxMSFlexGridLib.AxMSFlexGrid
{

void Foo()
{
MyCheckBox oCheckBox = new MyCheckBox();
oCheckBox.Init(this, iRow, iCol);
}
}

Everything works fine when I create the check box -- it
does appear above the [iRow, iCol] cell, but it gets
shifted as soon as I start scrolling the grid.

1. Did I choose the right approach for this?
2. Do I need to move my check box myself based on what
happens with the grid?
3. If I do, what is the best approach for it?

Any suggestions/comments are greatly appreciated!

Thanks,
VR
Nov 15 '05 #1
4 6585

Hi VR,

Is your project web based or winform based?
I think in .net, you can use DataGrid instead of using FlexGrid.
Because your checkbox's position was calculated at initialization time, you
should calculate again when the flexgrid was scrolling.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "VR" <Vi****************@gat.com>
| Sender: "VR" <Vi****************@gat.com>
| Subject: Customizing FlexGrid w/ a check box
| Date: Sat, 30 Aug 2003 19:02:42 -0700
| Lines: 58
| Message-ID: <02****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNvY/alFamRgfAtRmm+AcYFCMvscA==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:181086
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I am trying to embed a check box into a FlexGrid's cell,
| but having a problem when I start scrolling the grid.
|
| Here is my MyCheckBox class...
|
| class MyCheckBox : CheckBox
| {
| void Init
| (
| AxMSFlexGridLib.AxMSFlexGrid oGrid,
| int iRow,
| int iCol
| )
| {
| ...
|
| this.Name = "GridCheckBox";
| this.TabIndex = 3;
|
| this.Text = "";
| this.CheckAlign =
| System.Drawing.ContentAlignment.MiddleCenter;
|
| this.Top = ... // calculate based on iRow, iCol
| this.Left = ... // calculate based on iRow, iCol
| this.Height = ... // calculate based on iRow, iCol
| this.Width = ... // calculate based on iRow, iCol
|
| oGrid.Controls.Add(this);
| }
| }
|
| Whenever I need a checkbox in a grid's cell I create one
| and add it to the grid:
|
| class MyGrid : AxMSFlexGridLib.AxMSFlexGrid
| {
|
| void Foo()
| {
| MyCheckBox oCheckBox = new MyCheckBox();
| oCheckBox.Init(this, iRow, iCol);
| }
| }
|
| Everything works fine when I create the check box -- it
| does appear above the [iRow, iCol] cell, but it gets
| shifted as soon as I start scrolling the grid.
|
| 1. Did I choose the right approach for this?
| 2. Do I need to move my check box myself based on what
| happens with the grid?
| 3. If I do, what is the best approach for it?
|
| Any suggestions/comments are greatly appreciated!
|
| Thanks,
| VR
|

Nov 15 '05 #2
VR
Thanks, Jeffrey.

My project is WinForm based and for some reason I am
having a hard time catching scroll events. The reason I
didn't use DataGrid is because I couldn't figure out how
to add/remove rows easily, or to set the number of
rows/columns. Like this:

gridFlex.Rows = 2;
gridFlex.Cols = 3;
gridFlex.AddItem("item");
gridFlex.get_TextMatrix(1, 1);

Are there any samples you could recomend for both
MSFlexGrid and DataGrid (MSFlexGrid preferably) that would
show how to add different controls to grid's cells? Seems
like it's a fairly common technique, yet, I couldn't find
anything in MSDN on that.

Thank for the help.

VR
-----Original Message-----

Hi VR,

Is your project web based or winform based?
I think in .net, you can use DataGrid instead of using FlexGrid.Because your checkbox's position was calculated at initialization time, youshould calculate again when the flexgrid was scrolling.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "VR" <Vi****************@gat.com>
| Sender: "VR" <Vi****************@gat.com>
| Subject: Customizing FlexGrid w/ a check box
| Date: Sat, 30 Aug 2003 19:02:42 -0700
| Lines: 58
| Message-ID: <02****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNvY/alFamRgfAtRmm+AcYFCMvscA==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:181086| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I am trying to embed a check box into a FlexGrid's cell,| but having a problem when I start scrolling the grid.
|
| Here is my MyCheckBox class...
|
| class MyCheckBox : CheckBox
| {
| void Init
| (
| AxMSFlexGridLib.AxMSFlexGrid oGrid,
| int iRow,
| int iCol
| )
| {
| ...
|
| this.Name = "GridCheckBox";
| this.TabIndex = 3;
|
| this.Text = "";
| this.CheckAlign =
| System.Drawing.ContentAlignment.MiddleCenter;
|
| this.Top = ... // calculate based on iRow, iCol
| this.Left = ... // calculate based on iRow, iCol
| this.Height = ... // calculate based on iRow, iCol
| this.Width = ... // calculate based on iRow, iCol
|
| oGrid.Controls.Add(this);
| }
| }
|
| Whenever I need a checkbox in a grid's cell I create one| and add it to the grid:
|
| class MyGrid : AxMSFlexGridLib.AxMSFlexGrid
| {
|
| void Foo()
| {
| MyCheckBox oCheckBox = new MyCheckBox();
| oCheckBox.Init(this, iRow, iCol);
| }
| }
|
| Everything works fine when I create the check box -- it
| does appear above the [iRow, iCol] cell, but it gets
| shifted as soon as I start scrolling the grid.
|
| 1. Did I choose the right approach for this?
| 2. Do I need to move my check box myself based on what
| happens with the grid?
| 3. If I do, what is the best approach for it?
|
| Any suggestions/comments are greatly appreciated!
|
| Thanks,
| VR
|

.

Nov 15 '05 #3

Hi VR,

To add a new row to datagrid, you can add a new row to the dataset and then
bind it to the datagrid.
To add control to the datagrid, there is a good sample here:
http://support.microsoft.com/default...microsoft.com:
80/support/kb/articles/q323/1/67.asp&NoWebContent=1

This sample shows what you should do with the control when you scroll the
datagrid.

Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "VR" <Vi****************@gat.com>
| Sender: "VR" <Vi****************@gat.com>
| References: <02****************************@phx.gbl>
<gr*************@cpmsftngxa06.phx.gbl>
| Subject: RE: Customizing FlexGrid w/ a check box
| Date: Tue, 2 Sep 2003 09:41:53 -0700
| Lines: 131
| Message-ID: <08****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNxcR1ttCtiegKdRyO8kJjDNCH6vg==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:181603
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thanks, Jeffrey.
|
| My project is WinForm based and for some reason I am
| having a hard time catching scroll events. The reason I
| didn't use DataGrid is because I couldn't figure out how
| to add/remove rows easily, or to set the number of
| rows/columns. Like this:
|
| gridFlex.Rows = 2;
| gridFlex.Cols = 3;
| gridFlex.AddItem("item");
| gridFlex.get_TextMatrix(1, 1);
|
| Are there any samples you could recomend for both
| MSFlexGrid and DataGrid (MSFlexGrid preferably) that would
| show how to add different controls to grid's cells? Seems
| like it's a fairly common technique, yet, I couldn't find
| anything in MSDN on that.
|
| Thank for the help.
|
| VR
|
|
|
| >-----Original Message-----
| >
| >Hi VR,
| >
| >Is your project web based or winform based?
| >I think in .net, you can use DataGrid instead of using
| FlexGrid.
| >Because your checkbox's position was calculated at
| initialization time, you
| >should calculate again when the flexgrid was scrolling.
| >
| >Hope this helps.
| >
| >Best regards,
| >Jeffrey Tan
| >Microsoft Online Partner Support
| >Get Secure! - www.microsoft.com/security
| >This posting is provided "as is" with no warranties and
| confers no rights.
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "VR" <Vi****************@gat.com>
| >| Sender: "VR" <Vi****************@gat.com>
| >| Subject: Customizing FlexGrid w/ a check box
| >| Date: Sat, 30 Aug 2003 19:02:42 -0700
| >| Lines: 58
| >| Message-ID: <02****************************@phx.gbl>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcNvY/alFamRgfAtRmm+AcYFCMvscA==
| >| Newsgroups: microsoft.public.dotnet.languages.csharp
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:181086
| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| >|
| >| I am trying to embed a check box into a FlexGrid's
| cell,
| >| but having a problem when I start scrolling the grid.
| >|
| >| Here is my MyCheckBox class...
| >|
| >| class MyCheckBox : CheckBox
| >| {
| >| void Init
| >| (
| >| AxMSFlexGridLib.AxMSFlexGrid oGrid,
| >| int iRow,
| >| int iCol
| >| )
| >| {
| >| ...
| >|
| >| this.Name = "GridCheckBox";
| >| this.TabIndex = 3;
| >|
| >| this.Text = "";
| >| this.CheckAlign =
| >| System.Drawing.ContentAlignment.MiddleCenter;
| >|
| >| this.Top = ... // calculate based on iRow, iCol
| >| this.Left = ... // calculate based on iRow, iCol
| >| this.Height = ... // calculate based on iRow, iCol
| >| this.Width = ... // calculate based on iRow, iCol
| >|
| >| oGrid.Controls.Add(this);
| >| }
| >| }
| >|
| >| Whenever I need a checkbox in a grid's cell I create
| one
| >| and add it to the grid:
| >|
| >| class MyGrid : AxMSFlexGridLib.AxMSFlexGrid
| >| {
| >|
| >| void Foo()
| >| {
| >| MyCheckBox oCheckBox = new MyCheckBox();
| >| oCheckBox.Init(this, iRow, iCol);
| >| }
| >| }
| >|
| >| Everything works fine when I create the check box -- it
| >| does appear above the [iRow, iCol] cell, but it gets
| >| shifted as soon as I start scrolling the grid.
| >|
| >| 1. Did I choose the right approach for this?
| >| 2. Do I need to move my check box myself based on what
| >| happens with the grid?
| >| 3. If I do, what is the best approach for it?
| >|
| >| Any suggestions/comments are greatly appreciated!
| >|
| >| Thanks,
| >| VR
| >|
| >
| >.
| >
|

Nov 15 '05 #4
VR
Thanks Jeffery.

I did find your reply very helpful. In general I try post
a reply in the Newsgroup, thanking a contributor, but
since I am sort of new to the process, I wasn't sure
whether it's customary to thank people or it just forces
them to read yet another message from me. So, since I
didn't see a lot of thankful responses in other threads, I
assumed it's how the things are done.

I can see I could have been wrong and saying thanks never
hurts.

So, thanks again.

VR
-----Original Message-----

Hi VR,

To add a new row to datagrid, you can add a new row to the dataset and thenbind it to the datagrid.
To add control to the datagrid, there is a good sample here:http://support.microsoft.com/default.aspx? scid=http://support.microsoft.com:80/support/kb/articles/q323/1/67.asp&NoWebContent=1

This sample shows what you should do with the control when you scroll thedatagrid.

Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "VR" <Vi****************@gat.com>
| Sender: "VR" <Vi****************@gat.com>
| References: <02****************************@phx.gbl>
<gr*************@cpmsftngxa06.phx.gbl>
| Subject: RE: Customizing FlexGrid w/ a check box
| Date: Tue, 2 Sep 2003 09:41:53 -0700
| Lines: 131
| Message-ID: <08****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNxcR1ttCtiegKdRyO8kJjDNCH6vg==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:181603| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thanks, Jeffrey.
|
| My project is WinForm based and for some reason I am
| having a hard time catching scroll events. The reason I
| didn't use DataGrid is because I couldn't figure out how| to add/remove rows easily, or to set the number of
| rows/columns. Like this:
|
| gridFlex.Rows = 2;
| gridFlex.Cols = 3;
| gridFlex.AddItem("item");
| gridFlex.get_TextMatrix(1, 1);
|
| Are there any samples you could recomend for both
| MSFlexGrid and DataGrid (MSFlexGrid preferably) that would| show how to add different controls to grid's cells? Seems| like it's a fairly common technique, yet, I couldn't find| anything in MSDN on that.
|
| Thank for the help.
|
| VR
|
|
|
| >-----Original Message-----
| >
| >Hi VR,
| >
| >Is your project web based or winform based?
| >I think in .net, you can use DataGrid instead of using
| FlexGrid.
| >Because your checkbox's position was calculated at
| initialization time, you
| >should calculate again when the flexgrid was scrolling.
| >
| >Hope this helps.
| >
| >Best regards,
| >Jeffrey Tan
| >Microsoft Online Partner Support
| >Get Secure! - www.microsoft.com/security
| >This posting is provided "as is" with no warranties and| confers no rights.
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "VR" <Vi****************@gat.com>
| >| Sender: "VR" <Vi****************@gat.com>
| >| Subject: Customizing FlexGrid w/ a check box
| >| Date: Sat, 30 Aug 2003 19:02:42 -0700
| >| Lines: 58
| >| Message-ID: <02****************************@phx.gbl>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300| >| Thread-Index: AcNvY/alFamRgfAtRmm+AcYFCMvscA==
| >| Newsgroups: microsoft.public.dotnet.languages.csharp
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:181086
| >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| >| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| >|
| >| I am trying to embed a check box into a FlexGrid's
| cell,
| >| but having a problem when I start scrolling the grid.| >|
| >| Here is my MyCheckBox class...
| >|
| >| class MyCheckBox : CheckBox
| >| {
| >| void Init
| >| (
| >| AxMSFlexGridLib.AxMSFlexGrid oGrid,
| >| int iRow,
| >| int iCol
| >| )
| >| {
| >| ...
| >|
| >| this.Name = "GridCheckBox";
| >| this.TabIndex = 3;
| >|
| >| this.Text = "";
| >| this.CheckAlign =
| >| System.Drawing.ContentAlignment.MiddleCenter;| >|
| >| this.Top = ... // calculate based on iRow, iCol| >| this.Left = ... // calculate based on iRow, iCol| >| this.Height = ... // calculate based on iRow, iCol| >| this.Width = ... // calculate based on iRow, iCol| >|
| >| oGrid.Controls.Add(this);
| >| }
| >| }
| >|
| >| Whenever I need a checkbox in a grid's cell I create
| one
| >| and add it to the grid:
| >|
| >| class MyGrid : AxMSFlexGridLib.AxMSFlexGrid
| >| {
| >|
| >| void Foo()
| >| {
| >| MyCheckBox oCheckBox = new MyCheckBox();
| >| oCheckBox.Init(this, iRow, iCol);
| >| }
| >| }
| >|
| >| Everything works fine when I create the check box -- it| >| does appear above the [iRow, iCol] cell, but it gets
| >| shifted as soon as I start scrolling the grid.
| >|
| >| 1. Did I choose the right approach for this?
| >| 2. Do I need to move my check box myself based on what| >| happens with the grid?
| >| 3. If I do, what is the best approach for it?
| >|
| >| Any suggestions/comments are greatly appreciated!
| >|
| >| Thanks,
| >| VR
| >|
| >
| >.
| >
|

.

Nov 15 '05 #5

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

Similar topics

7
by: tombsy | last post by:
Hi gang... I want to have a form that can display data from a datasource that is not fixed. lets say a crosstab query that can change the number of colums and field headings depending on the...
9
by: JFB | last post by:
Hi All, I have a edit flexgrid, after to fill with different rows manually. How can I insert the rows of my flexgrid to my table (sql server) using ado.net? Any example? I can insert one row...
0
by: Xavier Valdés | last post by:
Hi all, I'm using component one's flexgrid (nonclassic) and I have a question... How could I drag and drop ROWS??? (from a component with my flexgrid and another component with flexgrid)...
3
by: Xavier Valdés | last post by:
Hi all, I'm using component one's flexgrid (nonclassic) and I have a question... How could I drag and drop ROWS??? (from a component with my flexgrid and another component with flexgrid)...
4
by: fripper | last post by:
I have replaced an older machine with a new one and have moved a VB .Net program that I worte on the old machine to the new one. The program uses a FlexGrid control for displaying some stuff in a...
5
by: schapopa | last post by:
I have a flex grid and I am loading data to this flex grid in this way While sqldr.Read j = j + 1 MSFlexGrid1PLSummary.set_TextMatrix(MSFlexGrid1PLSummary.Row, MSFlexGrid1PLSummary.Col,...
0
by: alexh1000 | last post by:
When I insert the FlexGrid control in a dialog (using controls toolbar) the dialog fails to open on program execution(DoModal returns a -1). If I remove the FlexGrid from the dialog, the dialog...
3
by: sweevil | last post by:
I'm converting a VB6 project to .Net2005. One of the items encountered was setting the cellpicture onto a flexgrid from an imagelist. The image background doesn't appear to render correctly. I...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.