| 网站首页 | 文章中心 | 电子书下载 | 矢量图库 | 视频教程 | 素材下载 | 程序代码下载 | JS代码 | 论坛 | 
龙腾教程网  
常用软件类:
|杀毒安全 |联络聊天 |网络软件 |多媒体类 |系统工具 |图形图像 |系统工具 |应用软件 |行业软件
开发设计类:
|动画制作 |图像处理 |3D设计 |操作系统 |站长学院 |网络相关 |WEB设计 |数据库类 |程序开发
 
  您当前位置:您现在的位置: 龙腾软件教程网 >> 文章中心 >> 应用程序 >> 移动程序开发 >> 微软 >> 文章正文 
 
Windows Moblie 笔迹图板开发

这是应一个网友的问题而做的一个小程序,可以保存为位图,我觉得还是有一定的参考价值的,所以就把相关代码贴了出来 。

 


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace HandImage
{
    
public partial class frmTest : Form
    {
        List
<Points> HandTrack=new List<Points>();
        
public Graphics pb_Graphics;
        Bitmap pb_BMP 
= new Bitmap(239,235);

        
int index = 0;    //第几笔
        public frmTest()
        {
            InitializeComponent();
        }

        
private void pnlBar_MouseMove(object sender, MouseEventArgs e)
        {
            HandTrack[index].PT.Add(
new Point(e.X, e.Y));
            pnlBar.Refresh();
        }

        
private void pnlBar_Paint(object sender, PaintEventArgs e)
        {
            pb_Graphics 
= Graphics.FromImage((System.Drawing.Image)pb_BMP);
            pb_Graphics.Clear(pnlBar.BackColor);
            
foreach(Points item in  HandTrack)
            {
                pb_Graphics.DrawLines(
new Pen(Color.Black), item.PT.ToArray());  
            }
            e.Graphics.DrawImage(pb_BMP, 
00);
            pb_Graphics.Dispose(); 
        }

        
class Points
        {
            
public List<Point> PT=new List<Point>();
        }

        
private void btnClear_Click(object sender, EventArgs e)
        {
            index 
= 0;
            HandTrack 
= new List<Points>();
            pnlBar.Refresh();  
        }

        
private void pnlBar_MouseUp(object sender, MouseEventArgs e)
        {
            index
++;
        }

        
private void pnlBar_MouseDown(object sender, MouseEventArgs e)
        {
            HandTrack.Add(
new Points());
            HandTrack[index].PT.Add(
new Point(e.X, e.Y));
            pnlBar.Refresh();  
        }

        
private void btnSave_Click(object sender, EventArgs e)
        {
            dlgSaveFile.Filter 
= "位图(*.bmp)|*.bmp"
            
if (dlgSaveFile.ShowDialog() == DialogResult.OK)
            {
                
string strFile = dlgSaveFile.FileName;
                pb_BMP.Save(strFile, System.Drawing.Imaging.ImageFormat.Bmp); 
            }
        }
    }
}

上一篇:
  • 上一篇文章:
  • 下一篇
  • 下一篇文章: 没有了
  • 收藏此文到百度搜藏 百度搜藏| 新浪VIvi| 365key| Younote| 博采中心| 你好BLOG| 亿友网摘| 和讯网摘|
    相关文章    
    微软Windows Mobile7.0新功能预览
    Windows Mobile程序的自动化测试
    开发 Windows Mobile 应用程序FAQ
    Windows Mobile 5.0新增API介绍
    Windows Mobile开发环境搭建
     
     
     
    最新文章
    普通文章 Windows Moblie 笔迹图板开发最新文章
    普通文章 Coreldraw绘制可爱的情侣QQ企鹅最新文章
    普通文章 Photoshop制作端午节贺卡最新文章
    普通文章 Photoshop笔刷和蒙版修改照片色彩最新文章
    普通文章 详细讲解家用Linux的实用安全最新文章
    普通文章 Flash制作晃动的烛光最新文章
    普通文章 IE浏览器拒绝恶意代码的小窍门最新文章
    普通文章 Vista下IE7.0浏览器的9个使用技巧最新文章
    普通文章 快速绘制微软Office Word2007分割最新文章
    普通文章 PowerPoint2007将列表文字变成精最新文章
     
    热门文章
  • 没有推荐文章
  •  
     
    设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 

    版权所有2006-2008 龙腾教程网