C# WinApp ปัญหาการใส่ค่าใน property ของ User control ใน datagrid ครับ
สืบเนื่องจาก http://www.thaicreate.com/dotnet/forum/124673.html
ผมลองเอามาใช้กับ Datagridview
ปรากฎว่าไม่ได้ผลครับ
ปัญหาคือ
กำหนดค่า SelectedMode แล้ว แต่พอรัน จะกลายเป็น colorDialog ตลอดเลยครับ
ตอนนี้แก้ปัญหาโดยการตั้งค่าใน form แบบนี้ครับ
Code (C#)
private void Form2_Load(object sender, EventArgs e)
{
this.Column1.SelectedMode = TORServices.Forms.Datagridview.DataGridViewFilePathColumn.SelectedPathType.openFileDialog;
}
นี่คือโค้ดที่เป็นปัญหาครับ
Code (C#)
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TORServices.Forms.Datagridview
{
#region _DataGridViewFilePathColumn
/// <summary>
/// Hosts a collection of DataGridViewTextBoxCell cells.
/// </summary>
public class DataGridViewFilePathColumn : System.Windows.Forms.DataGridViewColumn
{
private bool showBrowseButton;
[System.ComponentModel.Browsable(true)]
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Category("Appearance")]
[System.ComponentModel.Description("Show a button in each cell for browsing for files.")]
public enum SelectedPathType { colorDialog, folderBrowserDialog, fontDialog, openFileDialog, saveFileDialog }
public bool ShowBrowseButton
{
get { return showBrowseButton; }
set
{
showBrowseButton = value;
}
}
private bool useOpenFileDialogOnButtonClick;
[System.ComponentModel.Browsable(true)]
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
// [System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Category("Behavior")]
// [System.ComponentModel.Description("OpenFileDialog is dispalyed and on success the contents of the Cell is replaced with the new file path.")]
public bool UseOpenFileDialogOnButtonClick
{
get { return useOpenFileDialogOnButtonClick; }
set
{
useOpenFileDialogOnButtonClick = value;
}
}
private SelectedPathType _selected;
[System.ComponentModel.Browsable(true)]
//[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(SelectedPathType.openFileDialog)]
[System.ComponentModel.Category("Behavior")]
[System.ComponentModel.Description("Open File or Folder Dialog is dispalyed and on success the contents of the Cell is replaced with the new path.")]
public SelectedPathType SelectedMode
{
get { return _selected; }
set
{
_selected = value;
}
}
public DataGridViewFilePathColumn()
: base(new DataGridViewFilePathCell())
{
}
public override System.Windows.Forms.DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (null != value &&
!value.GetType().IsAssignableFrom(typeof(DataGridViewFilePathCell)))
{
throw new InvalidCastException("must be a DataGridViewFilePathCell");
}
base.CellTemplate = value;
}
}
}
/// <summary>
/// Displays editable text information in a DataGridView control. Uses
/// PathEllipsis formatting if the column is smaller than the width of a
/// displayed filesystem path.
/// </summary>
public class DataGridViewFilePathCell : DataGridViewLinkCell
{
Button browseButton;
Dictionary<Color, SolidBrush> brushes = new Dictionary<Color, SolidBrush>();
protected virtual SolidBrush GetCachedBrush(Color color)
{
if (this.brushes.ContainsKey(color))
return this.brushes[color];
SolidBrush brush = new SolidBrush(color);
this.brushes.Add(color, brush);
return brush;
}
protected virtual bool RightToLeftInternal
{
get
{
return this.DataGridView.RightToLeft == RightToLeft.Yes;
}
}
protected override void OnClick(DataGridViewCellEventArgs e)
{
base.OnClick(e);
if (this.DataGridView.CurrentCell == this)
{
string _Value = Convert.ToString(base.Value);
DataGridViewFilePathColumn filePathColumn = (DataGridViewFilePathColumn)this.DataGridView.Columns[ColumnIndex];
if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.openFileDialog)
{
if (!System.IO.File.Exists(_Value))
{ MessageBox.Show("ไม่พบ " + _Value); }
else
{ System.Diagnostics.Process.Start(_Value); }
}
if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.folderBrowserDialog)
{
if (!System.IO.Directory.Exists(_Value))
{ MessageBox.Show("ไม่พบ " + _Value); }
else
{ System.Diagnostics.Process.Start(_Value); }
}
}
}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
if (cellStyle == null) { throw new ArgumentNullException("cellStyle"); }
this.PaintPrivate(graphics, clipBounds, cellBounds, rowIndex, cellState, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
}
protected Rectangle PaintPrivate(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
System.Diagnostics.Debug.WriteLine(string.Format("Painting Cell row {0} for rowindex {2} with rectangle {1}", this.RowIndex, cellBounds, rowIndex));
SolidBrush cachedBrush;
Rectangle empty = Rectangle.Empty;
if (((paintParts & DataGridViewPaintParts.Border) != DataGridViewPaintParts.None)) { this.PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle); }
Rectangle rectangle2 = this.BorderWidths(advancedBorderStyle);
Rectangle borderedCellRectangle = cellBounds;
borderedCellRectangle.Offset(rectangle2.X, rectangle2.Y);
borderedCellRectangle.Width -= rectangle2.Right;
borderedCellRectangle.Height -= rectangle2.Bottom;
Point currentCellAddress = base.DataGridView.CurrentCellAddress;
bool isFirstCell = (currentCellAddress.X == base.ColumnIndex) && (currentCellAddress.Y == rowIndex);
bool flagisFirstCellAndNotEditing = isFirstCell && (base.DataGridView.EditingControl != null);
bool thisCellIsSelected = (cellState & DataGridViewElementStates.Selected) != DataGridViewElementStates.None;
cachedBrush = ((((paintParts & DataGridViewPaintParts.SelectionBackground) != DataGridViewPaintParts.None) && thisCellIsSelected) && !flagisFirstCellAndNotEditing) ? GetCachedBrush(cellStyle.SelectionBackColor) : GetCachedBrush(cellStyle.BackColor);
if (((((paintParts & DataGridViewPaintParts.Background) != DataGridViewPaintParts.None)) && ((cachedBrush.Color.A == 0xff) && (borderedCellRectangle.Width > 0))) && (borderedCellRectangle.Height > 0))
{
graphics.FillRectangle(cachedBrush, borderedCellRectangle);
}
if (cellStyle.Padding != Padding.Empty)
{
if (RightToLeftInternal)
{
borderedCellRectangle.Offset(cellStyle.Padding.Right, cellStyle.Padding.Top);
}
else
{
borderedCellRectangle.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top);
}
borderedCellRectangle.Width -= cellStyle.Padding.Horizontal;
borderedCellRectangle.Height -= cellStyle.Padding.Vertical;
}
if (((isFirstCell) && (!flagisFirstCellAndNotEditing && ((paintParts & DataGridViewPaintParts.Focus) != DataGridViewPaintParts.None))) && ((ShowFocusCues && base.DataGridView.Focused) && ((borderedCellRectangle.Width > 0) && (borderedCellRectangle.Height > 0))))
{
ControlPaint.DrawFocusRectangle(graphics, borderedCellRectangle, Color.Empty, cachedBrush.Color);
}
Rectangle cellValueBounds = borderedCellRectangle;
string text = formattedValue as string;
if ((text != null) && (!flagisFirstCellAndNotEditing))
{
int y = (cellStyle.WrapMode == DataGridViewTriState.True) ? 1 : 2;
borderedCellRectangle.Offset(0, y);
borderedCellRectangle.Width = borderedCellRectangle.Width;
borderedCellRectangle.Height -= y + 1;
if ((borderedCellRectangle.Width > 0) && (borderedCellRectangle.Height > 0))
{
TextFormatFlags flags = TextFormatFlags.PathEllipsis;
if (((paintParts & DataGridViewPaintParts.ContentForeground) != DataGridViewPaintParts.None))
{
if ((flags & TextFormatFlags.SingleLine) != TextFormatFlags.GlyphOverhangPadding) { flags |= TextFormatFlags.EndEllipsis; }
DataGridViewFilePathColumn filePathColumn = (DataGridViewFilePathColumn)this.DataGridView.Columns[ColumnIndex];
if (this.RowIndex >= 0)
{
bool changed = false;
if ((browseButton.Width != System.Math.Max(10, borderedCellRectangle.Width / 4)) && (browseButton.Width != 20))
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton Width was incorrect:{0} for given rectangle:{1}", browseButton.Width, borderedCellRectangle));
browseButton.Width = System.Math.Max(10, borderedCellRectangle.Width / 4);
browseButton.Width = System.Math.Min(browseButton.Width, 20);
changed = true;
}
if (browseButton.Height != (borderedCellRectangle.Height + 4))
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton Height was incorrect:{0} for given rectangle:{1}", browseButton.Height, borderedCellRectangle));
browseButton.Height = borderedCellRectangle.Height + 4;
changed = true;
}
Point loc = new Point();
loc.X = borderedCellRectangle.X + borderedCellRectangle.Width - browseButton.Width;
loc.Y = borderedCellRectangle.Y - 4;
if (browseButton.Location != loc)
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton location was incorrect:{0} for given rectangle:{1} with loc: {2}", browseButton.Location, borderedCellRectangle, loc));
browseButton.Location = loc;
changed = true;
}
if (changed)
browseButton.Invalidate();
if (!this.DataGridView.Controls.Contains(browseButton))
this.DataGridView.Controls.Add(browseButton);
borderedCellRectangle.Width -= browseButton.Width;
}
}
TextRenderer.DrawText(graphics, text, cellStyle.Font, borderedCellRectangle, thisCellIsSelected ? cellStyle.SelectionForeColor : cellStyle.ForeColor, flags);
}
}
if ((base.DataGridView.ShowCellErrors) && ((paintParts & DataGridViewPaintParts.ErrorIcon) != DataGridViewPaintParts.None))
{
if ((!string.IsNullOrEmpty(errorText) && (cellValueBounds.Width >= 20)) && (cellValueBounds.Height >= 0x13))
{
Rectangle iconBounds = this.GetErrorIconBounds(graphics, cellStyle, rowIndex);
if ((iconBounds.Width >= 4) && (iconBounds.Height >= 11))
{
iconBounds.X += cellBounds.X;
iconBounds.Y += cellBounds.Y;
Bitmap errorBitmap = new Bitmap(typeof(DataGridViewCell), "DataGridViewRow.error.bmp");
errorBitmap.MakeTransparent();
if (errorBitmap != null)
{
lock (errorBitmap)
{
graphics.DrawImage(errorBitmap, iconBounds, 0, 0, 12, 11, GraphicsUnit.Pixel);
}
}
}
}
}
return empty;
}
public bool ShowFocusCues
{
get { return true; }
}
protected bool ApplyVisualStylesToHeaders
{
get
{
if (Application.RenderWithVisualStyles)
{
return this.DataGridView.EnableHeadersVisualStyles;
}
return false;
}
}
private void DataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (base.Value.ToString().Length > 0)
{
System.Diagnostics.Process.Start(base.Value.ToString());
}
}
void browseButton_Click(object sender, EventArgs e)
{
DataGridViewFilePathColumn filePathColumn = (DataGridViewFilePathColumn)this.DataGridView.Columns[ColumnIndex];
try
{
if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.openFileDialog)
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.FileName.ToString();
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.folderBrowserDialog)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.SelectedPath;
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.colorDialog)
{
ColorDialog dialog = new ColorDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.Color.ToString() + ":"
+ dialog.Color.Name.ToString()
+ ": A=" + dialog.Color.A + " R=" + dialog.Color.R + " G=" + dialog.Color.G + " B=" + dialog.Color.B;
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.fontDialog)
{
FontDialog dialog = new FontDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.Font.ToString();
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.saveFileDialog)
{
SaveFileDialog dialog = new SaveFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.FileName;
}
}
}
catch (Exception)
{
}
}
public DataGridViewFilePathCell()
: base()
{
browseButton = new Button();
browseButton.Text = "…";
browseButton.Click += new EventHandler(browseButton_Click);
}
}
#endregion
}
Tag : .NET, Win (Windows App), C#, Windows
Date :
2016-09-22 11:08:44
By :
lamaka.tor
View :
2716
Reply :
22
ลองเพิ่มตรงนี้ดูครับ
ไม่รู้ว่าตรงใจไหม
public DataGridViewFilePathColumn()
: base(new DataGridViewFilePathCell())
{
_selected = SelectedPathType.openFileDialog;
}
Date :
2016-09-22 13:21:50
By :
fonfire
+55555 (ปัญหาคือจะใส่ตรงไหนล่ะ)
Code (C#)
public override object Clone()
{
//Default return base.Clone();
//...
//...
/...
yourColumns cell = base.Clone() as yourColumns ;
if (cell != null) {
cell.yourVar = XXXXX;
}
return cell;
}
Date :
2016-09-22 20:02:25
By :
หน้าฮี
Date :
2016-09-23 10:01:42
By :
lamaka.tor
ดันๆๆๆ
Date :
2016-09-25 20:03:22
By :
lamaka.tor
ลอง return ค่า SelectedPathType หรือ ลอง debug ดูว่ามันเปลี่ยนแปลงตอนไหน
Date :
2016-09-25 22:11:19
By :
bigsuntat
จาก +55555 ข้างบน (ป่านนี้หอยเน่าไปแล้วมั้ง)
Code (C#)
public enum SelectedPathType { colorDialog, folderBrowserDialog, fontDialog, openFileDialog, saveFileDialog }
public bool ShowBrowseButton
{
get { return showBrowseButton; }
set
{
showBrowseButton = value;
}
}
public override object Clone()
{
var หอยงาม = base.Clone() as DataGridViewFilePathColumn ;
if (หอยงาม != null)
{
หอยงาม.SelectedMode = _selected;
}
return หอยงาม;
}
Date :
2016-09-26 09:09:50
By :
หน้าฮี
ก่อนจะไปถึงจุดนั้น "แต่ผมต้องเอา clone ไปทำไงต่อครับ"
ลองย่อปัญหาให้เล็กลง
1. สร้างโปรเจ็คใหม่ Windows Forms (รับประกันความสะอาด SourceCode ของคุณ)
2. สร้าง Class
3. ลาก DataGridView มาวางบนฟอร์ม กำหนดค่า SelectedMode
4. Clean Solution
5. Build Solution
6. Run (F5)
ข้อที่ 2.
Code (C#)
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace dgvCustomColumn //Assembly Name หรือ Root NameSpace
{
#region _DataGridViewFilePathColumn
/// <summary>
/// Hosts a collection of DataGridViewTextBoxCell cells.
/// </summary>
public class DataGridViewFilePathColumn : System.Windows.Forms.DataGridViewColumn
{
private bool showBrowseButton;
[System.ComponentModel.Browsable(true)]
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Category("Appearance")]
[System.ComponentModel.Description("Show a button in each cell for browsing for files.")]
public enum SelectedPathType { colorDialog, folderBrowserDialog, fontDialog, openFileDialog, saveFileDialog }
public bool ShowBrowseButton
{
get { return showBrowseButton; }
set
{
showBrowseButton = value;
}
}
public override object Clone()
{
var หอยงาม = base.Clone() as DataGridViewFilePathColumn ;
DataGridViewFilePathColumn xxx = base.Clone() as DataGridViewFilePathColumn;
if (หอยงาม != null)
{
หอยงาม.SelectedMode = _selected;
}
return หอยงาม;
}
private bool useOpenFileDialogOnButtonClick;
[System.ComponentModel.Browsable(true)]
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
// [System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Category("Behavior")]
// [System.ComponentModel.Description("OpenFileDialog is dispalyed and on success the contents of the Cell is replaced with the new file path.")]
public bool UseOpenFileDialogOnButtonClick
{
get { return useOpenFileDialogOnButtonClick; }
set
{
useOpenFileDialogOnButtonClick = value;
}
}
private SelectedPathType _selected;
[System.ComponentModel.Browsable(true)]
//[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(SelectedPathType.openFileDialog)]
[System.ComponentModel.Category("Behavior")]
[System.ComponentModel.Description("Open File or Folder Dialog is dispalyed and on success the contents of the Cell is replaced with the new path.")]
public SelectedPathType SelectedMode
{
get { return _selected; }
set
{
_selected = value;
}
}
public DataGridViewFilePathColumn()
: base(new DataGridViewFilePathCell())
{
}
public override System.Windows.Forms.DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (null != value &&
!value.GetType().IsAssignableFrom(typeof(DataGridViewFilePathCell)))
{
throw new InvalidCastException("must be a DataGridViewFilePathCell");
}
base.CellTemplate = value;
}
}
}
/// <summary>
/// Displays editable text information in a DataGridView control. Uses
/// PathEllipsis formatting if the column is smaller than the width of a
/// displayed filesystem path.
/// </summary>
public class DataGridViewFilePathCell : DataGridViewLinkCell
{
Button browseButton;
Dictionary<Color, SolidBrush> brushes = new Dictionary<Color, SolidBrush>();
protected virtual SolidBrush GetCachedBrush(Color color)
{
if (this.brushes.ContainsKey(color))
return this.brushes[color];
SolidBrush brush = new SolidBrush(color);
this.brushes.Add(color, brush);
return brush;
}
protected virtual bool RightToLeftInternal
{
get
{
return this.DataGridView.RightToLeft == RightToLeft.Yes;
}
}
protected override void OnClick(DataGridViewCellEventArgs e)
{
base.OnClick(e);
if (this.DataGridView.CurrentCell == this)
{
string _Value = Convert.ToString(base.Value);
DataGridViewFilePathColumn filePathColumn = (DataGridViewFilePathColumn)this.DataGridView.Columns[ColumnIndex];
if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.openFileDialog)
{
if (!System.IO.File.Exists(_Value))
{ MessageBox.Show("ไม่พบ " + _Value); }
else
{ System.Diagnostics.Process.Start(_Value); }
}
if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.folderBrowserDialog)
{
if (!System.IO.Directory.Exists(_Value))
{ MessageBox.Show("ไม่พบ " + _Value); }
else
{ System.Diagnostics.Process.Start(_Value); }
}
}
}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
if (cellStyle == null) { throw new ArgumentNullException("cellStyle"); }
this.PaintPrivate(graphics, clipBounds, cellBounds, rowIndex, cellState, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
}
protected Rectangle PaintPrivate(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
System.Diagnostics.Debug.WriteLine(string.Format("Painting Cell row {0} for rowindex {2} with rectangle {1}", this.RowIndex, cellBounds, rowIndex));
SolidBrush cachedBrush;
Rectangle empty = Rectangle.Empty;
if (((paintParts & DataGridViewPaintParts.Border) != DataGridViewPaintParts.None)) { this.PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle); }
Rectangle rectangle2 = this.BorderWidths(advancedBorderStyle);
Rectangle borderedCellRectangle = cellBounds;
borderedCellRectangle.Offset(rectangle2.X, rectangle2.Y);
borderedCellRectangle.Width -= rectangle2.Right;
borderedCellRectangle.Height -= rectangle2.Bottom;
Point currentCellAddress = base.DataGridView.CurrentCellAddress;
bool isFirstCell = (currentCellAddress.X == base.ColumnIndex) && (currentCellAddress.Y == rowIndex);
bool flagisFirstCellAndNotEditing = isFirstCell && (base.DataGridView.EditingControl != null);
bool thisCellIsSelected = (cellState & DataGridViewElementStates.Selected) != DataGridViewElementStates.None;
cachedBrush = ((((paintParts & DataGridViewPaintParts.SelectionBackground) != DataGridViewPaintParts.None) && thisCellIsSelected) && !flagisFirstCellAndNotEditing) ? GetCachedBrush(cellStyle.SelectionBackColor) : GetCachedBrush(cellStyle.BackColor);
if (((((paintParts & DataGridViewPaintParts.Background) != DataGridViewPaintParts.None)) && ((cachedBrush.Color.A == 0xff) && (borderedCellRectangle.Width > 0))) && (borderedCellRectangle.Height > 0))
{
graphics.FillRectangle(cachedBrush, borderedCellRectangle);
}
if (cellStyle.Padding != Padding.Empty)
{
if (RightToLeftInternal)
{
borderedCellRectangle.Offset(cellStyle.Padding.Right, cellStyle.Padding.Top);
}
else
{
borderedCellRectangle.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top);
}
borderedCellRectangle.Width -= cellStyle.Padding.Horizontal;
borderedCellRectangle.Height -= cellStyle.Padding.Vertical;
}
if (((isFirstCell) && (!flagisFirstCellAndNotEditing && ((paintParts & DataGridViewPaintParts.Focus) != DataGridViewPaintParts.None))) && ((ShowFocusCues && base.DataGridView.Focused) && ((borderedCellRectangle.Width > 0) && (borderedCellRectangle.Height > 0))))
{
ControlPaint.DrawFocusRectangle(graphics, borderedCellRectangle, Color.Empty, cachedBrush.Color);
}
Rectangle cellValueBounds = borderedCellRectangle;
string text = formattedValue as string;
if ((text != null) && (!flagisFirstCellAndNotEditing))
{
int y = (cellStyle.WrapMode == DataGridViewTriState.True) ? 1 : 2;
borderedCellRectangle.Offset(0, y);
borderedCellRectangle.Width = borderedCellRectangle.Width;
borderedCellRectangle.Height -= y + 1;
if ((borderedCellRectangle.Width > 0) && (borderedCellRectangle.Height > 0))
{
TextFormatFlags flags = TextFormatFlags.PathEllipsis;
if (((paintParts & DataGridViewPaintParts.ContentForeground) != DataGridViewPaintParts.None))
{
if ((flags & TextFormatFlags.SingleLine) != TextFormatFlags.GlyphOverhangPadding) { flags |= TextFormatFlags.EndEllipsis; }
DataGridViewFilePathColumn filePathColumn = (DataGridViewFilePathColumn)this.DataGridView.Columns[ColumnIndex];
if (this.RowIndex >= 0)
{
bool changed = false;
if ((browseButton.Width != System.Math.Max(10, borderedCellRectangle.Width / 4)) && (browseButton.Width != 20))
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton Width was incorrect:{0} for given rectangle:{1}", browseButton.Width, borderedCellRectangle));
browseButton.Width = System.Math.Max(10, borderedCellRectangle.Width / 4);
browseButton.Width = System.Math.Min(browseButton.Width, 20);
changed = true;
}
if (browseButton.Height != (borderedCellRectangle.Height + 4))
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton Height was incorrect:{0} for given rectangle:{1}", browseButton.Height, borderedCellRectangle));
browseButton.Height = borderedCellRectangle.Height + 4;
changed = true;
}
Point loc = new Point();
loc.X = borderedCellRectangle.X + borderedCellRectangle.Width - browseButton.Width;
loc.Y = borderedCellRectangle.Y - 4;
if (browseButton.Location != loc)
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton location was incorrect:{0} for given rectangle:{1} with loc: {2}", browseButton.Location, borderedCellRectangle, loc));
browseButton.Location = loc;
changed = true;
}
if (changed)
browseButton.Invalidate();
if (!this.DataGridView.Controls.Contains(browseButton))
this.DataGridView.Controls.Add(browseButton);
borderedCellRectangle.Width -= browseButton.Width;
}
}
TextRenderer.DrawText(graphics, text, cellStyle.Font, borderedCellRectangle, thisCellIsSelected ? cellStyle.SelectionForeColor : cellStyle.ForeColor, flags);
}
}
if ((base.DataGridView.ShowCellErrors) && ((paintParts & DataGridViewPaintParts.ErrorIcon) != DataGridViewPaintParts.None))
{
if ((!string.IsNullOrEmpty(errorText) && (cellValueBounds.Width >= 20)) && (cellValueBounds.Height >= 0x13))
{
Rectangle iconBounds = this.GetErrorIconBounds(graphics, cellStyle, rowIndex);
if ((iconBounds.Width >= 4) && (iconBounds.Height >= 11))
{
iconBounds.X += cellBounds.X;
iconBounds.Y += cellBounds.Y;
Bitmap errorBitmap = new Bitmap(typeof(DataGridViewCell), "DataGridViewRow.error.bmp");
errorBitmap.MakeTransparent();
if (errorBitmap != null)
{
lock (errorBitmap)
{
graphics.DrawImage(errorBitmap, iconBounds, 0, 0, 12, 11, GraphicsUnit.Pixel);
}
}
}
}
}
return empty;
}
public bool ShowFocusCues
{
get { return true; }
}
protected bool ApplyVisualStylesToHeaders
{
get
{
if (Application.RenderWithVisualStyles)
{
return this.DataGridView.EnableHeadersVisualStyles;
}
return false;
}
}
private void DataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (base.Value.ToString().Length > 0)
{
System.Diagnostics.Process.Start(base.Value.ToString());
}
}
void browseButton_Click(object sender, EventArgs e)
{
DataGridViewFilePathColumn filePathColumn = (DataGridViewFilePathColumn)this.DataGridView.Columns[ColumnIndex];
try
{
if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.openFileDialog)
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.FileName.ToString();
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.folderBrowserDialog)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.SelectedPath;
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.colorDialog)
{
ColorDialog dialog = new ColorDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.Color.ToString() + ":"
+ dialog.Color.Name.ToString()
+ ": A=" + dialog.Color.A + " R=" + dialog.Color.R + " G=" + dialog.Color.G + " B=" + dialog.Color.B;
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.fontDialog)
{
FontDialog dialog = new FontDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.Font.ToString();
}
}
else if (filePathColumn.SelectedMode == DataGridViewFilePathColumn.SelectedPathType.saveFileDialog)
{
SaveFileDialog dialog = new SaveFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.FileName;
}
}
}
catch (Exception)
{
}
}
public DataGridViewFilePathCell()
: base()
{
browseButton = new Button();
browseButton.Text = "…";
browseButton.Click += new EventHandler(browseButton_Click);
}
}
#endregion
}
ตัวอย่างที่สำเร็จเสมอ โดยหน้าฮี
ปล. ผมแค่กวาดสายตาผ่านฯ Sourcecode ผมก็รู้แล้ว
Date :
2016-09-26 10:38:48
By :
หน้าฮี
จาก #NO11 ผมลืมบอกไปว่า ผมใช้ VS2013 Update 5 ในการทดสอบ (ใช้ทำงานจริง)
Date :
2016-09-26 10:44:03
By :
หน้าฮี
colorDialog, folderBrowserDialog, fontDialog, saveFileDialog ได้ครับ
แต่ openFileDialog ยังกลับมาเป็น colorDialog เหมือนเดิม
ปล. เกิดความสงสัยครับ
1. ทำไมเราเพิ่มแค่ Clone() ก็ใช้ได้รึครับ
2. แบบนี้ถ้าเราจะเพิ่ม property ต่างๆลงไป หลังจากเพิ่มโค้ดใน Clone() แบบนี้ ใช้ได้
กับทุก property ทุกอย่างเลยใช่ไม๊ครับ
Code (C#)
public override object Clone()
{
var clm = base.Clone() as DataGridViewFilePathColumn;
DataGridViewFilePathColumn xxx = base.Clone() as DataGridViewFilePathColumn;
if (clm != null)
{
clm.SelectedMode = _selected;
clm.ShowBrowseButton = showBrowseButton;
}
return clm;
}
Date :
2016-09-26 13:04:24
By :
lamaka.tor
ทุกอันได้หมดยกเว้น openFileDialog ---> colorDialog
"แต่ openFileDialog ยังกลับมาเป็น colorDialog เหมือนเดิม" (ผมรู้ตั้งแต่แรกแล้วและขอปรบมือให้ +55555 )
ผมดีใจนะที่คุณหาเจอ (น้อยคนนักที่จะหาเจอ อาจเป็นเพราะความพยายามไม่เพียงพอก็อาจเป็นไปได้)
--- หมดหน้าที่ของผมแล้ว ที่เหลือก็เป็นหน้าที่ของคุณ (ค่อยฯคิด/สังเกตุ)
Date :
2016-09-26 18:21:31
By :
หน้าฮี
แถม
Code (C#)
[private SelectedPathType _selected = SelectedPathType.openFileDialog;
[System.ComponentModel.Browsable(true)]
//[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(true)]
//[System.ComponentModel.DefaultValue(SelectedPathType.openFileDialog)]
[System.ComponentModel.Category("Behavior")]
[System.ComponentModel.Description("Open File or Folder Dialog is dispalyed and on success the contents of the Cell is replaced with the new path.")]
public SelectedPathType SelectedMode
{
get { return _selected; }
set
{
_selected = value;
}
}
/cs]
ถ้าเป็น C# 6.0 แบบนี้จบ (Auto SexProperty Value)
Code (C#)
[cs]private string _selectedSEX { get; set; } = SelectedPathType.openFileDialog;
ขอให้โชคดี
Date :
2016-09-26 18:59:19
By :
หน้าฮี
ได้ความรู้เพิ่มอีกเยอะเลยครับ
ปัญหานี้ทำให้ผมไม่อยากใช้โปรแกรมเถื่อนไปตั้ง 3 วิ
ปล.
ผมแก้ปัญหา openFileDialog โดยปิด DefaultValue
Code (C#)
// [System.ComponentModel.DefaultValue(SelectedPathType.OpenFileDialog)]
ซึ่งก็ไม่รู้อีกเหมือนกันว่าทำแค่นี้ทำไมถึงเปลี่ยนได้ก็ไม่รู้ครับ
แต่ยังไงก็ตามผมได้ DataGridViewDataGridView มาใช้งานสมที่ตั้งใจแล้วครับ
Code (C#)
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TORServices.Forms.Datagridview
{
#region _DataGridViewDialog
/// <summary>
/// Hosts a collection of DataGridViewTextBoxCell cells.
/// </summary>
public class DataGridViewDialogColumn : System.Windows.Forms.DataGridViewColumn
{
private bool showBrowseButton;
[System.ComponentModel.Browsable(true)]
// [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Category("Appearance")]
[System.ComponentModel.Description("Show a button in each cell for browsing for files.")]
public enum SelectedPathType { colorDialog, folderDialog, fontDialog, OpenFileDialog, SaveFileDialog }
public bool ShowBrowseButton
{
get { return showBrowseButton; }
set
{
showBrowseButton = value;
}
}
public override object Clone()
{
var clm = base.Clone() as DataGridViewDialogColumn;
DataGridViewDialogColumn xxx = base.Clone() as DataGridViewDialogColumn;
if (clm != null)
{
clm.SelectedMode = _selected;
clm.ShowBrowseButton = showBrowseButton;
}
return clm;
}
private bool useOpenFileDialogOnButtonClick;
[System.ComponentModel.Browsable(true)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.DefaultValue(false)]
[System.ComponentModel.Category("Behavior")]
[System.ComponentModel.Description("Dialog is dispalyed and on success the contents of the Cell is replaced with the new file path.")]
public bool UseOpenFileDialogOnButtonClick
{
get { return useOpenFileDialogOnButtonClick; }
set
{
useOpenFileDialogOnButtonClick = value;
}
}
private SelectedPathType _selected;
[System.ComponentModel.Browsable(true)]
//[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
// [System.ComponentModel.DefaultValue(SelectedPathType.OpenFileDialog)]
[System.ComponentModel.Category("Behavior")]
[System.ComponentModel.Description("Open Dialog is dispalyed and on success the contents of the Cell is replaced with the new path.")]
public SelectedPathType SelectedMode
{
get { return _selected; }
set
{
_selected = value;
}
}
public DataGridViewDialogColumn()
: base(new DataGridViewDialogCell())
{
}
public override System.Windows.Forms.DataGridViewCell CellTemplate
{
get
{
return base.CellTemplate;
}
set
{
if (null != value &&
!value.GetType().IsAssignableFrom(typeof(DataGridViewDialogCell)))
{
throw new InvalidCastException("must be a DataGridViewDialogCell");
}
base.CellTemplate = value;
}
}
}
/// <summary>
/// Displays editable text information in a DataGridView control. Uses
/// PathEllipsis formatting if the column is smaller than the width of a
/// displayed filesystem path.
/// </summary>
public class DataGridViewDialogCell : DataGridViewLinkCell
{
Button browseButton;
Dictionary<Color, SolidBrush> brushes = new Dictionary<Color, SolidBrush>();
protected virtual SolidBrush GetCachedBrush(Color color)
{
if (this.brushes.ContainsKey(color))
return this.brushes[color];
SolidBrush brush = new SolidBrush(color);
this.brushes.Add(color, brush);
return brush;
}
protected virtual bool RightToLeftInternal
{
get
{
return this.DataGridView.RightToLeft == RightToLeft.Yes;
}
}
protected override void OnClick(DataGridViewCellEventArgs e)
{
base.OnClick(e);
if (this.DataGridView.CurrentCell == this)
{
string _Value = Convert.ToString(base.Value);
DataGridViewDialogColumn filePathColumn = (DataGridViewDialogColumn)this.DataGridView.Columns[ColumnIndex];
if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.OpenFileDialog)
{
if (!System.IO.File.Exists(_Value))
{ MessageBox.Show("ไม่พบ " + _Value); }
else
{ System.Diagnostics.Process.Start(_Value); }
}
if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.folderDialog)
{
if (!System.IO.Directory.Exists(_Value))
{ MessageBox.Show("ไม่พบ " + _Value); }
else
{ System.Diagnostics.Process.Start(_Value); }
}
}
}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
if (cellStyle == null) { throw new ArgumentNullException("cellStyle"); }
this.PaintPrivate(graphics, clipBounds, cellBounds, rowIndex, cellState, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
}
protected Rectangle PaintPrivate(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{
System.Diagnostics.Debug.WriteLine(string.Format("Painting Cell row {0} for rowindex {2} with rectangle {1}", this.RowIndex, cellBounds, rowIndex));
SolidBrush cachedBrush;
Rectangle empty = Rectangle.Empty;
if (((paintParts & DataGridViewPaintParts.Border) != DataGridViewPaintParts.None)) { this.PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle); }
Rectangle rectangle2 = this.BorderWidths(advancedBorderStyle);
Rectangle borderedCellRectangle = cellBounds;
borderedCellRectangle.Offset(rectangle2.X, rectangle2.Y);
borderedCellRectangle.Width -= rectangle2.Right;
borderedCellRectangle.Height -= rectangle2.Bottom;
Point currentCellAddress = base.DataGridView.CurrentCellAddress;
bool isFirstCell = (currentCellAddress.X == base.ColumnIndex) && (currentCellAddress.Y == rowIndex);
bool flagisFirstCellAndNotEditing = isFirstCell && (base.DataGridView.EditingControl != null);
bool thisCellIsSelected = (cellState & DataGridViewElementStates.Selected) != DataGridViewElementStates.None;
cachedBrush = ((((paintParts & DataGridViewPaintParts.SelectionBackground) != DataGridViewPaintParts.None) && thisCellIsSelected) && !flagisFirstCellAndNotEditing) ? GetCachedBrush(cellStyle.SelectionBackColor) : GetCachedBrush(cellStyle.BackColor);
if (((((paintParts & DataGridViewPaintParts.Background) != DataGridViewPaintParts.None)) && ((cachedBrush.Color.A == 0xff) && (borderedCellRectangle.Width > 0))) && (borderedCellRectangle.Height > 0))
{
graphics.FillRectangle(cachedBrush, borderedCellRectangle);
}
if (cellStyle.Padding != Padding.Empty)
{
if (RightToLeftInternal)
{
borderedCellRectangle.Offset(cellStyle.Padding.Right, cellStyle.Padding.Top);
}
else
{
borderedCellRectangle.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top);
}
borderedCellRectangle.Width -= cellStyle.Padding.Horizontal;
borderedCellRectangle.Height -= cellStyle.Padding.Vertical;
}
if (((isFirstCell) && (!flagisFirstCellAndNotEditing && ((paintParts & DataGridViewPaintParts.Focus) != DataGridViewPaintParts.None))) && ((ShowFocusCues && base.DataGridView.Focused) && ((borderedCellRectangle.Width > 0) && (borderedCellRectangle.Height > 0))))
{
ControlPaint.DrawFocusRectangle(graphics, borderedCellRectangle, Color.Empty, cachedBrush.Color);
}
Rectangle cellValueBounds = borderedCellRectangle;
string text = formattedValue as string;
if ((text != null) && (!flagisFirstCellAndNotEditing))
{
int y = (cellStyle.WrapMode == DataGridViewTriState.True) ? 1 : 2;
borderedCellRectangle.Offset(0, y);
borderedCellRectangle.Width = borderedCellRectangle.Width;
borderedCellRectangle.Height -= y + 1;
if ((borderedCellRectangle.Width > 0) && (borderedCellRectangle.Height > 0))
{
TextFormatFlags flags = TextFormatFlags.PathEllipsis;
if (((paintParts & DataGridViewPaintParts.ContentForeground) != DataGridViewPaintParts.None))
{
if ((flags & TextFormatFlags.SingleLine) != TextFormatFlags.GlyphOverhangPadding) { flags |= TextFormatFlags.EndEllipsis; }
DataGridViewDialogColumn filePathColumn = (DataGridViewDialogColumn)this.DataGridView.Columns[ColumnIndex];
if (this.RowIndex >= 0)
{
bool changed = false;
if ((browseButton.Width != System.Math.Max(10, borderedCellRectangle.Width / 4)) && (browseButton.Width != 20))
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton Width was incorrect:{0} for given rectangle:{1}", browseButton.Width, borderedCellRectangle));
browseButton.Width = System.Math.Max(10, borderedCellRectangle.Width / 4);
browseButton.Width = System.Math.Min(browseButton.Width, 20);
changed = true;
}
if (browseButton.Height != (borderedCellRectangle.Height + 4))
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton Height was incorrect:{0} for given rectangle:{1}", browseButton.Height, borderedCellRectangle));
browseButton.Height = borderedCellRectangle.Height + 4;
changed = true;
}
Point loc = new Point();
loc.X = borderedCellRectangle.X + borderedCellRectangle.Width - browseButton.Width;
loc.Y = borderedCellRectangle.Y - 4;
if (browseButton.Location != loc)
{
System.Diagnostics.Trace.WriteLine(string.Format("browseButton location was incorrect:{0} for given rectangle:{1} with loc: {2}", browseButton.Location, borderedCellRectangle, loc));
browseButton.Location = loc;
changed = true;
}
if (changed)
browseButton.Invalidate();
if (!this.DataGridView.Controls.Contains(browseButton))
this.DataGridView.Controls.Add(browseButton);
borderedCellRectangle.Width -= browseButton.Width;
}
}
TextRenderer.DrawText(graphics, text, cellStyle.Font, borderedCellRectangle, thisCellIsSelected ? cellStyle.SelectionForeColor : cellStyle.ForeColor, flags);
}
}
if ((base.DataGridView.ShowCellErrors) && ((paintParts & DataGridViewPaintParts.ErrorIcon) != DataGridViewPaintParts.None))
{
if ((!string.IsNullOrEmpty(errorText) && (cellValueBounds.Width >= 20)) && (cellValueBounds.Height >= 0x13))
{
Rectangle iconBounds = this.GetErrorIconBounds(graphics, cellStyle, rowIndex);
if ((iconBounds.Width >= 4) && (iconBounds.Height >= 11))
{
iconBounds.X += cellBounds.X;
iconBounds.Y += cellBounds.Y;
Bitmap errorBitmap = new Bitmap(typeof(DataGridViewCell), "DataGridViewRow.error.bmp");
errorBitmap.MakeTransparent();
if (errorBitmap != null)
{
lock (errorBitmap)
{
graphics.DrawImage(errorBitmap, iconBounds, 0, 0, 12, 11, GraphicsUnit.Pixel);
}
}
}
}
}
return empty;
}
public bool ShowFocusCues
{
get { return true; }
}
protected bool ApplyVisualStylesToHeaders
{
get
{
if (Application.RenderWithVisualStyles)
{
return this.DataGridView.EnableHeadersVisualStyles;
}
return false;
}
}
private void DataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (base.Value.ToString().Length > 0)
{
System.Diagnostics.Process.Start(base.Value.ToString());
}
}
void browseButton_Click(object sender, EventArgs e)
{
DataGridViewDialogColumn filePathColumn = (DataGridViewDialogColumn)this.DataGridView.Columns[ColumnIndex];
try
{
if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.OpenFileDialog)
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.FileName.ToString();
}
}
else if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.folderDialog)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.SelectedPath;
}
}
else if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.colorDialog)
{
ColorDialog dialog = new ColorDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.Color.ToString() + ":"
+ dialog.Color.Name.ToString()
+ ": A=" + dialog.Color.A + " R=" + dialog.Color.R + " G=" + dialog.Color.G + " B=" + dialog.Color.B;
}
}
else if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.fontDialog)
{
FontDialog dialog = new FontDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.Font.ToString();
}
}
else if (filePathColumn.SelectedMode == DataGridViewDialogColumn.SelectedPathType.SaveFileDialog)
{
SaveFileDialog dialog = new SaveFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
base.Value = dialog.FileName;
}
}
}
catch (Exception)
{
}
}
public DataGridViewDialogCell()
: base()
{
browseButton = new Button();
browseButton.Text = "…";
browseButton.Click += new EventHandler(browseButton_Click);
}
}
#endregion
}
ประวัติการแก้ไข 2016-09-26 22:36:24
Date :
2016-09-26 22:18:27
By :
lamaka.tor
@lamaka.tor คุณเชื่อผมไหมว่า? จาก #NO 1 - #NO 18
---- จริงฯแล้วผมเขียน C# ไม่เป็น (ผมถนัด VB.NET) (ผมอาศัย Tools บน Internet Convert C# To VB และ VB To C#)
คุณคิดว่าผมควรจะต้อง (ทำ) หรือ (ค่อยเป็นค่อยไป) แปลงความถนัด(นิสัย) ของผม จาก VB ---> C# หรือไม่? (จากแรงบันดาลใจ #NO 18)
+ ปล. ไม่มีอะไรลึกฯ ก็แค่เล่าสู่กันฟัง แค่นั้นเองครับ
Date :
2016-09-26 22:25:11
By :
หน้าฮี
Load balance : Server 01