図 3 LogFont による Font の取得
|
public Font GetFont(Point p1, Point p2, float dpi)
{
int y = -(p2.Y - p1.Y); //反転した y 軸の調整
int x = p2.X - p1.X;
int angle = (int)(Math.Atan2(y, x) * 180 / Math.PI);
//角度の調整
if (y < 0) angle = 360 + angle;
LogFont lf = new LogFont();
lf.Height = (int)(-EnteredSize * dpi / 96);
lf.Escapement = angle * 10;
lf.Orientation = lf.Escapement;
lf.FaceName = Font.Name;
return Font.FromLogFont(lf);
}
図 6 OutlookSession を使用した電子メール メッセージの送信
|
if (dlgContact.ShowDialog() == DialogResult.OK)
{
//電子メールの送信
EmailMessage msg = new EmailMessage();
msg.To.Add(new Recipient(dlgContact.SelectedContact.Email1Address));
msg.Subject = "Here is an image I created...";
msg.BodyText = "...using Windows Mobile 5";
msg.Attachments.Add(new Attachment(filename));
using (OutlookSession outlook = new OutlookSession())
{
outlook.EmailAccounts[0].Send(msg);
}
MessageBox.Show("Send successful.");
}