C#.Net 2003 windows programming
//Get mouse position in client coordinates
Point p = picBoxDrawingArea.PointToClient(Control.MousePosition);
//Get Mouse Position on screen
Control.MousePosition;
Friday, April 21, 2006
Work Related
C#.Net 2003 windows programming
//Get mouse position in client coordinates
Point p = picBoxDrawingArea.PointToClient(Control.MousePosition);
//Get Mouse Position on screen
Control.MousePosition;
//Get mouse position in client coordinates
Point p = picBoxDrawingArea.PointToClient(Control.MousePosition);
//Get Mouse Position on screen
Control.MousePosition;
Thursday, April 13, 2006
Work Related
Doing Custom DataGridTextBoxColumn in C#.Net
This Column, has a Centered Header, but contains right aligned numeric data. Also the background Colour is changed according to cell value.
private StringFormat m_strFormat = null;
public UCCustomColumn()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitializeComponent call
m_strFormat = new StringFormat();
m_strFormat.Alignment = StringAlignment.Far;
m_strFormat.Trimming = StringTrimming.None;
}
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
{
SolidBrush BackgroundBrush;
// Get value on current cell
double dValue = (double) this.GetColumnValueAtRow(source, rowNum);
string strValue = dValue.ToString(this.Format);
double dATValue,dUVValue;
if (rowNum ==0)
{
dATValue = (double)this.GetColumnValueAtRow(source, rowNum);
dUVValue = (double)this.GetColumnValueAtRow(source, rowNum+1);
}
else
{
dATValue = (double) this.GetColumnValueAtRow(source, rowNum-1);
dUVValue = (double)this.GetColumnValueAtRow(source, rowNum);
}
SolidBrush StrongBrush = new SolidBrush(Color.FromArgb(51,102,255));
SolidBrush MediumBrush = new SolidBrush(Color.FromArgb(153,204,255));
SolidBrush SoftBrush = new SolidBrush(Color.White);
if((dATValue >25.7) && (dUVValue >=3))
BackgroundBrush = StrongBrush;
else if((dATValue <=25.7) && (dUVValue >=3))
BackgroundBrush = MediumBrush;
else if((dATValue <=25.7) && (dUVValue <3))
BackgroundBrush = SoftBrush;
else
BackgroundBrush = SoftBrush;
g.FillRectangle(BackgroundBrush, bounds);
RectangleF CellBounds = new System.Drawing.RectangleF(bounds.Left, bounds.Top, bounds.Width, bounds.Height);
g.DrawString(strValue, this.DataGridTableStyle.DataGrid.Font, foreBrush, CellBounds, m_strFormat);
}
This Column, has a Centered Header, but contains right aligned numeric data. Also the background Colour is changed according to cell value.
private StringFormat m_strFormat = null;
public UCCustomColumn()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitializeComponent call
m_strFormat = new StringFormat();
m_strFormat.Alignment = StringAlignment.Far;
m_strFormat.Trimming = StringTrimming.None;
}
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
{
SolidBrush BackgroundBrush;
// Get value on current cell
double dValue = (double) this.GetColumnValueAtRow(source, rowNum);
string strValue = dValue.ToString(this.Format);
double dATValue,dUVValue;
if (rowNum ==0)
{
dATValue = (double)this.GetColumnValueAtRow(source, rowNum);
dUVValue = (double)this.GetColumnValueAtRow(source, rowNum+1);
}
else
{
dATValue = (double) this.GetColumnValueAtRow(source, rowNum-1);
dUVValue = (double)this.GetColumnValueAtRow(source, rowNum);
}
SolidBrush StrongBrush = new SolidBrush(Color.FromArgb(51,102,255));
SolidBrush MediumBrush = new SolidBrush(Color.FromArgb(153,204,255));
SolidBrush SoftBrush = new SolidBrush(Color.White);
if((dATValue >25.7) && (dUVValue >=3))
BackgroundBrush = StrongBrush;
else if((dATValue <=25.7) && (dUVValue >=3))
BackgroundBrush = MediumBrush;
else if((dATValue <=25.7) && (dUVValue <3))
BackgroundBrush = SoftBrush;
else
BackgroundBrush = SoftBrush;
g.FillRectangle(BackgroundBrush, bounds);
RectangleF CellBounds = new System.Drawing.RectangleF(bounds.Left, bounds.Top, bounds.Width, bounds.Height);
g.DrawString(strValue, this.DataGridTableStyle.DataGrid.Font, foreBrush, CellBounds, m_strFormat);
}
Monday, April 03, 2006
Work related
How to open PDF file programmatically in windows c#.Net
Solution 1
Use Process.Start()
Solution 2
host the web browser control in the C# application and
load this .pdf file into the browser control.
Note:
I haven't tried solution 2
Solution 1
Use Process.Start()
Solution 2
host the web browser control in the C# application and
load this .pdf file into the browser control.
Note:
I haven't tried solution 2
Saturday, August 27, 2005
New meaning of blog
To be honest, I don't like the format of this blog I can't group things, unlike my friendster blog. I can even add new catagory there
That's the reason I rarely update this blog of mine. I almost forgot my user account and password.
I think it's time to change my Blog name, and the purpose of having it. It's no longger story of my life. Cause I didn't tell much of if in this blog.
I haven't decided yet, but I'll find something else to fill this site.
That's the reason I rarely update this blog of mine. I almost forgot my user account and password.
I think it's time to change my Blog name, and the purpose of having it. It's no longger story of my life. Cause I didn't tell much of if in this blog.
I haven't decided yet, but I'll find something else to fill this site.
Friday, April 22, 2005
Subscribe to:
Posts (Atom)













