📄 form1.cs
字号:
#region --- Copyright Information ---
/*
*******************************************************************
| |
| OpenNETCF Smart Device Framework 2.2 |
| |
| |
| Copyright (c) 2000-2008 OpenNETCF Consulting LLC |
| ALL RIGHTS RESERVED |
| |
| The entire contents of this file is protected by U.S. and |
| International Copyright Laws. Unauthorized reproduction, |
| reverse-engineering, and distribution of all or any portion of |
| the code contained in this file is strictly prohibited and may |
| result in severe civil and criminal penalties and will be |
| prosecuted to the maximum extent possible under the law. |
| |
| RESTRICTIONS |
| |
| THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES |
| ARE CONFIDENTIAL AND PROPRIETARY TRADE |
| SECRETS OF OPENNETCF CONSULTING LLC THE REGISTERED DEVELOPER IS |
| LICENSED TO DISTRIBUTE THE PRODUCT AND ALL ACCOMPANYING .NET |
| CONTROLS AS PART OF A COMPILED EXECUTABLE PROGRAM ONLY. |
| |
| THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED |
| FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE |
| COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE |
| AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT |
| AND PERMISSION FROM OPENNETCF CONSULTING LLC |
| |
| CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON |
| ADDITIONAL RESTRICTIONS. |
| |
*******************************************************************
*/
#endregion
//----------------------------------------------------------------------------
// This file is part of the OpenNETCF Smart Device Framework Code Samples.
//
// Copyright (C) OpenNETCF Consulting, LLC. All rights reserved.
//
// This source code is intended only as a supplement to Smart Device
// Framework and/or on-line documentation.
//
// THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.WindowsMobile.Forms;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//
using OpenNETCF.Drawing.Imaging;
namespace ImagingDemo1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void mnuLoadDirect_Click(object sender, EventArgs e)
{
SelectPictureDialog dlg = new SelectPictureDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
pbImage.Image = new Bitmap(dlg.FileName);
}
catch (OutOfMemoryException)
{
MessageBox.Show("Out of memory");
}
}
}
private void mnuLoadImaging_Click(object sender, EventArgs e)
{
SelectPictureDialog dlg = new SelectPictureDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
try
{
ImagingFactory factory = new ImagingFactoryClass();
IImage img;
factory.CreateImageFromFile(dlg.FileName, out img);
IBitmapImage imgB;
factory.CreateBitmapFromImage(img,
(uint)pbImage.Width,
(uint)pbImage.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb,
InterpolationHint.InterpolationHintDefault,
out imgB);
pbImage.Image = ImageUtils.IBitmapImageToBitmap(imgB);
}
catch (OutOfMemoryException)
{
MessageBox.Show("Out of memory");
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -