我是Windows移动开发的新手。 这是我的问题: 如何在Windows Mobile 6.5环境中制作程序/功能来添加/更改联系人的图片图像?
您能否提供一些使用哪些类以及如何使用的建议?
万分感谢
答案 0 :(得分:1)
这是您的示例代码:
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();
}
}
}
答案 1 :(得分:0)