鍥炲? 10妤
![](images/smilies/emot/em16.gif)
Declare integer GradientFillRect IN msimg32 long, string @, long, string @, long, long Declare integer GradientFillTriangle in "msimg32" Long, string @, Long, string @, Long, Long DECLARE integer GradientFill IN msimg32 long, string @, long, string @, long, long DECLARE integer GetWindowDC IN WIN32API integer DECLARE integer GetLastError IN WIN32API DECLARE integer ReleaseDC IN WIN32API integer,integer DECLARE INTEGER GetDesktopWindow IN win32api DECLARE INTEGER GetDC IN win32api INTEGER hwnd clea hdc=getdc(_screen.hwnd) overtex=NEWOBJECT("trivertex") overtex.n=3 overtex.set(1,100,100) overtex.set(2,500,500) overtex.set(3,50,400) cvertex=overtex.getstruct() og_r=NEWOBJECT("gradient_rect") og_r.n=3 og_r.set(1,0,1,2) cg_r=og_r.getstruct() GradientFilltriangle(hdc,@cvertex,3,@cg_r,1,2) RELEASE memo like o* RELEASE memo like c* releasedc(_screen.hwnd,hdc) ************************************************** *-- 类: trivertex (d:\documents\visual foxpro 项目\myclass.vcx) *-- 父类: struct (d:\documents\visual foxpro 项目\myclass.vcx) *-- 基类: custom *-- 时间戳: 08/22/24 05:03:08 PM * DEFINE CLASS trivertex AS custom Height = 22 Width = 58 *-- 顶点数,决定所有数组大小,2为矩形,3为三角形,大于3则可以任意组合。 n = .F. *-- 顶点x轴坐标数组 DIMENSION x[2] *-- 顶点y轴坐标数组 DIMENSION y[2] *-- 红色分量数组 DIMENSION r[2] *-- 绿色分量数组 DIMENSION g[2] *-- 蓝色分量数组 DIMENSION b[2] *-- alpha透明度分量数组 DIMENSION a[2] PROCEDURE n_assign LPARAMETERS vNewVal *To do: 为 Assign 方法程序修改此例程 IF m.vnewval<>this.n DIMENSION this.x[m.vnewval] DIMENSION this.y[m.vnewval] DIMENSION this.r[m.vnewval] DIMENSION this.g[m.vnewval] DIMENSION this.b[m.vnewval] DIMENSION this.a[m.vnewval] ENDIF THIS.n = m.vNewVal ENDPROC PROCEDURE getstruct this.struct='' FOR i=1 TO this.n this.struct=this.struct+; BINTOC(this.x[i],[4rs])+; BINTOC(this.y[i],[4rs])+; BINTOC(this.r[i],[2s])+; BINTOC(this.g[i],[2s])+; BINTOC(this.b[i],[2s])+; BINTOC(this.a[i],[2s]) ENDFOR RETURN this.struct ENDPROC PROCEDURE set *!********* 在设置顶点结构前,需要确定有几个顶点,this.n=? **********!* PARAMETERS nindex, x,y,nred,ngreen,nblue,nalpha DO CASE CASE PARAMETERS()=3 ocolor=NEWOBJECT([color],[myclass]) ncolor=GETCOLOR() IF ncolor<0 RELEASE ocolor,ncolor RETURN .f. ELSE ocolor.set(ncolor) this.x[nindex]=x this.y[nindex]=y this.r[nindex]=ocolor.r this.g[nindex]=ocolor.g this.b[nindex]=ocolor.b this.a[nindex]=ocolor.a ENDIF CASE PARAMETERS()=7 this.x[nindex]=x this.y[nindex]=y this.r[nindex]=nred this.g[nindex]=ngreen this.b[nindex]=nblue this.a[nindex]=nalpha OTHERWISE RETURN .f. ENDCASE ENDPROC ENDDEFINE * *-- EndDefine: trivertex **************************************************
[此贴子已经被作者于2024-8-22 20:15编辑过]