以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  这段代码如果放在菜单的DialogLauncherClick事件里应该怎么改??  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=64632)

--  作者:jinzhengbe
--  发布时间:2015/2/26 4:19:00
--  这段代码如果放在菜单的DialogLauncherClick事件里应该怎么改??

\'Dim Bar As New BarCodeBuilder

\'Bar.Symbology = Barpro.Symbology.QRCode

\'Bar.BarRatio = 0.3

\'Bar.BarWidth = 1

\'Bar.BarHeight = 1

\'Bar.QuietZoneWidth = 2

For Each r As DataRow In DataTables("newtrj").Select("id>1")   \'从数据表中提取数据

   \' bar.Code = r("qrcord")

    Dim fn As String = ""

    fn = r("cn_name")

Dim vv As String =  fn & ".jpeg"

     If fn <> "" And filesys.FileExists("d:\\as\\" & vv) = True Then

        Dim route As String = "d:\\as\\" & vv \'原始照片存放路径

        Dim route2 As String ="d:\\qrcord\\" & vv

        Dim zwidth = getImage(route).width \'原始照片宽

        Dim zheight = getImage(route).height \'原始照片高

       

       

Dim p As WinForm.Painter =e.Form.CreateControl("p", ControlTypeEnum.Painter)

        p.Width = zwidth \'原始照片宽动态赋给画板宽

        p.Height = zheight \'原始照片高动态赋给画板高

        Dim g As Graphics = p.Graphics

        g.Clear(Color.White)

        g.DrawImage(getImage(route),0,0,zwidth,zheight)

       \' g.DrawImage(bar.GetImage,(zwidth-200),(zheight-680),150,150)

        Dim rm As New prt.RenderImage \'定义一个图片对象

        \'rm.Image = GetImage("archives.ico") \'设置图片

        \'rm.Style.ImageAlign.StretchHorz = True \'水平拉伸

        \'g.DrawImage(rm.Image,(zwidth-75),(zheight-85),30,30)

        Dim fnt As New Font("黑体",30,FontStyle.Bold) \'黑体,10,加粗

        g.DrawString(fn,fnt,Brushes.Aqua,(zwidth-280),(zheight-38))

        p.Repaint()

       \' Dim img As Image = p.Image

         \'   p.Save(route2)

       \'   img.save(route2)

           Dim img As Image = p.Image

        \'p.Save(route2)

        img.save(route2,System.Drawing.Imaging.ImageFormat.jpeg)

 

    End If

Next

MessageBox.Show("全部添加成功!", "提示")

 


--  作者:Bin
--  发布时间:2015/2/26 9:13:00
--  
=e.Form.

改为

forms("XX") 即可
确保窗口已经打开

或者在代码最前面加入判断

if Forms("XX").Opened = false then
return
end if

--  作者:有点甜
--  发布时间:2015/2/26 9:15:00
--  

呃,什么意思?直接改一下窗口名即可啊

 

For Each r As DataRow In DataTables("newtrj").Select("id>1")   \'从数据表中提取数据
   
    \' bar.Code = r("qrcord")
   
    Dim fn As String = ""
   
    fn = r("cn_name")
   
    Dim vv As String =  fn & ".jpeg"
   
    If fn <> "" And filesys.FileExists("d:\\as\\" & vv) = True Then
       
        Dim route As String = "d:\\as\\" & vv \'原始照片存放路径
       
        Dim route2 As String ="d:\\qrcord\\" & vv
       
        Dim zwidth = getImage(route).width \'原始照片宽
       
        Dim zheight = getImage(route).height \'原始照片高
       
       
       
       
       
        Dim p As WinForm.Painter = Forms("窗口1").CreateControl("p", ControlTypeEnum.Painter)
       
        p.Width = zwidth \'原始照片宽动态赋给画板宽
       
        p.Height = zheight \'原始照片高动态赋给画板高
       
        Dim g As Graphics = p.Graphics
       
        g.Clear(Color.White)
       
        g.DrawImage(getImage(route),0,0,zwidth,zheight)
       
        \' g.DrawImage(bar.GetImage,(zwidth-200),(zheight-680),150,150)
       
        Dim rm As New prt.RenderImage \'定义一个图片对象
       
        \'rm.Image = GetImage("archives.ico") \'设置图片
       
        \'rm.Style.ImageAlign.StretchHorz = True \'水平拉伸
       
        \'g.DrawImage(rm.Image,(zwidth-75),(zheight-85),30,30)
       
        Dim fnt As New Font("黑体",30,FontStyle.Bold) \'黑体,10号,加粗
       
        g.DrawString(fn,fnt,Brushes.Aqua,(zwidth-280),(zheight-38))
       
        p.Repaint()
       
        \' Dim img As Image = p.Image
       
        \'   p.Save(route2)
       
        \'   img.save(route2)
       
        Dim img As Image = p.Image
       
        \'p.Save(route2)
       
        img.save(route2,System.Drawing.Imaging.ImageFormat.jpeg)
       
       
       
    End If
   
Next

MessageBox.Show("全部添加成功!", "提示")

 


--  作者:jinzhengbe
--  发布时间:2015/2/26 10:08:00
--  
奥 是这样啊啊,搞了半天没高出来 非常非常感谢啊
--  作者:jinzhengbe
--  发布时间:2015/2/26 10:08:00
--  
奥 是这样啊啊,搞了半天没高出来 非常非常感谢啊