473,473 Members | 4,189 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 6650

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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
1
isladogs
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.