以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]关于渐变  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=114233)

--  作者:l1q2lq
--  发布时间:2018/2/1 11:24:00
--  [求助]关于渐变
参考了论坛的几个例子,例子中窗口Afterload事件无法成功加载Panel渐变,代码如下:

窗口与控件事件 

窗口1_AfterLoad 

addHandler e.Form.baseform.paint, AddressOf Form_Paint

自定义函数 

渐变色 

Dim sender As object = Args(0)

Dim e As System.Windows.Forms.PaintEventArgs = Args(1)

Dim Str() As String = Args(2).Split("|")

Dim p As System.Windows.Forms.Panel = Forms(Str(0)).controls(Str(1)).baseControl

Dim brush As new LinearGradientBrush(p.ClientRectangle, Color.Blue, Color.White , LinearGradientMode.Vertical)

Dim g As Graphics = p.CreateGraphics()

g.FillRectangle(brush, p.ClientRectangle)

全局代码 

API 

Public Sub Form_Paint(sender As object, e As System.Windows.Forms.PaintEventArgs)

    Dim p As System.Windows.Forms.Panel = Forms("窗口1").controls("Panel1").baseControl

   \' Dim brush As new LinearGradientBrush(p.ClientRectangle, Color.white, Color.black , LinearGradientMode.Horizontal)

   \' Dim g As Graphics = p.CreateGraphics()

   \' g.FillRectangle(brush, p.ClientRectangle)

Functions.Execute("渐变色",sender,e,"窗口1|Panel1")

End Sub


请老师帮忙看一下是哪里的问题


--  作者:有点甜
--  发布时间:2018/2/1 11:36:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:背景渐变例子.table