本文整理汇总了C#中System.Windows.Forms.CurrencyManager类的典型用法代码示例。如果您正苦于以下问题:C# CurrencyManager类的具体用法?C# CurrencyManager怎么用?C# CurrencyManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CurrencyManager类属于System.Windows.Forms命名空间,在下文中一共展示了CurrencyManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Commit
/// <summary>
/// Standard override
/// </summary>
/// <param name="dataSource"></param>
/// <param name="rowNum"></param>
/// <returns></returns>
protected override bool Commit(CurrencyManager dataSource, int rowNum)
{
if (!_inEdit)
{
return true;
}
try
{
object _value = _comboBox.SelectedValue;
if (NullText.Equals(_value))
{
_value = System.Convert.DBNull;
}
this.SetColumnValueAtRow(dataSource, rowNum, _value);
}
catch
{
return false;
}
finally
{
_inEdit = false;
_comboBox.Hide();
}
return true;
}
示例2: Edit
/// <summary>
/// Method Edit()
/// </summary>
/// <remarks>
/// On edit, add scroll event handler, and display combobox
/// </remarks>
/// <param name="source"></param>
/// <param name="rowNum"></param>
/// <param name="bounds"></param>
/// <param name="readOnly"></param>
/// <param name="instantText"></param>
/// <param name="cellIsVisible"></param>
protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
base.Edit(source, rowNum, bounds, readOnly, instantText,cellIsVisible);
if (!readOnly && cellIsVisible)
{
// Save current row in the DataGrid and currency manager
// associated with the data source for the DataGrid
this.iCurrentRow = rowNum;
this.currencyManager = source;
// Add event handler for DataGrid scroll notification
this.DataGridTableStyle.DataGrid.Scroll += new EventHandler(DataGrid_Scroll);
// Site the combobox control within the current cell
this.comboBox.Parent = this.TextBox.Parent;
Rectangle rect = this.DataGridTableStyle.DataGrid.GetCurrentCellBounds();
this.comboBox.Location = rect.Location;
this.comboBox.Size = new Size(this.TextBox.Size.Width,this.comboBox.Size.Height);
// Set combobox selection to given text
this.comboBox.SelectedIndex = this.comboBox.FindStringExact(this.TextBox.Text);
// Make the combobox visible and place on top textbox control
this.comboBox.Show();
this.comboBox.BringToFront();
this.comboBox.Focus();
}
}
示例3: Edit
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
DateTime value = DateTime.Today;
try
{
value = (DateTime) GetColumnValueAtRow(source, rowNum);
}
catch {}
if (cellIsVisible)
{
myDateTimePicker.Bounds = new Rectangle(bounds.X + 2, bounds.Y + 2, bounds.Width - 4, bounds.Height - 4);
myDateTimePicker.Value = value;
myDateTimePicker.Visible = true;
myDateTimePicker.ValueChanged += new EventHandler(TimePickerValueChanged);
}
else
{
myDateTimePicker.Value = value;
myDateTimePicker.Visible = false;
}
if (myDateTimePicker.Visible)
DataGridTableStyle.DataGrid.Invalidate(bounds);
}
示例4: Edit
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
if (isEditing)
return;
object value = GetColumnValueAtRow(source, rowNum);
if (value != null && value != System.DBNull.Value && value.ToString().Equals("+"))
mCB.Checked = true;
else
mCB.Checked = false;
if (cellIsVisible)
{
mCB.Bounds = new Rectangle(bounds.X+2, bounds.Y+2 , bounds.Width-2, bounds.Height-2);
mCB.Visible = true;
isEditing = true;
base.ColumnStartedEditing(mCB);
AddEventHandlerCheckBoxChanged();
}
else
{
mCB.Visible = false;
}
if (mCB.Visible)
{
DataGridTableStyle.DataGrid.Invalidate(bounds);
mCB.Focus();
}
}
示例5: Edit
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
if (isEditing)
return;
object value = GetColumnValueAtRow(source, rowNum);
if (value != null && value != System.DBNull.Value && value.ToString().Length > 0)
mME.Text = value.ToString();
else
mME.Text = mME.EditMask; //string.Empty;
if (cellIsVisible)
{
mME.Bounds = new Rectangle(bounds.X+2, bounds.Y+2 , bounds.Width-2, bounds.Height-2);
mME.Visible = true;
isEditing = true;
base.ColumnStartedEditing(mME);
AddEventHandlerMaskEditChanged();
}
else
{
mME.Visible = false;
}
if (mME.Visible)
{
DataGridTableStyle.DataGrid.Invalidate(bounds);
mME.Select(0,1);
mME.Focus();
}
}
示例6: filterChanged
private void filterChanged(object sender, EventArgs e)
{
FilterControl component = (FilterControl)base.Component;
CurrencyManager manager = null;
if ((component.DataSource != null) && (component.BindingContext != null))
{
manager = (CurrencyManager)component.BindingContext[component.DataSource, component.DataMember];
}
if (manager != this.cm)
{
if (this.cm != null)
{
this.cm.MetaDataChanged -= new EventHandler(this.dataGridViewMetaDataChanged);
}
this.cm = manager;
if (this.cm != null)
{
this.cm.MetaDataChanged += new EventHandler(this.dataGridViewMetaDataChanged);
}
}
if (component.BindingContext == null || component.DataSource != null)
{
MakeSureColumnsAreSited(component);
}
else
{
this.RefreshColumnCollection();
}
}
示例7: Edit
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
if (isEditing)
return;
if (cellIsVisible)
{
mSel.Bounds = new Rectangle(bounds.X + 2, bounds.Y + 2, bounds.Width, bounds.Height);
mSel.Visible = true;
mSel.OnControlChanged += new EventHandler(OpenDateValueChanged);
object value = base.GetColumnValueAtRow( source, rowNum );
if ( value == null )
mSel.pSelectedItem = new PlaceCode(0, 0);
else
mSel.pSelectedItem = PlaceCode.PDC2PlaceCode(value.ToString());
value = this.GetColumnValueAtRow( source, rowNum );
if ( value == null )
mSel.pText = string.Empty;
else
mSel.pText = value.ToString();
}
else
{
mSel.Visible = false;
}
if (mSel.Visible)
{
isEditing = true;
base.ColumnStartedEditing(mSel);
DataGridTableStyle.DataGrid.Invalidate(bounds);
}
}
示例8: MapViewerForm
public MapViewerForm(TileMap map)
{
InitializeComponent();
Map = map;
mv = new MapViewer(picMapViewer.Handle, picMapViewer.Width, picMapViewer.Height);
mv.changeMap(Map);
mv.UpdateView();
lstLayer.DataSource = Map.myLayer;
lstLayer.DisplayMember = "Name";
updateLayer();
ve = new ViewEvent();
_layerCache = new List<LayerCache>();
for (int i = 0; i < Map.myLayer.Count; i++ )
{
LayerCache lc = new LayerCache(Map.maxX, map.maxY, Map.myLayer[i]);
_layerCache.Add(lc);
}
cm = (CurrencyManager)BindingContext[Map.myLayer];
SetScrollSize();
tmrRefresh.Interval = 180;
tmrRefresh.Start();
}
示例9: Commit
//
// Commit Changes
//
protected override bool Commit(CurrencyManager DataSource,int RowNum)
{
HideCombo();
if(!InEdit)
{
return true;
}
try
{
object Value = mCombo.SelectedValue;
if(NullText.Equals(Value))
{
Value = System.Convert.DBNull;
}
SetColumnValueAtRow(DataSource, RowNum, Value);
}
catch
{
RollBack();
return false;
}
this.EndEdit();
return true;
}
示例10: Form1_Load
private void Form1_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(authorsDataSet1);
textBox2.DataBindings.Add("Text", authorsDataSet1, "Authors.au_fname");
MyCM = (CurrencyManager) this.BindingContext[authorsDataSet1, "authors"];
MyCM.Position = 0;
}
示例11: Edit
//
// Edit Grid
//
protected override void Edit(
CurrencyManager Source ,
int Rownum,
Rectangle Bounds,
bool ReadOnly,
string InstantText,
bool CellIsVisible
)
{
mCombo.Text = string.Empty;
Rectangle OriginalBounds = Bounds;
OldVal = mCombo.Text;
if(CellIsVisible)
{
Bounds.Offset(xMargin, yMargin);
Bounds.Width -= xMargin * 2;
Bounds.Height -= yMargin;
mCombo.Bounds = Bounds;
mCombo.Visible = true;
}
else
{
mCombo.Bounds = OriginalBounds;
mCombo.Visible = false;
}
try
{
mCombo.SelectedValue = GetText(GetColumnValueAtRow(Source, Rownum));
}
catch {}
if(InstantText!=null)
{
mCombo.SelectedValue = InstantText;
}
mCombo.RightToLeft = this.DataGridTableStyle.DataGrid.RightToLeft;
// Combo.Focus();
if(InstantText==null)
{
mCombo.SelectAll();
// Pre-selects an item in the combo when user tries to add
// a new record by moving the columns using tab.
// Combo.SelectedIndex = 0;
}
else
{
int End = mCombo.Text.Length;
mCombo.Select(End, 0);
}
if(mCombo.Visible)
{
DataGridTableStyle.DataGrid.Invalidate(OriginalBounds);
}
InEdit = true;
}
示例12: Commit
protected override bool Commit(CurrencyManager dataSource, int rowNum)
{
customComboBoxPicker1.Bounds = Rectangle.Empty;
customComboBoxPicker1.TextChanged -=
new EventHandler(ComboBoxTextChanged);
if (!isEditing)
return true;
isEditing = false;
try
{
string value = customComboBoxPicker1.Text;
SetColumnValueAtRow(dataSource, rowNum, value);
}
catch (Exception)
{
Abort(rowNum);
return false;
}
Invalidate();
return true;
}
示例13: GraphicDatabase
public GraphicDatabase()
{
InitializeComponent();
tv = new TilesetViewer(picTilesetViewer.Handle, picTilesetViewer.Width, picTilesetViewer.Height);
vs = new ViewSprite(picSprite.Handle);
vf = new ViewFace(picFace.Handle);
vas = new ViewAnimateSprite(picSpriteAnimation.Handle);
vs.SetView(picSprite.Width, picSprite.Height);
//tv.LoadTileset(new Texture("0.png"));
tv.yOffSet = vTilesetScroll.Value;
tv.UpdateView();
lstTileset.DataSource = Editor.Instance.curGame.TM.myTileset;
lstTileset.DisplayMember = "Name";
lstSprite.DataSource = Editor.Instance.curGame.AM.MySprite;
lstSprite.DisplayMember = "Name";
lstFace.DataSource = Editor.Instance.curGame.AM.MyFace;
cmts = (CurrencyManager)BindingContext[Editor.Instance.curGame.TM.myTileset];
cms = (CurrencyManager)BindingContext[Editor.Instance.curGame.AM.MySprite];
cmf = (CurrencyManager)BindingContext[Editor.Instance.curGame.AM.MyFace];
RefreshTilesetDatabase();
RefreshSpriteDatabase();
RefreshFaceDatabase();
tmrRefresher.Start();
}
示例14: Edit
protected override void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
Console.WriteLine ("TextBox bounds = {0} and is {1}, parent = {2}", TextBox.Bounds, TextBox.Visible ? "visible" : "not visible", TextBox.Parent == null ? "null" : TextBox.Parent.GetType().ToString());
Console.WriteLine ("Edit\n{0}", Environment.StackTrace);
base.Edit (source, rowNum, bounds, readOnly, instantText, cellIsVisible);
Console.WriteLine ("TextBox bounds = {0} and is {1}, parent = {2}", TextBox.Bounds, TextBox.Visible ? "visible" : "not visible", TextBox.Parent == null ? "null" : TextBox.Parent.GetType().ToString());
}
示例15: Edit
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
if (isEditing)
return;
object value = GetColumnValueAtRow(source, rowNum);
if (value != null && value != System.DBNull.Value)
mPSI.pImageCollection.pCurrentIndex = (int)value;
else
mPSI.pImageCollection.pCurrentIndex = 0;
if (cellIsVisible)
{
mPSI.Bounds = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height);
mPSI.Visible = true;
isEditing = true;
base.ColumnStartedEditing(mPSI);
AddEventHandlerPicSwitchChanged();
}
else
{
mPSI.Visible = false;
}
if (mPSI.Visible)
{
DataGridTableStyle.DataGrid.Invalidate(bounds);
mPSI.Invalidate();
mPSI.Focus();
}
}