如题,谁给个代码.
解决方案 »
- VB6 写的 ActiveX EXE 如何能够 使用 GetObject() 来呼叫
- 100分探求VB开发嵌入式数据库的方法
- 有关自动编码的问题:如何实现在窗体上输入3,则生成"001", 输入5,则生成“00001”?
- VB调用EXCEL的问题again
- 怎么去掉WebBrowser控件的右边的和下边的滚动条
- 如何动态改会data控件的属性??(急,在线等待)
- 求助:MDI窗体如何使右上角“关闭”按纽无效?
- asp的Response.Write的问题?
- 請教:vb里dim oRs as ADODB.Recordset 與dim oRs as new ADODB.Recordset的區別在哪里?
- 小弟马上毕业去深圳,有没有深圳的前辈啊,交个朋友? ... 散分
- 征集提高效率的方法或工具(各方面的都行)
- 关于 VB 窗口的 unload 事件
Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Sub Form_Click()
'end..
Unload Me
End Sub
Private Sub Form_Load()
Me.Width = 800 * 15
Me.Height = 600 * 15
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim hRgn As Long
Const sText = "o"
'set the font to 'Times New Romen, size 72'
Me.FontName = "Times New Roman"
Me.FontSize = 256
'set the backcolor to Red
Me.BackColor = vbRed
'open a path bracket
BeginPath Me.hdc
'draw the text
TextOut Me.hdc, 0, 0, sText, Len(sText)
'close the path bracket
EndPath Me.hdc
'convert the path to a region
hRgn = PathToRegion(Me.hdc)
'set the Window-region
SetWindowRgn Me.hWnd, hRgn, True
'destroy our region
DeleteObject hRgn
End Sub偷个懒。
http://topic.csdn.net/u/20080610/11/f98b1bc3-9419-46b0-8d1b-260142860930.html
模块代码:
Public Declare Function SetWindowRgn Lib "user32" _
( _
ByVal hWnd As Long, ByVal hRgn As Long, _
ByVal bRedraw As Boolean _
) As LongPublic Declare Function CombineRgn Lib "gdi32" _
( _
ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, _
ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long _
) As LongPublic Const RGN_AND = 1
'将两个区域相加
Public Const RGN_COPY = 5
'创建hSrcRgn1的拷贝
Public Const RGN_DIFF = 4
'将两个区域相减
Public Const RGN_OR = 2
'将两个区域进行或操作
Public Const RGN_XOR = 3
'将两个区域进行异或操作
Public Const RGN_MAX = RGN_COPY
Public Const RGN_MIN = RGN_ANDPublic Sub SetWindow(f1 As Form)
'该子过程实现设置窗口形状
Dim hSrcRgn1, hSrcRgn2, hSrcRgn3 As Long
hSrcRgn1 = CreateEllipticRgn(5, 23, 397, 415)
'创建最外面的大圆区域
hSrcRgn2 = CreateEllipticRgn(90, 74, 395, 362)
'创建中间的圆区域
hSrcRgn3 = CreateEllipticRgn(183, 120, 395, 320)
'创建最里层的小圆区域
CombineRgn hSrcRgn1, hSrcRgn1, hSrcRgn2, RGN_DIFF
'用大圆减去中间的圆得到的区域保存在hSrcRgn1
CombineRgn hSrcRgn1, hSrcRgn1, hSrcRgn3, RGN_OR
'用得到的区域加上小圆并保存在hSrcRgn1
SetWindowRgn f1.hWnd, hSrcRgn1, True
End Sub
Public Sub Reset(f1 As Form)
'该子过程实现恢复窗口形状为矩形
Dim hSrcRgn4 As Long
hSrcRgn4 = CreateRectRgn(0, 0, f1.Width, f1.Height)
'创建矩形
SetWindowRgn f1.hWnd, hSrcRgn4, True
'将窗口恢复为矩形
End Sub窗体代码:Private Sub Form_Click()
'单击窗口则调用SetWindow子过程设置窗口形状
SetWindow Form1
'设置窗口形状
End SubPrivate Sub Form_DblClick()
'双击窗口则调用Reset子过程恢复窗口形状
Reset Form1
'将窗口恢复为矩形
End SubPrivate Sub Form_Load()
SetWindow Form1
End Sub
(x,y) 代表圆心
radius 代表半径
color 代表颜色
start 代表起始弧度
end 代表结束弧度 *start与end差距不能大于360
eg:
Private Sub Command1_Click()
Const rPI As Single = 3.14159265358979 '圆周率
Me.Cls '清屏
Me.Circle (1400, 1400), 1000, , 0, Val(Text1.Text) / 180 * rPI
End Sub