客户的要求是:
用VB编程实现如下功能:打开这张图片A,然后在图片A上写几个字(比较说CSDN)
然后保存(文件名为图片B)
就是这么一个功能,不知道哪位高手可以给一个解决方案,急用,好让小弟我
解决燃眉之急啊!谢谢
26 个解决方案
#1
Print加Savepicture就够了。
#2
查查csdn就可以了。呵呵
#3
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
#4
同意楼上,picture1是一个PictureBox
#5
我现在要求在图片上放一个文本框控件,然后在文本框里里写数据,在保存,
这个怎么实现
这个怎么实现
#6
怎么没人知道啊!救命啊!
#7
用一个固定格式来存储文本相关信息,如文字内容,字体大小,显示位置等,打开文件时候读取这些信息,然后调用API画图函数在PICTURE上绘制这些文字就是了
#8
分数不够 可以再加的
#9
能不能具体一点给出一个例子呢!求
#10
文件名B.txt
格式:
5
4,10,200,"text1",100,0.4,255
4,10,10,"text1ghg",100,0.4,255
4,50,400,"teghg1",100,0.4,255
4,400,50,"ghgtt1",100,0.4,255
4,65,50,"ghgt1",100,0.4,255
解释:
该图片元素个数
4表示该元素为文本,X=10,Y=200,文本内容=“text1",字体高100,宽高比0.4,颜色rgb值=255
......
读出之后依次设置坐标,字体的参数,再进行绘制,够详细了吧
格式:
5
4,10,200,"text1",100,0.4,255
4,10,10,"text1ghg",100,0.4,255
4,50,400,"teghg1",100,0.4,255
4,400,50,"ghgtt1",100,0.4,255
4,65,50,"ghgt1",100,0.4,255
解释:
该图片元素个数
4表示该元素为文本,X=10,Y=200,文本内容=“text1",字体高100,宽高比0.4,颜色rgb值=255
......
读出之后依次设置坐标,字体的参数,再进行绘制,够详细了吧
#11
是挺详细的,但我们老板的要求是做成像下面这样子的
http://www.brandworks.com.cn/ains/2004-12-2015145276305.html?bbname=123456789
(注:123456789可以随便书写)
,不知道是不是和你的思路是差不多的呢!
http://www.brandworks.com.cn/ains/2004-12-2015145276305.html?bbname=123456789
(注:123456789可以随便书写)
,不知道是不是和你的思路是差不多的呢!
#12
你那链接页面中有两幅图,估计你要做成下面那一幅的样子:在已有图片背景上加上自己的文字。
如果是那样,前面有向位的使用print、使用savepicture就应该能成的
如果是那样,前面有向位的使用print、使用savepicture就应该能成的
#13
如果是第一幅图那样打上些非水平方向的文件,就要麻烦一点……究竟是要那种效果呢?
#14
应该是前一种效果啊!
#15
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
这一句后面的位置自己调整怎么写的啊! Picture1.Print "CSDN" '具体输出位置自己调整
还望给出详细的参数,谢谢,等当中
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
这一句后面的位置自己调整怎么写的啊! Picture1.Print "CSDN" '具体输出位置自己调整
还望给出详细的参数,谢谢,等当中
#16
这种效果应使用API,自建逻辑字体解决,可支持旋转文字效果。
用于网络传输,图片输出BMP格式也不合适,你还需了解JPG压缩。
这样一看,就有点话长了,从提问中可感觉出,你的知识储备,还不够。。。不知从何说起:(
用于网络传输,图片输出BMP格式也不合适,你还需了解JPG压缩。
这样一看,就有点话长了,从提问中可感觉出,你的知识储备,还不够。。。不知从何说起:(
#17
那却是了啊!不过能不能告诉我
Picture1.Print "CSDN" '具体输出位置自己调整
这个位置要怎么调整的呢!
Picture1.Print "CSDN" '具体输出位置自己调整
这个位置要怎么调整的呢!
#18
如果文字方向不是水平的,看一下我的代码:
Private Const LF_FACESIZE = 32
private Const DEFAULT_CHARSET = 1
private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long) As Long
''''''''''''''''''''''''''''''''''''
''''以下代码可实现文字任意角度的旋转
''''''''''''''''''''''''''''''''''''
Dim Font As LOGFONT, hOldFont As Long, hFont As Long
'假设你显示背景图的对象为picturebox,名为picture1
With picture1
RtlMoveMemory Font.lfFaceName(0), ByVal CStr(.Font.Name), LenB(StrConv(.Font.Name, vbFromUnicode)) + 1
Font.lfHeight = (.Font.Size * -20) / Screen.TwipsPerPixelY
'逆时针旋转角度XXX,可自行设置XXX的值
Font.lfEscapement = XXX* 10
Font.lfWeight = IIf(.Font.Bold, 700, 400)
Font.lfItalic = .Font.Italic
Font.lfUnderline = .Font.Underline
Font.lfStrikeOut = .Font.Strikethrough
Font.lfCharSet = DEFAULT_CHARSET
hFont = CreateFontIndirect(Font)
hOldFont = SelectObject(.hdc, hFont)
.ForeColor =rgb(255,0,0) '假定文件为红色
'打印文字的起始坐标
.CurrentX = 100
.CurrentY = 50
'打印文字
picture1.Print sText
SelectObject .hdc, hOldFont
'释放对象
DeleteObject hOldFont
DeleteObject hFont
End With
Public Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(0 To LF_FACESIZE - 1) As Byte
End Type
Private Const LF_FACESIZE = 32
private Const DEFAULT_CHARSET = 1
private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long) As Long
''''''''''''''''''''''''''''''''''''
''''以下代码可实现文字任意角度的旋转
''''''''''''''''''''''''''''''''''''
Dim Font As LOGFONT, hOldFont As Long, hFont As Long
'假设你显示背景图的对象为picturebox,名为picture1
With picture1
RtlMoveMemory Font.lfFaceName(0), ByVal CStr(.Font.Name), LenB(StrConv(.Font.Name, vbFromUnicode)) + 1
Font.lfHeight = (.Font.Size * -20) / Screen.TwipsPerPixelY
'逆时针旋转角度XXX,可自行设置XXX的值
Font.lfEscapement = XXX* 10
Font.lfWeight = IIf(.Font.Bold, 700, 400)
Font.lfItalic = .Font.Italic
Font.lfUnderline = .Font.Underline
Font.lfStrikeOut = .Font.Strikethrough
Font.lfCharSet = DEFAULT_CHARSET
hFont = CreateFontIndirect(Font)
hOldFont = SelectObject(.hdc, hFont)
.ForeColor =rgb(255,0,0) '假定文件为红色
'打印文字的起始坐标
.CurrentX = 100
.CurrentY = 50
'打印文字
picture1.Print sText
SelectObject .hdc, hOldFont
'释放对象
DeleteObject hOldFont
DeleteObject hFont
End With
Public Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(0 To LF_FACESIZE - 1) As Byte
End Type
#19
先行谢过,我先去试一下先啊!
#20
结构体LOGFONT申明应放在过程前面,贴代码时弄错了!
#21
我知道了
#22
我现在有一张空白的图片
进行了如下操作:
picture1.print ("what are you doing")
SavePicture picture1.image "g:\dd.bmp"
打开dd.bmp这张图片
还是空白的,这是为什么(也就是说"what are you doing"这几个字根本就没有加进去)
还望赐教,分数不够可以再加
进行了如下操作:
picture1.print ("what are you doing")
SavePicture picture1.image "g:\dd.bmp"
打开dd.bmp这张图片
还是空白的,这是为什么(也就是说"what are you doing"这几个字根本就没有加进去)
还望赐教,分数不够可以再加
#23
如何将bmp转换成jpg
#24
picture1.autoredraw=true
#25
thirdapple(.:RNPA:.陨落雕-努力不一定有回报) ( ) 说的没错
#26
bbname作为参数传递,显示起点位置和显示文本所占的长度和字体等信息应该是固定的,在绘制的时候判断传入参数的长度,如果小于每行(竖行)要显示的文字个数,在中间适当的位置插入空格,如果大于每行(竖行)要显示的文字个数,在适当的位置换行
#1
Print加Savepicture就够了。
#2
查查csdn就可以了。呵呵
#3
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
#4
同意楼上,picture1是一个PictureBox
#5
我现在要求在图片上放一个文本框控件,然后在文本框里里写数据,在保存,
这个怎么实现
这个怎么实现
#6
怎么没人知道啊!救命啊!
#7
用一个固定格式来存储文本相关信息,如文字内容,字体大小,显示位置等,打开文件时候读取这些信息,然后调用API画图函数在PICTURE上绘制这些文字就是了
#8
分数不够 可以再加的
#9
能不能具体一点给出一个例子呢!求
#10
文件名B.txt
格式:
5
4,10,200,"text1",100,0.4,255
4,10,10,"text1ghg",100,0.4,255
4,50,400,"teghg1",100,0.4,255
4,400,50,"ghgtt1",100,0.4,255
4,65,50,"ghgt1",100,0.4,255
解释:
该图片元素个数
4表示该元素为文本,X=10,Y=200,文本内容=“text1",字体高100,宽高比0.4,颜色rgb值=255
......
读出之后依次设置坐标,字体的参数,再进行绘制,够详细了吧
格式:
5
4,10,200,"text1",100,0.4,255
4,10,10,"text1ghg",100,0.4,255
4,50,400,"teghg1",100,0.4,255
4,400,50,"ghgtt1",100,0.4,255
4,65,50,"ghgt1",100,0.4,255
解释:
该图片元素个数
4表示该元素为文本,X=10,Y=200,文本内容=“text1",字体高100,宽高比0.4,颜色rgb值=255
......
读出之后依次设置坐标,字体的参数,再进行绘制,够详细了吧
#11
是挺详细的,但我们老板的要求是做成像下面这样子的
http://www.brandworks.com.cn/ains/2004-12-2015145276305.html?bbname=123456789
(注:123456789可以随便书写)
,不知道是不是和你的思路是差不多的呢!
http://www.brandworks.com.cn/ains/2004-12-2015145276305.html?bbname=123456789
(注:123456789可以随便书写)
,不知道是不是和你的思路是差不多的呢!
#12
你那链接页面中有两幅图,估计你要做成下面那一幅的样子:在已有图片背景上加上自己的文字。
如果是那样,前面有向位的使用print、使用savepicture就应该能成的
如果是那样,前面有向位的使用print、使用savepicture就应该能成的
#13
如果是第一幅图那样打上些非水平方向的文件,就要麻烦一点……究竟是要那种效果呢?
#14
应该是前一种效果啊!
#15
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
这一句后面的位置自己调整怎么写的啊! Picture1.Print "CSDN" '具体输出位置自己调整
还望给出详细的参数,谢谢,等当中
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("C:\1.bmp")
Picture1.Print "CSDN" '具体输出位置自己调整
SavePicture Picture1.Image, "C:\2.bmp"
End Sub
这一句后面的位置自己调整怎么写的啊! Picture1.Print "CSDN" '具体输出位置自己调整
还望给出详细的参数,谢谢,等当中
#16
这种效果应使用API,自建逻辑字体解决,可支持旋转文字效果。
用于网络传输,图片输出BMP格式也不合适,你还需了解JPG压缩。
这样一看,就有点话长了,从提问中可感觉出,你的知识储备,还不够。。。不知从何说起:(
用于网络传输,图片输出BMP格式也不合适,你还需了解JPG压缩。
这样一看,就有点话长了,从提问中可感觉出,你的知识储备,还不够。。。不知从何说起:(
#17
那却是了啊!不过能不能告诉我
Picture1.Print "CSDN" '具体输出位置自己调整
这个位置要怎么调整的呢!
Picture1.Print "CSDN" '具体输出位置自己调整
这个位置要怎么调整的呢!
#18
如果文字方向不是水平的,看一下我的代码:
Private Const LF_FACESIZE = 32
private Const DEFAULT_CHARSET = 1
private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long) As Long
''''''''''''''''''''''''''''''''''''
''''以下代码可实现文字任意角度的旋转
''''''''''''''''''''''''''''''''''''
Dim Font As LOGFONT, hOldFont As Long, hFont As Long
'假设你显示背景图的对象为picturebox,名为picture1
With picture1
RtlMoveMemory Font.lfFaceName(0), ByVal CStr(.Font.Name), LenB(StrConv(.Font.Name, vbFromUnicode)) + 1
Font.lfHeight = (.Font.Size * -20) / Screen.TwipsPerPixelY
'逆时针旋转角度XXX,可自行设置XXX的值
Font.lfEscapement = XXX* 10
Font.lfWeight = IIf(.Font.Bold, 700, 400)
Font.lfItalic = .Font.Italic
Font.lfUnderline = .Font.Underline
Font.lfStrikeOut = .Font.Strikethrough
Font.lfCharSet = DEFAULT_CHARSET
hFont = CreateFontIndirect(Font)
hOldFont = SelectObject(.hdc, hFont)
.ForeColor =rgb(255,0,0) '假定文件为红色
'打印文字的起始坐标
.CurrentX = 100
.CurrentY = 50
'打印文字
picture1.Print sText
SelectObject .hdc, hOldFont
'释放对象
DeleteObject hOldFont
DeleteObject hFont
End With
Public Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(0 To LF_FACESIZE - 1) As Byte
End Type
Private Const LF_FACESIZE = 32
private Const DEFAULT_CHARSET = 1
private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long) As Long
''''''''''''''''''''''''''''''''''''
''''以下代码可实现文字任意角度的旋转
''''''''''''''''''''''''''''''''''''
Dim Font As LOGFONT, hOldFont As Long, hFont As Long
'假设你显示背景图的对象为picturebox,名为picture1
With picture1
RtlMoveMemory Font.lfFaceName(0), ByVal CStr(.Font.Name), LenB(StrConv(.Font.Name, vbFromUnicode)) + 1
Font.lfHeight = (.Font.Size * -20) / Screen.TwipsPerPixelY
'逆时针旋转角度XXX,可自行设置XXX的值
Font.lfEscapement = XXX* 10
Font.lfWeight = IIf(.Font.Bold, 700, 400)
Font.lfItalic = .Font.Italic
Font.lfUnderline = .Font.Underline
Font.lfStrikeOut = .Font.Strikethrough
Font.lfCharSet = DEFAULT_CHARSET
hFont = CreateFontIndirect(Font)
hOldFont = SelectObject(.hdc, hFont)
.ForeColor =rgb(255,0,0) '假定文件为红色
'打印文字的起始坐标
.CurrentX = 100
.CurrentY = 50
'打印文字
picture1.Print sText
SelectObject .hdc, hOldFont
'释放对象
DeleteObject hOldFont
DeleteObject hFont
End With
Public Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(0 To LF_FACESIZE - 1) As Byte
End Type
#19
先行谢过,我先去试一下先啊!
#20
结构体LOGFONT申明应放在过程前面,贴代码时弄错了!
#21
我知道了
#22
我现在有一张空白的图片
进行了如下操作:
picture1.print ("what are you doing")
SavePicture picture1.image "g:\dd.bmp"
打开dd.bmp这张图片
还是空白的,这是为什么(也就是说"what are you doing"这几个字根本就没有加进去)
还望赐教,分数不够可以再加
进行了如下操作:
picture1.print ("what are you doing")
SavePicture picture1.image "g:\dd.bmp"
打开dd.bmp这张图片
还是空白的,这是为什么(也就是说"what are you doing"这几个字根本就没有加进去)
还望赐教,分数不够可以再加
#23
如何将bmp转换成jpg
#24
picture1.autoredraw=true
#25
thirdapple(.:RNPA:.陨落雕-努力不一定有回报) ( ) 说的没错
#26
bbname作为参数传递,显示起点位置和显示文本所占的长度和字体等信息应该是固定的,在绘制的时候判断传入参数的长度,如果小于每行(竖行)要显示的文字个数,在中间适当的位置插入空格,如果大于每行(竖行)要显示的文字个数,在适当的位置换行