Click here to Skip to main content
15,898,882 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: Add item to a listbox that is bind to a DataSource Pin
imak16-Apr-10 6:53
imak16-Apr-10 6:53 
GeneralRe: Add item to a listbox that is bind to a DataSource Pin
Dan Mos16-Apr-10 7:01
Dan Mos16-Apr-10 7:01 
GeneralRe: Add item to a listbox that is bind to a DataSource Pin
imak16-Apr-10 7:06
imak16-Apr-10 7:06 
GeneralRe: Add item to a listbox that is bind to a DataSource Pin
Dan Mos16-Apr-10 7:12
Dan Mos16-Apr-10 7:12 
QuestionGet Access 2007 window dimensions Pin
john john mackey16-Apr-10 5:49
john john mackey16-Apr-10 5:49 
AnswerRe: Get Access 2007 window dimensions Pin
john john mackey16-Apr-10 6:18
john john mackey16-Apr-10 6:18 
GeneralRe: Get Access 2007 window dimensions Pin
Luc Pattyn16-Apr-10 7:30
sitebuilderLuc Pattyn16-Apr-10 7:30 
QuestionFor Opecity of datagrid in windows Pin
Intigate15-Apr-10 3:55
Intigate15-Apr-10 3:55 
here i am pasting my code now i want that behind this datagrid i want to show some text that should be visible throw the datagrid and that text may be a only text or any label's text behind the datagrid.
so want my datagrid as transparent but i have tried. but not succeeded.
please help.



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class CheckItem : Form
{
public CheckItem()
{
InitializeComponent();
}


private DataTable Item = new DataTable("CheckItem");
private Label lbl = new Label();
private Label lbl5 = new Label();
//To drag The Form Without Border
#region"To drag The Form Without Border"
const int WM_NCHITTEST = 0x84;
const int HTCLIENT = 0x1;
const int HTCAPTION = 0x2;
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
if (m.Result.ToInt32() == HTCLIENT) m.Result = new IntPtr(HTCAPTION);
break;
default:
base.WndProc(ref m);
break;
}
}

#endregion

#region"private void CheckItem_Load"
private void CheckItem_Load(object sender, EventArgs e)
{
try
{

//Fixing the length and position of windows form.
Screen scr = Screen.PrimaryScreen;
//this.Left = (scr.WorkingArea.Width - this.Width) / 2;
//this.Top = (scr.WorkingArea.Height - this.Height) / 2;
this.MaximumSize = new Size(this.Width, this.Height);
this.MinimumSize = new Size(this.Width, this.Height);

// Label
#region"Label"
DataGridTableStyle dgStyle = new DataGridTableStyle();
dgStyle.HeaderBackColor = Color.Chocolate;
dgStyle.HeaderForeColor = Color.White;
dgStyle.HeaderFont = new Font("verdana", 8, FontStyle.Bold);
DataGridTextBoxColumn dgItemCode = new DataGridTextBoxColumn();
dgItemCode.ReadOnly = true;
dgItemCode.Width = 80;
DataGridTextBoxColumn dgItemName = new DataGridTextBoxColumn();
dgItemName.ReadOnly = true;
dgItemName.Width = 90;
DataGridTextBoxColumn dgRecivedQuantity = new DataGridTextBoxColumn();
dgRecivedQuantity.ReadOnly = true;
dgRecivedQuantity.Width = 130;
DataGridTextBoxColumn dgApproved = new DataGridTextBoxColumn();
dgApproved.Width = 80;
DataGridTextBoxColumn dgRejected = new DataGridTextBoxColumn();
dgRejected.Width = 80;
dgItemCode.HeaderText = "Item Code";
dgItemCode.MappingName = "ItemCode";

dgItemName.HeaderText = "Item Name";
dgItemName.MappingName = "ItemName";

dgRecivedQuantity.HeaderText = "Recived Quantity";
dgRecivedQuantity.MappingName = "RecivedQuantity";

dgApproved.HeaderText = "Approved";
dgApproved.MappingName = "Approved";

dgRejected.HeaderText = "Rejected";
dgRejected.MappingName = "Rejected";

#endregion

// Create temprarory datatable
#region"Create temprarory datatable"
DataTable Item = new DataTable();
DataRow dr;
Item.Columns.Add("ItemCode", typeof(string));
Item.Columns.Add("ItemName", typeof(string));
Item.Columns.Add("RecivedQuantity", typeof(Int32));
Item.Columns.Add("Approved", typeof(Int32));
Item.Columns.Add("Rejected", typeof(Int32));

//Add temp datas
dr = Item.NewRow();
dr["ItemCode"] = "I007";
dr["ItemName"] = "RAM";
dr["RecivedQuantity"] = 1344;
dr["Approved"] = 904;
dr["Rejected"] = 220;
Item.Rows.Add(dr);

dr = Item.NewRow();
dr["ItemCode"] = "I004";
dr["ItemName"] = "RM";
dr["RecivedQuantity"] = 10;
dr["Approved"] = 900;
dr["Rejected"] = 200;
Item.Rows.Add(dr);

dr = Item.NewRow();
dr["ItemCode"] = "I006";
dr["ItemName"] = "RAM";
dr["RecivedQuantity"] = 1000;
dr["Approved"] = 900;
dr["Rejected"] = 200;
Item.Rows.Add(dr);
#endregion

//Adding Label
#region"Adding Label"
Label lbl1 = new Label();
lbl1.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl1.BackColor = Color.White;
lbl1.Left = 50;
lbl1.Text = " ";
lbl1.ForeColor = Color.White;

Label lbl2 = new Label();
lbl2.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl2.Left = 50;
lbl2.Text = " ";
lbl2.ForeColor = Color.White;

Label lbl3 = new Label();
lbl3.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl3.Left = 50;
lbl3.Text = " ";
lbl3.ForeColor = Color.White;

//Label lbl = new Label();
lbl.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl.Text = "*";
lbl.Left = 50;
lbl.ForeColor = Color.Red;

//Label lbl5= new Label();
lbl5.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl5.Text = "*";
lbl5.Left = 50;
lbl5.ForeColor = Color.Red;

dgItemCode.TextBox.Controls.Add(lbl1);
dgApproved.TextBox.Controls.Add(lbl);
dgRejected.TextBox.Controls.Add(lbl5);
dgItemName.TextBox.Controls.Add(lbl2);
dgRecivedQuantity.TextBox.Controls.Add(lbl3);

dgStyle.GridColumnStyles.Add(dgItemCode);
dgStyle.GridColumnStyles.Add(dgItemName);
dgStyle.GridColumnStyles.Add(dgRecivedQuantity);
dgStyle.GridColumnStyles.Add(dgApproved);
dgStyle.GridColumnStyles.Add(dgRejected);

#endregion

dgStyle.PreferredRowHeight = 24;
dataGrid1.TableStyles.Add(dgStyle);

//binding datagrid
dataGrid1.BackColor = Color.Transparent;
dataGrid1.CaptionText = "Check Item";
dataGrid1.DataSource = Item;

//code for combox on pageload event
cmbPurchaseOrder.SelectedIndex = 0;
cmbVender.SelectedIndex = 0;
}
catch (Exception ex)
{
throw ex;
}

}
#endregion


#region"private void btnReset_Click"

private void btnReset_Click(object sender, EventArgs e)
{
cmbPurchaseOrder.SelectedIndex = 0;
cmbVender.SelectedIndex = 0;
BillOfMaterial frm = new BillOfMaterial();
frm.Show();
}
#endregion

#region"private void btnCancel_Click"

private void btnCancel_Click(object sender, EventArgs e)
{
this.Dispose();
}
#endregion

private void CheckItem_MouseMove(object sender, MouseEventArgs e)
{
lbl.Text = "*";
lbl.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl.Text = "*";
lbl.Left = 50;
lbl.ForeColor = Color.Red;

lbl5.Font = new Font("Verdana", 8, FontStyle.Bold);
lbl5.Text = "*";
lbl5.Left = 50;
lbl5.ForeColor = Color.Red;

}




}
}
AnswerRe: For Opecity of datagrid in windows Pin
Dave Kreskowiak15-Apr-10 5:21
mveDave Kreskowiak15-Apr-10 5:21 
QuestionFirst .Net project suggestions Pin
PROPZ_7614-Apr-10 4:25
PROPZ_7614-Apr-10 4:25 
AnswerRe: First .Net project suggestions Pin
Tarakeshwar Reddy14-Apr-10 5:43
professionalTarakeshwar Reddy14-Apr-10 5:43 
GeneralRe: First .Net project suggestions Pin
PROPZ_7615-Apr-10 3:33
PROPZ_7615-Apr-10 3:33 
GeneralRe: First .Net project suggestions [modified] Pin
Tarakeshwar Reddy15-Apr-10 5:14
professionalTarakeshwar Reddy15-Apr-10 5:14 
GeneralRe: First .Net project suggestions Pin
Luc Pattyn15-Apr-10 6:20
sitebuilderLuc Pattyn15-Apr-10 6:20 
GeneralRe: First .Net project suggestions Pin
Tarakeshwar Reddy15-Apr-10 6:37
professionalTarakeshwar Reddy15-Apr-10 6:37 
AnswerRe: First .Net project suggestions Pin
DaveyM6914-Apr-10 5:45
professionalDaveyM6914-Apr-10 5:45 
AnswerRe: First .Net project suggestions Pin
Som Shekhar14-Apr-10 7:16
Som Shekhar14-Apr-10 7:16 
AnswerRe: First .Net project suggestions Pin
darkelv15-Apr-10 19:26
darkelv15-Apr-10 19:26 
AnswerRe: First .Net project suggestions Pin
Ravi Bhavnani16-Apr-10 6:51
professionalRavi Bhavnani16-Apr-10 6:51 
QuestionHow to get details of users in active directories using LDAP Pin
roshankamath13-Apr-10 20:51
roshankamath13-Apr-10 20:51 
QuestionHelp with RTFTextBox: looking for nobr-equivalent Pin
chess777-Apr-10 4:43
chess777-Apr-10 4:43 
AnswerRe: Help with RTFTextBox: looking for nobr-equivalent Pin
Dave Kreskowiak9-Apr-10 18:23
mveDave Kreskowiak9-Apr-10 18:23 
AnswerRe: Help with RTFTextBox: looking for nobr-equivalent Pin
Luc Pattyn9-Apr-10 23:42
sitebuilderLuc Pattyn9-Apr-10 23:42 
QuestionTransparent control in Visual Basic 2008!!! Pin
Аslam Iqbal6-Apr-10 9:47
professionalАslam Iqbal6-Apr-10 9:47 
AnswerRe: Transparent control in Visual Basic 2008!!! Pin
Dave Kreskowiak6-Apr-10 9:59
mveDave Kreskowiak6-Apr-10 9:59 

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.