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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Use of InkCanvas cantrol in MVVM pattern to save image

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :JQuery

Hi All,

Can any one tell me how to use "InkCanvas" control in MVVM pattern.

I am able to save image using Code Behind in a Button click event.

But i am not getting any solution to save image using MVVM pattern binding a property to InkCanvas control.

Please help guys

Thanks and Regards



View Complete Post

More Related Resource Links

image.save not saving images


I have a piece of code that writes string into an image and save it. It works on one of my site and but not the other. The image.save is not working. If this is a permission problem, which account should I change? I use win server 2003 and IIS 6, and have given ASPNET, NETWORK SERVICE, and anonymous user write access.

Getting generic GDI error when trying to save resized image

Getting following error:A generic error occurred in GDI+.
Any help is appreciated.
Public Sub SaveImageFile(ByVal sourceImage As Bitmap, ByVal saveImagePath As [String], ByVal maxImageWidth As Integer)
            ' Resize if source image width is greater than the max:

            If sourceImage.Width > maxImageWidth Then
                Dim bmp As Bitmap = TryCast(sourceImage, Bitmap)
                Dim newImageHeight As Integer = CInt(Math.Truncate(sourceImage.Height * (CSng(maxImageWidth) / CSng(sourceImage.Width))))
                Dim gr As Graphics = Graphics.FromImage(bmp)

                Dim bmpnew As New Bitmap(maxImageWidth, newImageHeight)
                gr.InterpolationMode = InterpolationMode.HighQualityBicubic

                gr.DrawImage(bmpnew, 0, 0, maxImageWidth, newImageHeight)

                'code to manipulate bmpNew goes here.



Insert image into Infopath form and save to SharePoint as PDF file


I have an InfoPath web-enabled form in MOSS 2007, that is integrated with a K2 blackpoint process for an approval workflow.

Once the form (a Purchase Order request form) has been approved in the K2 workflow process, I switch the form view to a "print-friendly" view for the requestor to view from the browser.  However, now I need to go one step further with this scenario:

1) I need to somehow insert/embed an image with the scanned-in signature of the approver (likely stored in a SP doc library) at the signature line section of my form.  Also, what are the security requirements for storing such images, but not granting all users access to these (e.g. only services accounts that need to access this for embedding into the form, etc.)?

2) Then I need to convert this final "print-friendly" view of the form (with the signature image) to a PDF document so that I can store it in SharePoint (and email it to the requestor using K2's email event capabilities).

Can anyone help me with a solution to both of these requirement, or point me to some resources for this (even 3rd party components are open-game).



WPF MVVM pattern Projects

Hello,   I'm planning to develop WPF,C# using MVVM pattern.I'm looking for Sample projects using MVVM style i.e, like we have on Asp.net Web MVC NerdDinner,MVC MusicStore,Microsoft TownHall project.Can i find similar or any other help ful links for MVVM projects?    

"Save as image" available programatically?

Hi,With the rehosted designer it is possible to right click in the design area and choose to save the workflow as an image. This is cool functionality and was wondering if it was possible to call this programatically? This would then allow me to show an image of what the workflow looks like without having to load up the full designer.Does anyone know if this is possible or how it can be done.ThanksMatt

Why Image.save creates a black image

Hello, I am trying to create a screenshot, here is the code, it creates a complete black image.Thanks for any help. Public Function CaptureWindow(ByVal handle As IntPtr) As Image               ' get te hDC of the target window               Dim hdcSrc As IntPtr = User32.GetWindowDC(handle)               ' get the size               Dim windowRect As New User32.RECT()               User32.GetWindowRect(handle, windowRect)               Dim width As Integer = windowRect.right - windowRect.left               Dim height As Integer = windowRect.bottom - windowRect.top               ' create a device c

Visual Studio Extension: Save UML diagram as image

I am auditing one big legacy application. I use Visual Studio 2010 modeling projects to visualize the design of this legacy application. When I wanted to get my UML diagrams to image files so I can insert them to documents I found no option for it. As it turned out we have to write extension for modeling projects and deploy it as Visual Studio 2010 extension. Here is the installer and source package of my UML.SaveAsImage extension. UML.SaveAsImage.zip VS2010 solution | 48KB UML.SaveAsImage.Install.zip VSIX insaller | 4KB I still cannot believe that we need to write extensions to get our UML diagrams to image files but okay, it's done now and let's say - problem is solved. At least this one. In my work I used code example by Cameron Skinner. He has very good blog posting titled as Save a diagram to Image File. Here are steps how I wrote this extension. 1. Create new Layer Designer Command Extension project As a first thing you should create layer designer command extension project. If you don't have support for modeling projects you should take more powerful edition of Visual Studio 2010. Name it your project as you like and click OK. 2. Add functionality to Command class You can find Command class from your new project. This class is created by default. Here is the modified code from Cameron Ski

MVVM - race condition causing image to not display

Hi, We are using MVVM pattern at work for a window that fetches data from a web service and then displays the data. The data is displayed in tabs where each tab displays a title (string) and a chart (image). There are four tabs and whatever tab that is selected to be displayed first fails to display the image. The title gets displayed and this happens asyncrhonously so you will see no title and then when NotifyPropertyChanged fires you see the title but not the image. All the tabs that are not displayed by default work as expected and show the image. And you can change which tab is not displayed and the new tab that is displayed by default will also fail to show the image. Any help greatly appreciated. Code Getting Data The code as it is shown below works. However whenever I try and use the ThreadPool to GetNineMonthsOptionData the image for that tab doesn't display. Another interesting thing is that if I use the thread pool and then put a Thread.Sleep(2000) call right after it works. So there seems to be a race condition at work here. public void LoadOption(string symbol) { _symbol = symbol; // TODO: Team A - Change to use background thread for ninemonth data also and determine // if dispatching is necessary GetNineMonthsOptionData(); //ThreadPool.QueueUserWorkItem( // (o) => // { // GetNineMonthsOptionDa

Winnovative:Could not save image. Parameter is not valid.

while running website,the image get extracted from pdf document but still an exception named pdfimgextractexception appears at the end of an application.please give me the solution regarding this problem. code as follows: pdfImgExtractor.ExtractImages(srcPdfFile,true); which calls an eventhandler: pdfImgExtractor.ImageExtractedEvent += new ImageExtractedEventHandler(pcmd.pdfImgExtractor_ImageExtractedEvent); where the definition is: {   try { System.Drawing.     ographics = ographics.DrawImage(extractedBitmap, extractedBitmap.Dispose(); extractedBitmap = obitmap;     ographics.DrawString( ographics.Dispose(); ofont.Dispose(); oBrush.Dispose(); extractedBitmap.Save( extractedBitmap.Dispose(); }   {   }   Bitmap extractedBitmap = args.ExtractedBitmap;Graphics ographics;Bitmap obitmap = new Bitmap(extractedBitmap.Width, extractedBitmap.Height);Graphics.FromImage(obitmap);new Rectangle(0, 0, obitmap.Width, obitmap.Height), 0, 0, extractedBitmap.Width, extractedBitmap.Height, GraphicsUnit.Pixel);SolidBrush oBrush = new SolidBrush(Color.Black);Font ofont = new Font("Arial", 8);"Some text to write", ofont, oBrush, 10, 10);"D:\\example.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);catch (Exception err)HttpContext.Current.Response.Write(err.Message); } thanks in advance.

Problem in tab control with MVVM Pattern

Hi,  Am new to wpfpatter and mvvm also. I have problem, i need to assign the same shortcut key(say alt+N) to two button in different tab. i have used the following code to assign the shortcut. problem in when i click the shortcut key in tab one it will get trigger the tab two button event. --xmal code is     <UserControl.InputBindings>         <KeyBinding Command="{Binding Path=Delete1Command}" Modifiers="Alt" Key="N"></KeyBinding>         <KeyBinding Command="{Binding Path=Delete2Command}"   Modifiers="Alt" Key="N"></KeyBinding>     </UserControl.InputBindings>        <TabControl  Height="100" HorizontalAlignment="Left"  Name="tabControl1" VerticalAlignment="Top" Width="200">             <TabItem Header="tabItem1" Name="tabItem1">                 <Grid>                     <Button Content="Button1" Height="23&q

ASP.NET: How to Load image and save to database form clientside

Hello, can any one help? I am using HTTPHandlers for loading the image from the database I need to change the image and save it back to the database from the client side, that is I need to browse image at client side and save the image as bytes in to databases, how to do this? Regards, satish  

save image to PC directory


i don't know why when i  save the same picture to the same directory,it causes the error message: "A generic error occred in GDI+"??????
but if i change another picute to save , it works properly

my code is as belows:
 Image img = Image.FromFile(this.picBox2.ImageLocation.ToString());
img.Save(@"D:\Temp\111.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);

how can i prevent this error when i save the same picture?

save image in new folder


i have a image which i am picking from open file dialog now i want to save image in my project folder

please hep me

combobox in datagrid with MVVM Pattern



  i have requirement that, datagrid has a two column one is text column and other is combo box, combo box contain 2 column including checkbox. once i click the checkbox in combobox, resepective first column value need to display in combo box selected item and second column values need to display in first column of the data grid.

  I have used following code in xmal


<DataGrid x:Name="dgMixture"  VerticalAlignment="Top"  Width="250"
                      RowHeight="25"  GridLinesVisibility="Vertical" HeadersVisibility="Column" IsReadOnly="True"  AutoGenerateColumns="False"
                      HorizontalAlignment="Left" CanUserAddRows="False" ItemsSource="{Binding CompanyItemsCV}"   >

Binary Data Problem....save and retrive image data from sql database


hello friends...please help me to solve this problem....

i have created crud (create, retive, update and delete)form and it's running... here i want to add images for each record(sql database)....

i'm using image datatype in sql table for picture.....

Q 1: how to save and retrive binary data(image) from sql table in asp.net form using vb coding?

Q2: can i create sql table which store binary(image url) data direct?

thank you

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.


How to save WPF RichTextBox content (text + image) to the database



I want to save (and after that also to retrieve) the content of an WPF RichTextBox (text + image) to/from the database.

I found this: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/750a654e-b002-4742-8f46-609e93f6ec81 but like the author said, the solution seams not to work for text with image - the image is ignored/removed and only the formatted text is saved and after that retrieved to/from database.

Know someone a solution about this issue?

Best regards,





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