How to make a program to add/change picture image of a contact in Windows Mobile 6.5 environment?
I am new to windows mobile development. Here is my question: How to make a program/function to add/change picture image of a contact in Windows Mobile 6.5 environment?
Could you give some suggestions which class to use and how to use?
Thanks a mill开发者_开发技巧ion
this is your example code:
using System;
using System.IO;
using System.Data;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using Microsoft.WindowsMobile.Forms;
using Microsoft.WindowsMobile.PocketOutlook;
namespace Microsoft.WindowsMobile.Samples.AddPictureToContact
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void mnuChooseContact_Click(object sender, EventArgs e)
{
ChooseContactDialog chooseContactDialog = new ChooseContactDialog();
SelectPictureDialog selectPictureDialog = new SelectPictureDialog();
Contact contact = new Contact();
this.mnuChooseContact.Enabled = false;
// Open a PocketOutlook session
using (OutlookSession session = new OutlookSession())
{
// Create a single contact
if (session.Contacts.Items.Count <= 0)
{
contact.FirstName = "Contact";
contact.LastName = "With Picture";
session.Contacts.Items.Add(contact);
}
else
{
contact = session.Contacts.Items[0];
}
// Open a ChooseContactDialog and a SelectPictureDialog. If a contact was selected and a picture was chosen,
// assign the picture to the contact.
if ((DialogResult.OK == chooseContactDialog.ShowDialog()) && (DialogResult.OK == selectPictureDialog.ShowDialog()))
{
contact.SetPicture(selectPictureDialog.FileName);
contact.Update();
contact.ShowDialog();
}
}
this.mnuChooseContact.Enabled = true;
}
private void menuItemExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
How about calling the Microsoft.WindowMobile.PocketOutlook.SetPicture method?
精彩评论