以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  专业报表可以设置图片的透明度吗  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=179912)

--  作者:rogen
--  发布时间:2022/9/17 15:10:00
--  专业报表可以设置图片的透明度吗
在专业报表里嵌入图片,可以设置透明度吗?
--  作者:有点蓝
--  发布时间:2022/9/17 17:36:00
--  
通过绘制的方式设置

Dim doc As New PrintDoc

Dim rt As New prt.RenderText \'定义一个文本对象
rt.Text = "Hello Foxtable" \'设置文本对象的内容
rt.Style.Font = New Font("宋体", 40f)
rt.x = 30
rt.y = 60
doc.Body.Children.Add(rt)

Dim colorAlpha As Single = 0.5 \'透明度:0-1
Dim matrixItems = { New Single() { 1 , 0 , 0 , 0 , 0 }, New Single() { 0 , 1 , 0 , 0 , 0 }, New Single() { 0 , 0 , 1 , 0 , 0 }, New Single() { 0 , 0 , 0 , colorAlpha, 0 }, New Single() { 0 , 0 , 0 , 0 , 1 }}
Dim colorMatrix As New ColorMatrix(matrixItems)

Dim imageAtt As New ImageAttributes()
imageAtt.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap)
Dim img As Image = GetImage("1.png")
Dim rg1 As New prt.RenderGraphics()
rg1.Graphics.DrawImage(img, New Rectangle( 0 , 0 , 300, 300), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel , imageAtt) \'绘制透明
\'rg1.Graphics.DrawImage(GetImage("1.png"), 0, 0, 300, 300) \'绘制不透明
rg1.x = 30
rg1.y = 30
Doc.Body.Children.Add(rg1)

Doc.Preview()