其实原理很简单,没有大家想象的那么复杂,只要你用心去观察,去探索这个东西,最近我搞这个东西,感觉挺实用的,跟大家分享一下呵呵...
之后还会有图片的缩放,旋转,等例子和大家分享,我以前做Web的,刚转到这上面还不到一个月,有写的不好或不对的地方还望大家多多包涵,多多指教。
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MaipsoftChannelManage;
using System.Reflection;
using System.IO;
using Microsoft.WindowsCE;
using System.Drawing.Imaging;
using Microsoft.WindowsCE.Forms;
using Bornander.UI.Imaging.Test;
using Image_Rotation;
using System.Drawing.Drawing2D;
using Microsoft.WindowsMobile.DirectX;
using System.Runtime.InteropServices;
using System.Xml;
using GradientFillDemo;

namespace WindowsMobilePicDemo
{
    public partial class MainForm : Form
    {
        int x = 0;
        int y = 0;
        int moveX = 0;
        int moveY = 0;

	/// <summary>
        /// 点击图片事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            x = e.X;
            y = e.Y;
        }
	/// <summary>
        /// 任意角度拖放图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void pictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            //拖动浏览图片
           
            if (bmpWidth > this.alphaPanel_area.Width && bmpHeight > this.alphaPanel_area.Height)
            //我这里是判断图片的高度是否大于手机屏幕,如果大于就让他拖动,这样的话图片的任意角度都能看到了,否则就滑动查看图片呵呵
            {
                moveX = e.X - x;
                moveY = e.Y - y;
                width += moveX;
                height += moveY;
                this.imagePanelRotated.Location = new Point(width, height);
            }
            else
            {
                //nothing to do here!
            }
        }

	
	/// <summary>
        /// 滑动切换图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
	void pictureBox_MouseUp(object sender, MouseEventArgs e)
        {
          
            moveX = e.X - x;
            if (Math.Abs(moveX) > 5)
            {

                if (moveX > 0)
                {
			//向右切换图片的方法
                }
                else
                {
                       //向左切换图片的方法
                }
            }

	}
    }

}
posted on 2010-07-27 13:07  ∞Code∞  阅读(2039)  评论(2编辑  收藏  举报