Click here to Skip to main content
15,890,527 members
Home / Discussions / C#
   

C#

 
QuestionUse of PersianClanedar as current culture in .NET 2.0 (HELP) Pin
Mohammad Mir mostafa7-Dec-05 0:55
Mohammad Mir mostafa7-Dec-05 0:55 
QuestionUrgent: convert XML file in a excel one Pin
Sasuko7-Dec-05 0:33
Sasuko7-Dec-05 0:33 
QuestionFinalizer problem Pin
Bob Stanneveld7-Dec-05 0:29
Bob Stanneveld7-Dec-05 0:29 
AnswerRe: Finalizer problem Pin
mav.northwind7-Dec-05 1:14
mav.northwind7-Dec-05 1:14 
AnswerRe: Finalizer problem Pin
S. Senthil Kumar7-Dec-05 1:28
S. Senthil Kumar7-Dec-05 1:28 
QuestionPublish COM class from inside a WindowsForms application? Pin
mav.northwind6-Dec-05 23:13
mav.northwind6-Dec-05 23:13 
QuestionCommunicating with Macromedia Flash in .Net Pin
Hadi Riazi6-Dec-05 21:32
Hadi Riazi6-Dec-05 21:32 
Questionsave aimage from the form in .jpeg format Pin
dhol6-Dec-05 20:21
dhol6-Dec-05 20:21 
Hi
Using Microsoft.ink...I have to draw a image in the form and save that image in .jpeg format.....So i haveto install Microsoft Tablet pc.....
so finally I installed ... and i did a program with 2 buttons in the form namely SAVE and EXIT......

so now when i run this program..i can able to draw a image of my own in the form..now when i click save button...i should be able to save the image in .jpeg format.. BUT I couldnt save.. when i click the SAVE button..and give a name for the image .... an error is shown...

ERROR MESSAGE:
System.NullReferenceException: Object reference not set to an instance of an object.
at InkImage.Form1.button2_Click(Object sender, EventArgs e) in d:\inkimage\form1.cs:line 144..
ie, error in the last line of this program [ DrawArea.Save( sfd.FileName, format );]


using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Ink;
using System.IO;


namespace InkImage
{
public class Form1 : System.Windows.Forms.Form
{

// Declare the Ink Collector object
private InkCollector myInkCollector;
private const float ThinInkWidth = 50;


private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;


private Bitmap DrawArea;// make a persistent drawing area


private void Form1_Load(object sender, System.EventArgs e)
{
// Create a new ink collector and assign it to this form's window
myInkCollector = new InkCollector(this.Handle);

// Set the pen width to be a width
myInkCollector.DefaultDrawingAttributes.Width = ThinInkWidth;

// Turn the ink collector on
myInkCollector.Enabled = true;

}

//EXIT BUTTON

private void button1_Click(object sender, System.EventArgs e)
{
myInkCollector.Enabled = false;
this.Dispose();
}

//SAVE BUTTON
private void button2_Click(object sender, System.EventArgs e)
{
ImageFormat format = ImageFormat.Jpeg;
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "JPEG Files(*.jpg)|*.jpg";

if (sfd.ShowDialog() == DialogResult.OK)
{
// now save the image in the DrawArea
DrawArea.Save( sfd.FileName, format );
}


}
}
}


please help me to get the solution......

D h o l

QuestionConvert int to int[ ]? Pin
MudkiSekhon6-Dec-05 20:12
MudkiSekhon6-Dec-05 20:12 
AnswerRe: Convert int to int[ ]? Pin
S. Senthil Kumar6-Dec-05 20:29
S. Senthil Kumar6-Dec-05 20:29 
Questionsocket-client Pin
Ankit Aneja6-Dec-05 19:41
Ankit Aneja6-Dec-05 19:41 
AnswerRe: socket-client Pin
Vikram A Punathambekar6-Dec-05 21:59
Vikram A Punathambekar6-Dec-05 21:59 
GeneralRe: socket-client Pin
Ankit Aneja6-Dec-05 22:31
Ankit Aneja6-Dec-05 22:31 
QuestionSynchronization Require inStatic Function Call! Pin
majidbhutta6-Dec-05 17:54
majidbhutta6-Dec-05 17:54 
AnswerRe: Synchronization Require inStatic Function Call! Pin
S. Senthil Kumar7-Dec-05 1:33
S. Senthil Kumar7-Dec-05 1:33 
GeneralRe: Synchronization Require inStatic Function Call! Pin
majidbhutta7-Dec-05 3:33
majidbhutta7-Dec-05 3:33 
GeneralRe: Synchronization Require inStatic Function Call! Pin
S. Senthil Kumar7-Dec-05 4:12
S. Senthil Kumar7-Dec-05 4:12 
GeneralRe: Synchronization Require inStatic Function Call! Pin
majidbhutta7-Dec-05 4:26
majidbhutta7-Dec-05 4:26 
GeneralRe: Synchronization Require inStatic Function Call! Pin
S. Senthil Kumar7-Dec-05 4:35
S. Senthil Kumar7-Dec-05 4:35 
GeneralRe: Synchronization Require inStatic Function Call! Pin
majidbhutta7-Dec-05 5:07
majidbhutta7-Dec-05 5:07 
QuestionI don't want to display Relation name on DataGrid Pin
dhtuan6-Dec-05 16:21
dhtuan6-Dec-05 16:21 
QuestionTreeView CheckBoxes, but not their children Pin
meatago6-Dec-05 14:28
meatago6-Dec-05 14:28 
QuestionSkeleton Key Cryptography Pin
MrEyes6-Dec-05 13:10
MrEyes6-Dec-05 13:10 
AnswerRe: Skeleton Key Cryptography Pin
Paul Conrad6-Dec-05 13:57
professionalPaul Conrad6-Dec-05 13:57 
QuestionHard Drive Firmware Serial Number Pin
theladsmith6-Dec-05 11:03
theladsmith6-Dec-05 11:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.