本文整理汇总了C#中System.Windows.Forms.Control.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Control.ToString方法的具体用法?C# Control.ToString怎么用?C# Control.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.ToString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormLoadControls
/// <summary>
/// Зарежда Name и Text на контролите от формата
/// Зарежда масив за превод
/// </summary>
public void FormLoadControls(Control aControl, string[] aTArea)
{
// Зарежда Name и Text на контролите от формата
FormLoadControls(aControl);
// Зарежда масив за превод
FormTranslateArea(aControl.ToString().Split(',')[0].Trim(), aTArea);
}
示例2: MessageSequencer
private int m_cLevelsOfSequentialBlockInMessageHandler; // See Begin/EndSequentialBlock.
/// <summary>
/// Make one.
/// </summary>
/// <param name="master"></param>
public MessageSequencer(Control master)
{
if (master.IsDisposed)
throw new ArgumentException(String.Format("MessageSequencer cannot use a disposed Control: {0}", master.ToString()));
m_master = master;
m_receiver = m_master as IReceiveSequentialMessages;
if (m_receiver == null)
throw new Exception("Master control for MessageSequencer must implement IReceiveSequentialMessages");
if (msgs == null)
CreateSet();
}
示例3: CallObjectToString
public static object CallObjectToString(Control c, object[] obj)
{
return c.ToString();
}
示例4: ClearControl
/// <summary>
/// Clears the content of the specified control
/// </summary>
/// <param name="AControlToClear">The control whose content is to be cleared</param>
/// <returns>True if the control was a known control type and was cleared successfully.
/// If the control was a container control (such as a Panel), the method will return false.</returns>
public bool ClearControl(Control AControlToClear)
{
bool ReturnValue = false;
bool prevSuppressChangeDetection = FSuppressChangeDetection;
DisableDataChangedEvent();
try
{
if (AControlToClear.GetType() == typeof(TextBox))
{
((TextBox)AControlToClear).Clear();
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(TTxtMaskedTextBox))
{
((TTxtMaskedTextBox)AControlToClear).Clear();
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(ComboBox))
{
((ComboBox)AControlToClear).SelectedIndex = -1;
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(CheckBox))
{
((CheckBox)AControlToClear).Checked = false;
ReturnValue = true;
}
else if (AControlToClear is NumericUpDown)
{
((NumericUpDown)AControlToClear).Value = ((NumericUpDown)AControlToClear).Minimum;
ReturnValue = true;
}
else if ((AControlToClear.GetType() == typeof(TCmbAutoComplete))
|| (AControlToClear.GetType() == typeof(TCmbVersatile)))
{
// NOTE from AlanP: This code looks odd, but it is the way to clear these boxes....
// The first call to set the index to -1 actually sets it to 0 (if it isn't 0 already)
// Then the second call sets it from 0 to -1
// Then we can clear the text
// This behaviour applies particularly on bound data sources.
// Don't know if this is a Windows quirk or whether it also applies to Linux - but if it is just Windows, calling twice won't do any harm
((TCmbAutoComplete)AControlToClear).SelectedIndex = -1;
((TCmbAutoComplete)AControlToClear).SelectedIndex = -1;
((TCmbAutoComplete)AControlToClear).Text = String.Empty;
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(TCmbAutoPopulated))
{
((TCmbAutoPopulated)AControlToClear).cmbCombobox.SelectedIndex = -1;
((TCmbAutoPopulated)AControlToClear).cmbCombobox.SelectedIndex = -1;
((TCmbAutoPopulated)AControlToClear).cmbCombobox.Text = String.Empty;
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(TClbVersatile))
{
((TClbVersatile)AControlToClear).ClearSelected();
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(TtxtPetraDate))
{
((TtxtPetraDate)AControlToClear).Clear();
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(Ict.Common.Controls.TTxtNumericTextBox))
{
((Ict.Common.Controls.TTxtNumericTextBox)AControlToClear).ClearBox();
ReturnValue = true;
}
else if (AControlToClear.GetType() == typeof(Ict.Common.Controls.TTxtCurrencyTextBox))
{
((Ict.Common.Controls.TTxtCurrencyTextBox)AControlToClear).NumberValueDecimal = 0;
ReturnValue = true;
}
}
catch (Exception ex)
{
TLogging.LogAtLevel(7,
"Exception caught in TFrmPetraEditUtils.ClearControl(): " + AControlToClear.Name + "(" + AControlToClear.ToString() + "): " +
ex.Message);
}
if (prevSuppressChangeDetection == false)
{
// when we started we were tracking changes, so we need to reset that
// Note we only enable this if it was enabled at the start!!!
EnableDataChangedEvent();
}
return ReturnValue;
}
示例5: FormSetControls
/// <summary>
/// Зарежда Name и Text на контролите в Control
/// </summary>
public void FormSetControls(Control aControl)
{
// Определя коя е формата
string sOwner = aControl.ToString().Split(',')[0].Trim();
TranslateCollection TCllctn = _LPack.GetCollection(sOwner);
if (TCllctn != null)
{
aControl.Text = TCllctn.TItem.TText;
// Превежда контролите
SetControls(TCllctn.TItem, aControl.Controls);
}
}
示例6: SetConditional
/// <summary>
/// Derived class can set some it's controls as conditional read/edit mode, depending on real mode
/// Overrides previous setting for this control
/// </summary>
/// <param name="c">reference to control</param>
/// <param name="method">reference to method which evaluates control read/edit mode. Method returns editable condition.
/// It's argument true if edit mode is on</param>
protected void SetConditional(Control c, Func<bool, bool> IsEditableMethod)
{
if(IsEditableMethod == null)
{
var e = new ApplicationException(String.Format("No method defined for conditional mode of control {0}", c.ToString()));
log.Error(e.Message);
throw e;
}
controls.Add(c, ControlCondition.Conditional, IsEditableMethod);
}
示例7: OnNewActiveControl
// FxCop: Currently not used
private void OnNewActiveControl(Control value) {
Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "onNAC called with new: "+value.ToString());
if (!(value is AxHost)) return;
AxContainer c = FindContainerForControl(value);
if (c != null) {
c.OnNewActiveControlInternal((AxHost)value);
}
else {
Debug.Fail("control w/o a container... pretty bad..."+value.ToString());
}
}
示例8: OnOldActiveControl
// FxCop: Currently not used
private void OnOldActiveControl(Control valueOld, Control valueNew) {
Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "onOAC called with old: "+valueOld.ToString()+" new: "+valueNew.ToString());
if (!(valueOld is AxHost)) return;
AxContainer c = FindContainerForControl(valueOld);
if (c != null) {
c.OnOldActiveControlInternal(valueOld);
}
else {
Debug.Fail("control w/o a container... pretty bad..."+valueOld.ToString());
}
}
示例9: SetMAX
private void SetMAX(System.Windows.Forms.Label c, Control.Player.Skill s)
{
c.AutoSize = false;
c.Width = Control.Player.MAX[(int)s];
toolHeader.SetToolTip(c, s.ToString());
}
示例10: XPTableOnModifier
/// <summary>
/// Kiểm tra và áp đặt thuộc tính chung cho Control XPTable
/// </summary>
/// <param name="ThisControl"></param>
private static void XPTableOnModifier(Control ThisControl)
{
if((ThisControl.ToString() != "XPTable.Models.Table"))return;
Table tbl = (XPTable.Models.Table)ThisControl;
XPTableModifier(ref tbl);
}
示例11: RelationTest
public void RelationTest() {
Control c1;
Control c2;
c1 = new Control();
c2 = new Control();
Assert.AreEqual(true , c1.Visible , "Rel1");
Assert.AreEqual(false, c1.Contains(c2) , "Rel2");
Assert.AreEqual("System.Windows.Forms.Control", c1.ToString() , "Rel3");
c1.Controls.Add(c2);
Assert.AreEqual(true , c2.Visible , "Rel4");
Assert.AreEqual(true, c1.Contains(c2) , "Rel5");
c1.Anchor = AnchorStyles.Top;
c1.SuspendLayout ();
c1.Anchor = AnchorStyles.Left ;
c1.ResumeLayout ();
Assert.AreEqual(AnchorStyles.Left , c1.Anchor, "Rel6");
c1.SetBounds(10, 20, 30, 40) ;
Assert.AreEqual(new Rectangle(10, 20, 30, 40), c1.Bounds, "Rel7");
Assert.AreEqual(c1, c2.Parent, "Rel8");
}
示例12: CheckEmptyFields
void CheckEmptyFields(Control p_control)
{
if (p_control.Controls.Count > 0)
{
for (int a = 0; a < p_control.Controls.Count; a++)
{
CheckEmptyFields(p_control.Controls[a]);
}
}
else
{
if (p_control.ToString().ToLower().Contains("textbox"))
{
TextBox _TB = (TextBox)p_control;
if (_TB.Text == "")
{
if (_TB.Tag == null)
{
_TB.Text = " ";
}
else
{
_TB.Text = _TB.Tag.ToString();
}
}
else
{
_TB.Text = _TB.Text.ToUpper();
}
}
if (p_control.ToString().ToLower().Contains("datetime"))
{
}
}
}
示例13: setearControl
private void setearControl(Control p_control,string nameControl, string valueControl)
{
if (p_control.Controls.Count > 0)
{
for (int a = 0; a < p_control.Controls.Count; a++)
{
setearControl(p_control.Controls[a],nameControl,valueControl);
}
}
else
{
if (p_control.ToString().ToLower().Contains("textbox"))
{
TextBox _TB = (TextBox)p_control;
if (nameControl == _TB.Name)
{
_TB.Text = valueControl;
}
}
if (p_control.ToString().ToLower().Contains("datetime"))
{
DateTimePicker _DTP = (DateTimePicker)p_control;
if (nameControl == _DTP.Name)
{
_DTP.Value = DateTime.Parse(valueControl);
}
}
if (p_control.ToString().ToLower().Contains("checkbox"))
{
CheckBox _CB = (CheckBox)p_control;
if (nameControl == _CB.Name)
{
_CB.Checked = Boolean.Parse(valueControl);
}
}
}
}
示例14: examinarControl
private void examinarControl(Control p_control)
{
if (p_control.Controls.Count > 0)
{
for (int a = 0; a < p_control.Controls.Count; a++)
{
examinarControl(p_control.Controls[a]);
}
}
else
{
if (p_control.ToString().ToLower().Contains("textbox"))
{
TextBox _TB = (TextBox) p_control;
if (_TB.Text == "") { _TB.Text = " "; }
ObjectSave.Pool.InsertarObjeto(ObjectSave.Pool.TiposDeControles.textbox, _TB.Name, _TB.Text);
}
if (p_control.ToString().ToLower().Contains("datetime"))
{
DateTimePicker _DTP = (DateTimePicker) p_control;
ObjectSave.Pool.InsertarObjeto(ObjectSave.Pool.TiposDeControles.datetimepicker, _DTP.Name, _DTP.Value.ToString());
}
if (p_control.ToString().ToLower().Contains("checkbox"))
{
CheckBox _CB = (CheckBox) p_control;
ObjectSave.Pool.InsertarObjeto(ObjectSave.Pool.TiposDeControles.checkbox,_CB.Name , _CB.Checked.ToString());
}
}
}