Click here to Skip to main content
15,888,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: Scroll Bar hogging focus Pin
John Fisher27-May-05 6:13
John Fisher27-May-05 6:13 
GeneralRe: Scroll Bar hogging focus Pin
rocky_pulley27-May-05 7:52
rocky_pulley27-May-05 7:52 
GeneralRe: Scroll Bar hogging focus Pin
John Fisher27-May-05 10:45
John Fisher27-May-05 10:45 
GeneralWindows.Forms.DataGrid Pin
Reinier Beeckman27-May-05 3:42
Reinier Beeckman27-May-05 3:42 
GeneralRe: Windows.Forms.DataGrid Pin
Alomgir Miah27-May-05 4:17
Alomgir Miah27-May-05 4:17 
GeneralRe: Windows.Forms.DataGrid Pin
Reinier Beeckman27-May-05 4:31
Reinier Beeckman27-May-05 4:31 
GeneralRe: Windows.Forms.DataGrid Pin
Alomgir Miah27-May-05 7:53
Alomgir Miah27-May-05 7:53 
GeneralRe: Windows.Forms.DataGrid Pin
Alomgir Miah27-May-05 8:25
Alomgir Miah27-May-05 8:25 
mgir Miahusing System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace BoolColumn
{
///
/// Summary description for Form1.
///

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private ArrayList dataSource = null;
private DataGridTableStyle dataGridTableStyle = null;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

this.InitializeDataSource();

this.InitializeGrid();
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(416, 238);
this.dataGrid1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(416, 238);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dataGrid1});
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}


private void InitializeDataSource()
{
dataSource = new ArrayList();
dataSource.Add(new Source());
dataSource.Add(new Source());
dataSource.Add(new Source());
dataSource.Add(new Source());

this.dataGrid1.DataSource = dataSource;
}


private void InitializeGrid()
{
this.dataGridTableStyle = new DataGridTableStyle();
this.dataGridTableStyle.MappingName = "ArrayList";

DataGridBoolColumnEx col = new DataGridBoolColumnEx();
col.AllowNull = false;
col.MappingName = "X";
this.dataGridTableStyle.GridColumnStyles.Add(col);

this.dataGrid1.TableStyles.Clear();
this.dataGrid1.TableStyles.Add(dataGridTableStyle);
}
}

public class Source
{
bool x = false;
public bool X
{
get
{
return x;
}
set
{
this.x = value;
}
}
}

///
/// Summary description for BoolColumnEx.
///

public class DataGridBoolColumnEx: DataGridBoolColumn
{
public DataGridBoolColumnEx()
{
}

protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
object obj = this.GetColumnValueAtRow(source,rowNum);

//check if the value is DBNull,if it is, according to the
//default behavior set it to false
if ( !(obj is System.DBNull) )
{
this.SetColumnValueAtRow (source,rowNum,!(Boolean) obj);
}
else this.SetColumnValueAtRow(source,rowNum,false);
base.Edit(source,rowNum,bounds,readOnly, instantText, cellIsVisible);
}
}
}
Generalmscorlib.xml Pin
zuschauer198027-May-05 1:39
zuschauer198027-May-05 1:39 
GeneralTool to convert from Ms Access Database to MYSQL Database Pin
rockxuyenmandem27-May-05 1:27
rockxuyenmandem27-May-05 1:27 
GeneralRe: Tool to convert from Ms Access Database to MYSQL Database Pin
Member 157708727-May-05 2:39
Member 157708727-May-05 2:39 
QuestionConfig file in dll project? Pin
davebarkshire27-May-05 1:08
davebarkshire27-May-05 1:08 
AnswerRe: Config file in dll project? Pin
DavidNohejl27-May-05 2:31
DavidNohejl27-May-05 2:31 
AnswerRe: Config file in dll project? Pin
Dave Kreskowiak27-May-05 2:33
mveDave Kreskowiak27-May-05 2:33 
GeneralSmall UI prob Pin
Niklas Ulvinge27-May-05 0:56
Niklas Ulvinge27-May-05 0:56 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 4:37
John Fisher27-May-05 4:37 
GeneralRe: Small UI prob Pin
Niklas Ulvinge27-May-05 4:47
Niklas Ulvinge27-May-05 4:47 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 6:16
John Fisher27-May-05 6:16 
GeneralRe: Small UI prob Pin
Niklas Ulvinge27-May-05 6:23
Niklas Ulvinge27-May-05 6:23 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 6:36
John Fisher27-May-05 6:36 
GeneralRe: Small UI prob Pin
Niklas Ulvinge27-May-05 6:40
Niklas Ulvinge27-May-05 6:40 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 10:44
John Fisher27-May-05 10:44 
GeneralStatic class Pin
LIUCKAS27-May-05 0:01
LIUCKAS27-May-05 0:01 
GeneralRe: Static class Pin
User 665827-May-05 0:37
User 665827-May-05 0:37 
GeneralRe: Static class Pin
Andrew Kirillov27-May-05 0:37
Andrew Kirillov27-May-05 0:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.