如何引入外部字体库iconfont的图标,具体滑差如下
直接使用阿里巴巴的网络路径
选择iconfont图标
官网:阿里巴巴矢量字体库
步骤:阿里巴巴字体库使用方法
全局盯让谨引入app.wxss
?
12345678910111213141516171819202122232425262728293031323334@font-face { font-family: 'iconfont'/* project id 518032 */ src: url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.eot') src: url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.eot?#iefix') format('embedded-opentype'), url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.woff') format('woff'), url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.ttf') format('truetype'), url('//at.alicdn.com/t/font_518032_t2q88z3jok8iwwmi.svg#iconfont') format('svg')}.iconfont { font-family:"iconfont" !important font-size:60rpx font-style:normal -webkit-font-smoothing: antialiased -moz-osx-font-smoothing: grayscale}/*本项目使用的18个图标 */.icon-zhiding:before{content: '\e739'}.icon-zuojiantou:before{content: '\e736'}.icon-youjiantou:before{content: '\e735'}.icon-shangjiantou:before{content: '\e734'}.icon-xiajiantou1:before{content: '\e733'}.icon-xiajiantou:before{content: '\e6cc'}.icon-gengduotianchong:before{content: '\e67f'}.icon-erweima:before{content: '\e65f'}.icon-fenleiorguangchangorqita:before{content: '\e64f'}.icon-dibiao:before{content: '\e64d'}.icon-bangzhu:before{content: '\e64a'}.icon-xinfeng:before{content: '\e640'}.icon-duihuaxinxi:before{content: '\e639'}.icon-sousuo:before{content: '\e62f'}.icon-shouye:before{content: '\e62d'}.icon-shezhi:before{content: '\e62a'}.icon-shanchu:before{content: '\e629'}.icon-dianhua:before{content: '\e61b'}使用图标
?
123456789101112131415161718192021222324<view> <icon class="iconfont icon-zhiding"></icon> <icon class="iconfont icon-zuojiantou"></icon> <icon class="iconfont icon-youjiantou"></icon> <icon class="iconfont icon-shangjiantou"></icon> <icon class="iconfont icon-xiajiantou1"></icon> <icon class="iconfont icon-xiajiantou"></icon></view><view> <icon class="iconfont icon-gengduotianchong"><凯基/icon> <icon class="iconfont icon-erweima"></icon> <icon class="iconfont icon-fenleiorguangchangorqita"></icon> <icon class="iconfont icon-dibiao"></icon> <icon class="iconfont icon-bangzhu"></icon> <icon class="iconfont icon-xinfeng"></icon></view><view> <icon class="iconfont icon-duihuaxinxi"></icon> <icon class="iconfont icon-sousuo"></icon> <icon class="iconfont icon-shouye"></icon> <icon class="iconfont icon-shezhi"></icon> <icon class="iconfont icon-shanchu"></icon> <icon class="iconfont icon-dianhua"></icon></view>效果图
注意:此处实现采用的是无APPID的开发模式,实际应用应该在微信小程序管理平台的开发设置中配置合法域名。
下载到本地
步骤
字体文件转化成base64格式
解压压缩包 —- 找到ttf格式文件 —- 上传到平台转化为base64格式 —- 下载压缩包 —- 将css文件名改为wxss —- 放入项目文件夹 —- 用@import全局引入 —- 使用
使用—-引入及全局定义
?
123456789101112131415161718192021222324@import "src/css/icon.wxss".iconfont { font-family: "iconfont" font-size:60rpx}/*本项目使用的18个图标 */.icon-zhiding:before{content: '\e739'}.icon-zuojiantou:before{content: '\e736'}.icon-youjiantou:before{content: '\e735'}.icon-shangjiantou:before{content: '\e734'}.icon-xiajiantou1:before{content: '\e733'}.icon-xiajiantou:before{content: '\e6cc'}.icon-gengduotianchong:before{content: '\e67f'}.icon-erweima:before{content: '\e65f'}.icon-fenleiorguangchangorqita:before{content: '\e64f'}.icon-dibiao:before{content: '\e64d'}.icon-bangzhu:before{content: '\e64a'}.icon-xinfeng:before{content: '\e640'}.icon-duihuaxinxi:before{content: '\e639'}.icon-sousuo:before{content: '\e62f'}.icon-shouye:before{content: '\e62d'}.icon-shezhi:before{content: '\e62a'}.icon-shanchu:before{content: '\e629'}.icon-dianhua:before{content: '\e61b'}开发使用
?
123456789101112131415161718192021222324<view> <icon class="iconfont icon-zhiding"></icon> <icon class="iconfont icon-zuojiantou"></icon> <icon class="iconfont icon-youjiantou"></icon> <icon class="iconfont icon-shangjiantou"></icon> <icon class="iconfont icon-xiajiantou1"></icon> <icon class="iconfont icon-xiajiantou"></icon></view><view> <icon class="iconfont icon-gengduotianchong"></icon> <icon class="iconfont icon-erweima"></icon> <icon class="iconfont icon-fenleiorguangchangorqita"></icon> <icon class="iconfont icon-dibiao"></icon> <icon class="iconfont icon-bangzhu"></icon> <icon class="iconfont icon-xinfeng"></icon></view><view> <icon class="iconfont icon-duihuaxinxi"></icon> <icon class="iconfont icon-sousuo"></icon> <icon class="iconfont icon-shouye"></icon> <icon class="iconfont icon-shezhi"></icon> <icon class="iconfont icon-shanchu"></icon> <icon class="iconfont icon-dianhua"></icon></view>效果图
VC-摄像头控制SDK源码#include <windows.h>
#include <stdio.h>
#include <vfw.h>
#pragma comment(lib,"vfw32.lib")
HWND ghWndCap //捕获窗的句柄
CAPDRIVERCAPS gCapDriverCaps //视频驱坦铅动器的能力
CAPSTATUS gCapStatus //捕获窗的状态
char szCaptureFile[] = "MYCAP.AVI"
char gachBuffer[20]
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM)
LRESULT CALLBACK StatusCallbackProc(HWND hWnd,int nID,LPSTR lpStatusText)
{
if(!ghWndCap)return FALSE//获得捕获窗的状态
capGetStatus(ghWndCap,&gCapStatus,sizeof(CAPSTATUS))//更新捕获窗的大小
SetWindowPos(ghWndCap,NULL,0,0,gCapStatus.uiImageWidth,gCapStatus.uiImageHeight,SWP_NOZORDER|SWP_NOMOVE)
if(nID==0){//清除旧的状态信息
SetWindowText(ghWndCap,(LPSTR)"hello")
return (LRESULT)TRUE
}//前笑显示状态ID和状态文本
wsprintf(gachBuffer,"Status# %d: %s",nID,lpStatusText)
SetWindowText(ghWndCap,(LPSTR)gachBuffer)
return (LRESULT)TRUE
}
LRESULT CALLBACK ErrorCallbackProc(HWND hWnd,int nErrID,LPSTR lpErrorText)
{
if(!ghWndCap)return FALSE
if(nErrID==0)return TRUE//清除旧的错误
wsprintf(gachBuffer,"Error# %d",nErrID)//显示错误标识和文本
MessageBox(hWnd, lpErrorText, gachBuffer,MB_OK | MB_ICONEXCLAMATION)
return (LRESULT) TRUE
}
LRESULT CALLBACK FrameCallbackProc(HWND hWnd,LPVIDEOHDR lpVHdr)
{
FILE *fp
fp=fopen("caram.dat","w")
if(!ghWndCap)return FALSE/让悔好/假设fp为一打开的.dat文件指针
fwrite(lpVHdr->lpData,1,lpVHdr->dwBufferLength,fp)
return (LRESULT)TRUE
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow)
{
static TCHAR szAppName[]=TEXT("HelloWin")
HWND hwnd
MSG msg
WNDCLASS wndclass
wndclass.style=CS_HREDRAW|CS_VREDRAW
wndclass.lpfnWndProc=WndProc
wndclass.cbClsExtra=0
wndclass.cbWndExtra=0
wndclass.hInstance=hInstance
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION)
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW)
wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH)
wndclass.lpszMenuName=NULL
wndclass.lpszClassName=szAppName
if(!RegisterClass(&wndclass))
{
MessageBox(NULL,TEXT("This program requires WindowsNT!"),szAppName,MB_ICONERROR)
return 0
}
hwnd=CreateWindow(szAppName,TEXT("The Hello Program"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL)
ShowWindow(hwnd,iCmdShow)
UpdateWindow(hwnd)
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg)
DispatchMessage(&msg)
}
return msg.wParam
}
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hdc
PAINTSTRUCT ps
RECT rect
switch(message)
{
case WM_CREATE:
{
ghWndCap=capCreateCaptureWindow((LPSTR)"Capture Window",WS_CHILD|WS_VISIBLE,0,0,300,240,(HWND)hwnd,(int)0)
capSetCallbackOnError(ghWndCap,(FARPROC)ErrorCallbackProc)
capSetCallbackOnStatus(ghWndCap,(FARPROC)StatusCallbackProc)
capSetCallbackOnFrame(ghWndCap,(FARPROC)FrameCallbackProc)
capDriverConnect(ghWndCap,0)// 将捕获窗同驱动器连接
//获得驱动器的能力,相关的信息放在结构变量gCapDriverCaps中
capDriverGetCaps(ghWndCap,&gCapDriverCaps,sizeof(CAPDRIVERCAPS))
capPreviewRate(ghWndCap, 66)// 设置Preview模式的显示速率
capPreview(ghWndCap, TRUE)//启动Preview模式
if(gCapDriverCaps.fHasOverlay) //检查驱动器是否有叠加能力
capOverlay(ghWndCap,TRUE)//启动Overlay模式
if(gCapDriverCaps.fHasDlgVideoSource)capDlgVideoSource(ghWndCap)//Video source 对话框
if(gCapDriverCaps.fHasDlgVideoFormat)capDlgVideoFormat(ghWndCap)// Video format 对话框
if(gCapDriverCaps.fHasDlgVideoDisplay)capDlgVideoDisplay(ghWndCap)// Video display 对话框
capFileSetCaptureFile( ghWndCap, szCaptureFile)//指定捕获文件名
capFileAlloc(ghWndCap, (1024L * 1024L * 5))//为捕获文件分配存储空间
capCaptureSequence(ghWndCap)//开始捕获视频序列
capGrabFrame(ghWndCap)//捕获单帧图像
}
return 0
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps)
GetClientRect(hwnd,&rect)
DrawText(hdc,TEXT("Hello,Windows98!"),-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER)
EndPaint(hwnd,&ps)
return 0
case WM_DESTROY:
{
capSetCallbackOnStatus(ghWndCap,NULL)
capSetCallbackOnError(ghWndCap,NULL)
capSetCallbackOnFrame(ghWndCap,NULL)
capCaptureAbort(ghWndCap)//停止捕获
capDriverDisconnect(ghWndCap)//将捕获窗同驱动器断开
PostQuitMessage(0)
}
return 0
}
return DefWindowProc(hwnd,message,wParam,lParam)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)