日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

字符的点阵显示(模拟户外广告显示屏)

發布時間:2025/7/14 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 字符的点阵显示(模拟户外广告显示屏) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?????????????????????? 字符的點陣顯示
?
???????????????????????????????????????????????? 電子科技大學軟件學03級02班 周銀輝


一, 效果


二 關于C#讀取字符點陣的代碼
????? (原理就不再闡述了,到Baidu里面搜一下,很多,不過一般都是C/C++的)
????? (說明:對于一個字符,GetWordLattics函數返回的bool[,]表示一個16*8或16*16點陣,對應值為true表示該點應該被點亮)

?

using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.IO;
using?System.Windows.Forms;

namespace?ShowWord
{
????
/**////?<summary>
????
///?字符解析器
????
///?</summary>

????public?class?WordPaser
????
{
????????
private?static?byte[]?bytesOfASC;
????????
private?static?byte[]?bytesOfHanZi;
????????
private?static?string?pathOfASC?=?Application.StartupPath?+?Path.DirectorySeparatorChar?+?"ASC16";
????????
private?static?string?pathOfHanZi?=?Application.StartupPath?+?Path.DirectorySeparatorChar?+?"HZK16";

????????
static?WordPaser()
????????
{
????????????
try
????????????
{
????????????????bytesOfASC?
=?File.ReadAllBytes(pathOfASC);
????????????????bytesOfHanZi?
=?File.ReadAllBytes(pathOfHanZi);
????????????}

????????????
catch?(Exception?ex)
????????????
{
????????????????MessageBox.Show(ex.Message);
????????????}

????????}


????????
/**////?<summary>
????????
///?獲取指定的字符的點陣
????????
///?</summary>
????????
///?<param?name="c">字符</param>
????????
///?<param?name="lines">點陣行數</param>
????????
///?<param?name="columns">點陣列數</param>
????????
///?<returns>點陣數據,對應值為true表示該點應該被顯示,否則對應點不應該被顯示</returns>

????????public?static?bool[,]?GetWordLattics(Char?c,?out?int?lines,out?int?columns)
????????
{
????????????lines?
=?16;
????????????columns?
=?8;
????????????
bool[,]?lattics?=?new?bool[lines,?columns];

????????????
int?intValue?=?(int)c;
????????????
long?offset?=?0;

????????????
if?(intValue?<=?255)
????????????
{
????????????????offset?
=?intValue?*?16L;
????????????????
for?(int?i?=?0;?i?<?lines;?i++)
????????????????
{
????????????????????
for?(int?j?=?0;?j?<?columns;?j++)
????????????????????
{
????????????????????????
byte?byteValue?=?bytesOfASC[offset?+?i];
????????????????????????lattics[i,?j]?
=?((byteValue?>>?(7?-?j))?&?0x1)?!=?0;
????????????????????}

????????????????}


????????????}

????????????
else
????????????
{
????????????????lines?
=?16;
????????????????columns?
=?16;
????????????????lattics?
=?new?bool[lines,?columns];

????????????????
byte[]?bytes?=?System.Text.Encoding.GetEncoding("gb2312").GetBytes(c.ToString());


????????????????
int?zone?=?bytes[0];//剛好是“區”的值,機內碼???
????????????????int?num?=?bytes[1];//剛即時“位”的值?,機內碼???

????????????????
int?area?=?(zone?&?0x00ff)?-?0xa0;??//根據機內碼取得區碼
????????????????int?bit?=?(num?&?0x00ff)?-?0xa0;???//根據機內碼取得位碼

????????????????offset?
=?(94?*?(area?-?1)?+?(bit?-?1))?*?32L;
????????????????
????????????????
for?(int?i?=?0;?i?<?lines;?i++)
????????????????
{
????????????????????
for?(int?j?=?0;?j?<?2;?j++)
????????????????????
{
????????????????????????
for?(int?k?=?0;?k?<?8;?k++)
????????????????????????
{
????????????????????????????
byte?byteValue?=?bytesOfHanZi[offset?+?i?*?2?+?j];
????????????????????????????lattics[i,
8?*?j?+?k]?=?((byteValue?>>?(7?-?k))?&?0x1)?!=?0;
????????????????????????}

????????????????????}

????????????????}


???????????????
????????????}



????????????
return?lattics;
????????}

????
????}

}

?


3 字庫文件下載
代碼中用到的兩個字庫文件(或者你可以在TurboC安裝目錄下中找到他們) http://files.cnblogs.com/zhouyinhui/zk.rar

轉載于:https://www.cnblogs.com/zhouyinhui/archive/2006/11/28/575545.html

總結

以上是生活随笔為你收集整理的字符的点阵显示(模拟户外广告显示屏)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。