如何制作VFP桌面歌词效果,API和GDI高手请进
恳请各位大侠给于指点
参考VB代码
http://tieba.baidu.com/f?kz=702349514
下载地址:
http://www.quwen168.com/lrcshow.rar
现已实现在表单上画出,本来想画到图片中再通过透明窗口来实现,试了一下字体边缘很难看....
主要是这两个API不知道怎么实现
CreateDIBSection
UpdateLayeredWindow
网上找到的CreateDIBSection定义但BHDR_STRUCT_SIZE参数的值不知道是什么
nBitmapWidth=500
nBitmapHeight=300
nBitsPerPixel=24
ppvBits=0
cBITMAPINFOHEADER=num2dword(BHDR_STRUCT_SIZE) +;
num2dword(nBitmapWidth) + num2dword(nBitmapHeight) +;
num2word(1) + num2word(nBitsPerPixel) +;
num2dword(BI_RGB)
cBITMAPINFOHEADER=PADR(cBITMAPINFOHEADER,;
BHDR_STRUCT_SIZE, CHR(20))
hBitmap=CreateDIBSection(hDC, @cBITMAPINFOHEADER,;
DIB_RGB_COLORS, @ppvBits, 0, 0)
以下代码放在一个命令按键里就可看出绘制效果,注意表单的ShowWindow=0
DECLARE INTEGER GdipCreateStringFormat IN GdiPlus.dll ;
INTEGER formatAttributes, INTEGER language, INTEGER @nFormat
DECLARE INTEGER GdipDeleteBrush IN GdiPlus.dll ;
INTEGER brush
DECLARE INTEGER GdipCreateFont IN GdiPlus.dll;
INTEGER fontFamily, SINGLE emSize,;
INTEGER fntstyle, INTEGER unit, INTEGER @fnt
DECLARE INTEGER GdipDeleteFont IN GdiPlus.dll ;
INTEGER fnt
DECLARE INTEGER GdipCreateFontFamilyFromName IN GdiPlus.dll;
STRING familyname, INTEGER FontCollection, INTEGER @FontFamily
DECLARE INTEGER GdipDeleteFontFamily IN GdiPlus.dll ;
INTEGER FontFamily
DECLARE INTEGER GdipCreateFromHWND IN gdiplus.dll ;
INTEGER hWind, INTEGER @graphics
DECLARE INTEGER GdipDeleteGraphics IN GdiPlus.dll ;
INTEGER graphics
DECLARE INTEGER GdipSetSmoothingMode IN "gdiplus" INTEGER ,INTEGER
DECLARE INTEGER GdipCreateFontFamilyFromName IN gdiplus STRING familyname, INTEGER fontCollection, INTEGER @FontFamily
DECLARE INTEGER GdipCreateStringFormat IN gdiplus INTEGER formatAttributes, INTEGER language, INTEGER @fmt
DECLARE integer GdipCreateLineBrushFromRect IN gdiplus.dll string,integer,integer,integer, integer, integer @
DECLARE LONG GdipCreatePath IN GDIPLUS LONG brushmode, LONG @path
DECLARE LONG GdipAddPathStringI IN GDIPLUS LONG path, STRING str, LONG length, LONG family, LONG style, SINGLE emSize, STRING @layoutRect, LONG StringFormat
DECLARE LONG GdipFillPath IN GDIPLUS LONG graphics, LONG brush, LONG path
DECLARE LONG GdipDrawPath IN GDIPLUS LONG graphics, LONG pen, LONG path
DECLARE INTEGER GdipCreatePen1 IN gdiplus INTEGER color,SINGLE penwidth,INTEGER unit,INTEGER @ gdipen
graphics=0
GdipCreateFromHWND(thisform.hwnd,@graphics)
GdipSetSmoothingMode(graphics,2)&&SmoothingModeHighQuality
lcFontName='黑体'&&字体名称,必须是已注册的字体
lcFontName=STRCONV(lcFontName+CHR(0),5)
lnFontFamily=0
GdipCreateFontFamilyFromName(lcFontName,0,@lnFontFamily)
strFormat = 0
GdipCreateStringFormat(0,0,@strFormat)
*DECLARE LONG GdipSetStringFormatAlign IN GDIPLUS LONG @StringFormat, LONG
*GdipSetStringFormatAlign(@strFormat,1)
x=0&&绘制文字的左上角坐标
y=0
w=72
h=72
lcRectangleF=BINTOC(x,'F')+BINTOC(y,'F')+BINTOC(W,'F')+BINTOC(H,'F')
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x90000000, 0x90000000, 1, 2, @Brush)
x=1&&绘制文字的左上角坐标
y=1
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
strPath = 0
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)&&strFormat
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*RETURN
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x30000000, 0x30000000, 1, 3, @Brush)
x=1.5&&绘制文字的左上角坐标
y=1.5
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x20000000, 0x20000000, 1, 3, @Brush)
x=2&&绘制文字的左上角坐标
y=2
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x10000000, 0x10000000, 1, 3, @Brush)
x=2.2&&绘制文字的左上角坐标
y=2.2
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x40000000, 0x40000000, 1, 3, @Brush)
x=-1&&绘制文字的左上角坐标
y=-1
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x30000000, 0x30000000, 1, 3, @Brush)
x=-1.5&&绘制文字的左上角坐标
y=-1.5
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
*
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF,0xFF013C8F,0xFF0198D4, 1, 3, @Brush)
x=0&&绘制文字的左上角坐标
y=0
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
pen =0
GdipCreatePen1(0x90000000, 1, 5, @pen)
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, pen, strPath)
参考VB代码
http://tieba.baidu.com/f?kz=702349514
下载地址:
http://www.quwen168.com/lrcshow.rar
现已实现在表单上画出,本来想画到图片中再通过透明窗口来实现,试了一下字体边缘很难看....
主要是这两个API不知道怎么实现
CreateDIBSection
UpdateLayeredWindow
网上找到的CreateDIBSection定义但BHDR_STRUCT_SIZE参数的值不知道是什么
nBitmapWidth=500
nBitmapHeight=300
nBitsPerPixel=24
ppvBits=0
cBITMAPINFOHEADER=num2dword(BHDR_STRUCT_SIZE) +;
num2dword(nBitmapWidth) + num2dword(nBitmapHeight) +;
num2word(1) + num2word(nBitsPerPixel) +;
num2dword(BI_RGB)
cBITMAPINFOHEADER=PADR(cBITMAPINFOHEADER,;
BHDR_STRUCT_SIZE, CHR(20))
hBitmap=CreateDIBSection(hDC, @cBITMAPINFOHEADER,;
DIB_RGB_COLORS, @ppvBits, 0, 0)
以下代码放在一个命令按键里就可看出绘制效果,注意表单的ShowWindow=0
DECLARE INTEGER GdipCreateStringFormat IN GdiPlus.dll ;
INTEGER formatAttributes, INTEGER language, INTEGER @nFormat
DECLARE INTEGER GdipDeleteBrush IN GdiPlus.dll ;
INTEGER brush
DECLARE INTEGER GdipCreateFont IN GdiPlus.dll;
INTEGER fontFamily, SINGLE emSize,;
INTEGER fntstyle, INTEGER unit, INTEGER @fnt
DECLARE INTEGER GdipDeleteFont IN GdiPlus.dll ;
INTEGER fnt
DECLARE INTEGER GdipCreateFontFamilyFromName IN GdiPlus.dll;
STRING familyname, INTEGER FontCollection, INTEGER @FontFamily
DECLARE INTEGER GdipDeleteFontFamily IN GdiPlus.dll ;
INTEGER FontFamily
DECLARE INTEGER GdipCreateFromHWND IN gdiplus.dll ;
INTEGER hWind, INTEGER @graphics
DECLARE INTEGER GdipDeleteGraphics IN GdiPlus.dll ;
INTEGER graphics
DECLARE INTEGER GdipSetSmoothingMode IN "gdiplus" INTEGER ,INTEGER
DECLARE INTEGER GdipCreateFontFamilyFromName IN gdiplus STRING familyname, INTEGER fontCollection, INTEGER @FontFamily
DECLARE INTEGER GdipCreateStringFormat IN gdiplus INTEGER formatAttributes, INTEGER language, INTEGER @fmt
DECLARE integer GdipCreateLineBrushFromRect IN gdiplus.dll string,integer,integer,integer, integer, integer @
DECLARE LONG GdipCreatePath IN GDIPLUS LONG brushmode, LONG @path
DECLARE LONG GdipAddPathStringI IN GDIPLUS LONG path, STRING str, LONG length, LONG family, LONG style, SINGLE emSize, STRING @layoutRect, LONG StringFormat
DECLARE LONG GdipFillPath IN GDIPLUS LONG graphics, LONG brush, LONG path
DECLARE LONG GdipDrawPath IN GDIPLUS LONG graphics, LONG pen, LONG path
DECLARE INTEGER GdipCreatePen1 IN gdiplus INTEGER color,SINGLE penwidth,INTEGER unit,INTEGER @ gdipen
graphics=0
GdipCreateFromHWND(thisform.hwnd,@graphics)
GdipSetSmoothingMode(graphics,2)&&SmoothingModeHighQuality
lcFontName='黑体'&&字体名称,必须是已注册的字体
lcFontName=STRCONV(lcFontName+CHR(0),5)
lnFontFamily=0
GdipCreateFontFamilyFromName(lcFontName,0,@lnFontFamily)
strFormat = 0
GdipCreateStringFormat(0,0,@strFormat)
*DECLARE LONG GdipSetStringFormatAlign IN GDIPLUS LONG @StringFormat, LONG
*GdipSetStringFormatAlign(@strFormat,1)
x=0&&绘制文字的左上角坐标
y=0
w=72
h=72
lcRectangleF=BINTOC(x,'F')+BINTOC(y,'F')+BINTOC(W,'F')+BINTOC(H,'F')
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x90000000, 0x90000000, 1, 2, @Brush)
x=1&&绘制文字的左上角坐标
y=1
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
strPath = 0
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)&&strFormat
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*RETURN
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x30000000, 0x30000000, 1, 3, @Brush)
x=1.5&&绘制文字的左上角坐标
y=1.5
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x20000000, 0x20000000, 1, 3, @Brush)
x=2&&绘制文字的左上角坐标
y=2
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x10000000, 0x10000000, 1, 3, @Brush)
x=2.2&&绘制文字的左上角坐标
y=2.2
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x40000000, 0x40000000, 1, 3, @Brush)
x=-1&&绘制文字的左上角坐标
y=-1
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF, 0x30000000, 0x30000000, 1, 3, @Brush)
x=-1.5&&绘制文字的左上角坐标
y=-1.5
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
*
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, 0, strPath)
*---
Brush = 0
GdipCreateLineBrushFromRect(lcRectangleF,0xFF013C8F,0xFF0198D4, 1, 3, @Brush)
x=0&&绘制文字的左上角坐标
y=0
rclayout=BINTOC(x,'4rs')+BINTOC(y,'4rs')
pen =0
GdipCreatePen1(0x90000000, 1, 5, @pen)
GdipCreatePath(0,@strPath)
GdipAddPathStringI(strPath, STRCONV('QQ音乐,我最流行!'+CHR(0),5), -1, lnFontFamily, 1, 72, rclayout, strFormat)
GdipFillPath(graphics, Brush, strPath)
GdipDrawPath(graphics, pen, strPath)
...全文
相关推荐
VFP调用gdi+演示文字特效.rar
总的来说,VFP调用GDI+实现文字特效,需要熟悉GDI+的API,了解如何在VFP中创建和操作图形对象,以及如何将这些操作整合到VFP的事件处理机制中。
VFP的API例程
例如,可以使用API来实现文件操作、进程控制、网络通信,甚至是硬件交互。在学习和实践VFP调用API的过程中,查阅官方文档和参考手册是非常重要的。
VFP9利用_GdiPlus类处理图片分辨率及缩放
在Visual FoxPro 9(VFP9)中,开发者经常需要处理图像的分辨率和缩放问题,以便在不同尺寸的屏幕或输出设备上呈现最佳效果。
VFP6运行库
开发者需要对VFP6的API有深入理解,才能充分利用其强大的数据库管理和编程能力。
VFP9.0 运行库.rar
在VFP9.0中,它支持高级图形绘制、图片加载和显示,为用户界面设计提供了强大的图形支持。GDI+的引入,让VFP9.0可以创建更加美观且功能丰富的图形用户界面。3.


