.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

InkCanvas Clipboard

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :WPF


I would like to know how to copy ink canvas element to clipboard?

Right now what my application can do is copy element to ink canvas itself.

Thanks in advance.:)

View Complete Post

More Related Resource Links

Javascript code to copy selected dropdown item to clipboard

Does anyone know how I can do this to get the text onto the clipboard?  <input id="Copy" type="button" value="Copy Url" runat="server" onclick="copy();" style="vertical-align: top;" visible="false"/><script type="text/javascript"> function copy() { var sel = document.getElementById("DropDownList1"); var text = sel.options[sel.selectedIndex].value; ??? } </script> </body>  

paste image from clipboard using javascript

Hi all, How do we paste an image from clipboard into a custom rich text editor using javascript? (ctrl+c and ctrl+v or a snapshot) Please do share your thoughts! Thanks!  

Clipboard Question

Hi, I tried some code off some blog called 'Just code' that attached a WPF window to the windows clipboard chain. This works but I have two more problems. There is a piece code which runs and sees if the last thing added tot the clipboard was an Image if it is it creates an it takes the Image and converts it into an InteropBitmap. And in xaml I've defined a Simple window with an image component but when i add the InteropBitmap to the source of the image. It doesn't display anything. Here is the piece of code that I am talking about:         Code Snippet private void OnClipboardChanged(EventArgs clipChange)        {            try            {                if (Clipboard.ContainsImage())                {                    BitmapSource i = (InteropBitmap)Clipboard.GetImage();                    image.Source = i;                    image.InvalidateVisual();                    /*BitmapImage i = new BitmapImage();                    i.BeginInit();                    i.UriSource = new Uri(@"C:\Users\Tim\Desktop\zhbackground.bmp");                    i.EndInit();                    this.image.Source = i;*/                                        Debug.WriteLine(this.image.Source.ToString());                }                if(Clipboard.ContainsData(DataFormats.Text))                {                                      String s = Clipboard.GetText();                

Inkcanvas Recognizing and replacing shapes

Looking for some sample code or guidance for doing the following below. Thought this would be somewhat common.....

1) Using InkCanvas to allow drawing of shapes
2) Forcing the inkcanvas/inkanalyzer to limit its recognition to specific shapes (ellipses, circle, rectangle) 
3) Replacing the drawn and recognized shape strokes with a proper shape control that has a textbpx inside the shape

(Using 2010)


Gesture recognition on InkCanvas on XP



I'm currently developing a small app in WPF that requires gesture recognition, so I ended up using the InkCanvas. Everything works just fine on my desktop and laptop (running windows 7) but the app must run in another computer (an Asus Eee Top running windows XP). I've read that I had to install the Tablet PC SDK and the Tablet PC Recognition Pack, but I'm unable to install the Recognition pack because it complains about an unsuported OS: apparently it only suports XP up to Service pack 2, and I'm running SP3.

Are there any other alternatives?


watermark in InkCanvas



is there a way to get watermark text/image on inkCanvas?


Save Clipboard image as an attachment?


Does anyone know of a solution to save a clipboard image as an attachment (jpg) to a New Form? Basically the ability to save screenshots as an attachment.


Any event that triggers when any changes are made to clipboard?


The final outcome I want is actually detect if the clipboard contains any Image, if so then set a Image control to display that image. I am thinking I will need a way to monitor the clipboard if it contains an Image. How can I achieve this? I am thinking probably theres no such event so maybe i check the clipboard at regular intervals to see if it contains any image if so display it? Will it be very inefficient?

I am wondering if the same mechanism that enables/disables my button when the clipboard contains an image can come into use here? I am using MVVM Foundation .


because it enables/disables my Button bound to that correctly. Can i do something like when the CanExecute changes, If theres an image, display it?

inkcanvas how to move all selectedobjects and strokes


I have a inkcanvas and some uielements and strokes are selected .


is it possible to move the full selection as it was a single objects?

Problem with selection in InkCanvas



I have following problem. When I use selection with pen (button on the side - Lenova x200 Tablet) inkCanvas does not changes mode to Select, so it added new stroke. With eraser I do not have that problem.

Can I switch mode by my self with some Events or something else...

Tnx in advance

How to capture entire UserControl image to ClipBoard?


I have created a WPF UserControl using C# with .Net3.5 and VS 2008.  The UserControl contains several other elements, like Grids, Panels, Labels, TextBoxes, etc.  I want to provide a public method CopyControlToClipboard() that captures an image of the entire UserControl as a BMP and place it in the Clipboard.  The application that includes the UserControl should simply need to define some action (button click, menu item, etc) that calls this method.

How can I do this?

Thanks, Dave

clipboard validation before pasting into a textbox


I have a textbox with a keypress event tied to it to prevent only numbers, backspace, and 1 decimal point being entered into it. It works fine for when someone is typing into the textbox, but I also need to validate what could be pasted into the textbox from the clipboard. Right now, the pasted text could be anything, and it's giving me errors.

Here is my code so far:

private: System::Void PreventInvalidKeyOnKeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) 
			TextBox^ cur_control = dynamic_cast<TextBox^>(sender);
			// Only allow 1 decimal point (from http://www.daniweb.com/forums/thread310070.html)
			if (e->KeyChar == '.')
					if (cur_control->Text->Contains(".") && !cur_control->SelectedText->Contains("."))
						e->Handled = true;
			// Accept only digits ".", CTRL-C, CTRL-V, and the Backspace character

Clipboard GetData HTML


I am trying to read HTML in a drag and drop operation. I am using:


This had bugs in it from years ago. MS has since provided a work around. It still has bugs. It was never fixed.

The problem is that the HTML brought is is HTML version 4.0. It is not compliiant with current HTML, much less XHtml which is very strict.

Examples are:

align="middle"   There is no such thing. It is align="center" or valign="middle".

It places <span> tags inside of <td>. No can do. Something like <td> <h1> <span> could work. <span> must describe a higher element that can accept a style attribute.

Is there an alternative to GetData(HTML) for dragging HTML code into an application from an HTML document?

InkCanvas MouseLeftButtonDown event not getting fired


Here I have a very simple problem... i.e i am trying to capure the mouse device with MouseLeftButtonDown event but it seems to be not getting fired...


    private void MyCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
      Start = e.MouseDevice.GetPosition(MyCanvas);


    <InkCanvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 

this code is not getting fired please suggest.....

Prabhanjan Kumar Mahapatra

Multithreading Dynamic Shape Drawing on InkCanvas?


note: Multithreading code adapted from here http://elegantcode.com/2009/07/03/wpf-multithreading-using-the-backgroundworker-and-reporting-the-progress-to-the-ui/


The Problem:  The line is not rendered consistently, only on the mouseleftup event.

Scenario: 1. Michael clicks the Line button on the toolbar

2. Michael brings the mouse over the ink canvas and clicks the left mouse button

3. While moving the mouse to the right to draw a line, he notices that nothing shows up.

4. On releasing the mouses left button, the line finally renders correctly.

I realize that i most likely need to multithread to accomplish this.

To begin i have  a basic WPF setup, menu bars, borders, toolbars, and i have an ink canvas. The goal of this project is to familiarize myself with image editing and drawing programs. I created a basic Line2D class.


 public class Line2D
  BackgroundWorker worker;

  MainWindow window;
  InkCanvas canvas;
  Line lineToBuild;
  public Line2D(InkCanvas curren

saving WPF inkCanvas to image makes black background



i am saving inkcanvas but it saves black image




rtb = new RenderTargetBitmap<

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend