Exemple #1
0
 private void BaseValue_TextChanged(object sender, System.EventArgs e)
 {
     if (bJustCalc)
     {
         bJustCalc = false;
         return;
     }
     if (BaseValue.Text == "")
     {
         val = 0;
         return;
     }
     try
     {
         if (dec_radio.Checked)
         {
             val = Convert.ToUInt32(BaseValue.Text, 10);
         }
         else if (hex_radio.Checked)
         {
             val = Convert.ToInt64(BaseValue.Text, 16);
         }
         else
         {
             val = Convert.ToInt64(BaseValue.Text, 2);
         }
         //BaseValue.Text = BaseValue.Text.ToUpper();
     }
     catch
     {
         if (dec_radio.Checked)
         {
             val            = uint.MaxValue;
             BaseValue.Text = val.ToString();
             BaseValue.Invalidate();
         }
         else if (hex_radio.Checked)
         {
             BaseValue.Text = Convert.ToString(int.MaxValue, 16).ToUpper();
         }
         else
         {
             BaseValue.Text = Convert.ToString(int.MaxValue, 2);
         }
     }
 }
 private void UpdateTextBox(TextBox txt, string data)
 {
     if (data == null) return;
     txt.AppendText(data);
     txt.SelectionStart = txt.TextLength;
     txt.ScrollToCaret();
     txt.Invalidate();
     Application.DoEvents();
 }
 private void SetText(TextBox tbControl, string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (tbControl.InvokeRequired)
     {
         SetTextCallback d = new SetTextCallback(SetText);
         this.Invoke(d, new object[] { tbControl,text });
     }
     else
     {
         tbControl.Text = text;
         tbControl.Invalidate();
     }
 }
 protected override void UpdatePreview(TextBox previewBox, object ruleObject)
 {
     RuleExpressionCondition declarativeRuleDefinition = ruleObject as RuleExpressionCondition;
     if (declarativeRuleDefinition != null && declarativeRuleDefinition.Expression != null)
     {
         RuleExpressionCondition ruleExpressionCondition = new RuleExpressionCondition(declarativeRuleDefinition.Expression);
         NativeMethods.SendMessage(previewBox.Handle, NativeMethods.WM_SETREDRAW, IntPtr.Zero, IntPtr.Zero);
         previewBox.Lines = ruleExpressionCondition.ToString().Split('\n');
         NativeMethods.SendMessage(previewBox.Handle, NativeMethods.WM_SETREDRAW, new IntPtr(1), IntPtr.Zero);
         previewBox.Invalidate();
     }
     else
     {
         previewBox.Text = string.Empty;
     }
 }
        protected override void UpdatePreview(TextBox previewBox, object ruleObject)
        {
            RuleSet ruleSet = ruleObject as RuleSet;

            NativeMethods.SendMessage(previewBox.Handle, NativeMethods.WM_SETREDRAW, IntPtr.Zero, IntPtr.Zero);
            previewBox.Lines = DesignerHelpers.GetRuleSetPreview(ruleSet).Split('\n');
            NativeMethods.SendMessage(previewBox.Handle, NativeMethods.WM_SETREDRAW, new IntPtr(1), IntPtr.Zero);
            previewBox.Invalidate();
        }
 /// <summary>
 /// Will update Text in a Text Box when the UI thread is still busy
 /// </summary>
 /// <param name="myTextBox">The TextBox control to update</param>
 /// <param name="myText">The Text to update</param>
 private void HELPER_updateTextBox(TextBox myTextBox, string myText)
 {
     myTextBox.Text = myText;
     myTextBox.Invalidate();
     myTextBox.Update();
     myTextBox.Refresh();
     Application.DoEvents();
 }
 protected override void UpdatePreview(TextBox previewBox, object ruleObject)
 {
     RuleSet ruleSet = ruleObject as RuleSet;
     System.Workflow.Activities.Common.NativeMethods.SendMessage(previewBox.Handle, 11, IntPtr.Zero, IntPtr.Zero);
     previewBox.Lines = DesignerHelpers.GetRuleSetPreview(ruleSet).Split(new char[] { '\n' });
     System.Workflow.Activities.Common.NativeMethods.SendMessage(previewBox.Handle, 11, new IntPtr(1), IntPtr.Zero);
     previewBox.Invalidate();
 }