当前位置: 首页>>代码示例>>C#>>正文


C# Windows.DataObjectPastingEventArgs类代码示例

本文整理汇总了C#中System.Windows.DataObjectPastingEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DataObjectPastingEventArgs类的具体用法?C# DataObjectPastingEventArgs怎么用?C# DataObjectPastingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataObjectPastingEventArgs类属于System.Windows命名空间,在下文中一共展示了DataObjectPastingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IntegerTextBox_PastingHandler

        private static void IntegerTextBox_PastingHandler(object sender, DataObjectPastingEventArgs e)
        {
            var Sender = sender as IntegerTextBox;
            if (Sender == null)
                return;

            Sender.OnPaste(e);
        }
开发者ID:ptownsend1984,项目名称:SampleApplications,代码行数:8,代码来源:IntegerTextBox.cs

示例2: OnPasted

        private void OnPasted(object sender, DataObjectPastingEventArgs e)
        {
            myWordsAdded = true;
            mySelectionStartPosition = Selection.Start;
            mySelectionEndPosition = Selection.IsEmpty ? Selection.End.GetPositionAtOffset(0, LogicalDirection.Forward) : Selection.End;

            // Hyperlink detection will be done in OnTextChanged()
        }
开发者ID:JackWangCUMT,项目名称:Plainion,代码行数:8,代码来源:RichTextEditor.cs

示例3: tb_Pasting

 private static void tb_Pasting(object sender, DataObjectPastingEventArgs e)
 {
     var pastedText = e.DataObject.GetData(typeof(string)) as string;
     if (!IsTextAllowed(pastedText))
     {
         e.CancelCommand();
     }
 }
开发者ID:skilldrill,项目名称:MCBattleShip,代码行数:8,代码来源:SingleDigitBehavior.cs

示例4: UcQuery_OnPaste

        private void UcQuery_OnPaste(object sender, DataObjectPastingEventArgs e)
        {
            var isText = e.SourceDataObject.GetDataPresent(DataFormats.UnicodeText, true);
            if (!isText) return;
            var text = e.SourceDataObject.GetData(DataFormats.UnicodeText) as string;

            ucQuery.Tag = !string.IsNullOrWhiteSpace(text);
        }
开发者ID:konradsikorski,项目名称:smartCAML,代码行数:8,代码来源:QueryTab.cs

示例5: Key_Pasting

 private void Key_Pasting(object sender, DataObjectPastingEventArgs e)
 {
     Regex r = new Regex("[^a-zA-Z]");
     if (r.IsMatch(e.DataObject.GetData(typeof(string)).ToString()))
     {
         MessageBox.Show(this, "Keys can only contain alphabetic letters!");
         e.CancelCommand();
     }
 }
开发者ID:ashfordl,项目名称:cipher-solver,代码行数:9,代码来源:MainWindow.xaml.cs

示例6: RichTextBox_Pasting

 private void RichTextBox_Pasting(object sender, DataObjectPastingEventArgs e)
 {
     RichTextBox richTextBox = sender as RichTextBox;
       string textData = (e.DataObject.GetData(DataFormats.UnicodeText) as string).Replace("\n", " ").Replace("\r", "");
       new TextRange(richTextBox.Selection.Start, richTextBox.Selection.End).Text = string.Empty;
       richTextBox.CaretPosition = richTextBox.CaretPosition.GetPositionAtOffset(0, LogicalDirection.Forward) ?? richTextBox.CaretPosition;
       richTextBox.CaretPosition.InsertTextInRun(textData);
       e.CancelCommand();
 }
开发者ID:unbearab1e,项目名称:FlattyTweet,代码行数:9,代码来源:SettingsView.cs

示例7: OnPaste

        private void OnPaste(object sender, DataObjectPastingEventArgs e)
        {
            var isText = e.SourceDataObject.GetDataPresent(System.Windows.DataFormats.Text, true);
            if (!isText) 
                return;

            var text = e.SourceDataObject.GetData(DataFormats.Text) as string;

        }
开发者ID:kakesu,项目名称:Procurement,代码行数:9,代码来源:ForumTemplate.xaml.cs

示例8: PastingHandler

 private static void PastingHandler(object sender, DataObjectPastingEventArgs e)
 {
     if (e.DataObject.GetDataPresent(typeof(String)))
     {
         var text = (String)e.DataObject.GetData(typeof(String));
         if (!IsTextAllowed(text)) e.CancelCommand();
     }
     else e.CancelCommand();
 }
开发者ID:ruisebastiao,项目名称:WPF-MVVM-With-Entity-Framework,代码行数:9,代码来源:TextBoxMaskBehavior.cs

示例9: IntegerPastingHandler

 public static void IntegerPastingHandler(ref object sender, ref DataObjectPastingEventArgs e)
 {
     if (e.DataObject.GetDataPresent(typeof(String)))
     {
         String text = (String)e.DataObject.GetData(typeof(String));
         if (!HandlingUserInput.IsIntegerText(text)) e.CancelCommand();
     }
     else e.CancelCommand();
 }
开发者ID:GandziukVI,项目名称:BreakJunctionsExperiment,代码行数:9,代码来源:HandlingUserInput.cs

示例10: OnPaste

        private void OnPaste(object sender, DataObjectPastingEventArgs e)
        {
            var pastedText = (string) e.SourceDataObject.GetData(DataFormats.UnicodeText);

            if (ProductIdIsNotValid(pastedText))
            {
                e.CancelCommand();
            }
        }
开发者ID:Havret,项目名称:CeneoETL,代码行数:9,代码来源:ETLView.xaml.cs

示例11: OnPaste

 private void OnPaste(object sender, DataObjectPastingEventArgs e)
 {
     if (!(sender is RichTextBox))
     return;
       string textData = e.DataObject.GetData(DataFormats.Text) as string;
       (sender as RichTextBox).Document.ContentEnd.InsertTextInRun(textData);
       (sender as RichTextBox).CaretPosition = (sender as RichTextBox).Document.ContentEnd;
       e.CancelCommand();
 }
开发者ID:unbearab1e,项目名称:FlattyTweet,代码行数:9,代码来源:SearchUserView.cs

示例12: noPaste

 private void noPaste(object sender, DataObjectPastingEventArgs e)
 {
     if (e.DataObject.GetDataPresent(typeof(String)))
     {
         String text = (String)e.DataObject.GetData(typeof(String));
         if (textAllowed(text)) e.CancelCommand();
     }
     else e.CancelCommand();
 }
开发者ID:trbielec,项目名称:hospipal,代码行数:9,代码来源:App.xaml.cs

示例13: OnClipboardPaste

 /// <summary>
 /// This method handles paste and drag/drop events onto the TextBox.  It restricts the character
 /// set to numerics and ensures we have consistent behavior.
 /// </summary>
 /// <param name="sender">TextBox sender</param>
 /// <param name="e">EventArgs</param>
 private static void OnClipboardPaste(object sender, DataObjectPastingEventArgs e)
 {
     string text = e.SourceDataObject.GetData(e.FormatToApply) as string;
     if (!string.IsNullOrEmpty(text))
     {
         if (text.Count(ch => !Char.IsNumber(ch)) == 0)
             return;
     }
     e.CancelCommand();
 }
开发者ID:nlafourcade,项目名称:OGP,代码行数:16,代码来源:NumericTextBoxBehavior.cs

示例14: IPTextBox_Paste

        private void IPTextBox_Paste(object sender, DataObjectPastingEventArgs e)
        {

            if (e.DataObject.GetDataPresent(typeof(string)))
            {
                string value = e.DataObject.GetData(typeof(string)).ToString();
                setIP(value);
            }

            e.CancelCommand();
        }
开发者ID:Stefanying,项目名称:CenterControlEditor,代码行数:11,代码来源:IPInput.xaml.cs

示例15: OnPaste

 protected virtual void OnPaste(DataObjectPastingEventArgs e)
 {
     var IsTextPresent = e.SourceDataObject.GetDataPresent(System.Windows.DataFormats.Text, true);
     if (IsTextPresent)
     {
         var TextValue = e.SourceDataObject.GetData(DataFormats.Text) as string;
         if (CheckTextFormat(TextValue))
             return;
     }
     e.CancelCommand();
 }
开发者ID:ptownsend1984,项目名称:SampleApplications,代码行数:11,代码来源:IntegerTextBox.cs


注:本文中的System.Windows.DataObjectPastingEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。