图形旋转

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 cxmty 的 blog

‘在窗体上加两个picturebox控件,五个option控件放在frame框架上,一个按钮

option explicit
const pi = 3.1416
dim jiaodu as double
function b(i)
dim x as integer, y as integer
dim x1 as integer, y1 as integer
dim x2 as double, y2 as double
dim x3 as double, y3 as double
jiaodu = option1(i).caption

picture2.visible = true
picture2.cls

dim hudu as double
 hudu = jiaodu * pi / 180

 picture1.scalemode = vbpixels
 picture2.scalemode = vbpixels
for x = 0 to picture2.scalewidth

 x1 = x - picture2.scalewidth \ 2
for y = 0 to picture2.scaleheight
   y1 = y - picture2.scaleheight \ 2
   x2 = x1 * cos(-hudu) + y1 * sin(-hudu)
   y2 = y1 * cos(-hudu) - x1 * sin(-hudu)
   x3 = x2 + picture1.scalewidth \ 2
   y3 = y2 + picture1.scaleheight \ 2
 if x3 > 0 and x3 < picture1.scalewidth - 1 and y3 > 0 and y3 < picture1.scaleheight - 1 then
  picture2.pset (x, y), picture1.point(x3, y3)
 end if
 next y
next x
 
   picture1.visible = false
  end function


private sub command1_click()
dim i as single
if option1(0).value = true then
    shape1.visible = false
 
   call b(0)
elseif option1(1).value = true then
 
   shape1.visible = false
   call b(1)
elseif option1(2).value = true then
   shape1.visible = false
  
   call b(2)
elseif option1(3).value = true then
   shape1.visible = false
   call b(3)
 else
   shape1.visible = true
   picture2.cls
end if
 
 end sub

private sub form_load()
picture2.visible = true
picture1.visible = false

shape1.visible = true
end sub

private sub frame1_click()  ‘单击框架恢复
 shape1.visible = true
   picture2.cls
end sub

本文关键:vb
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top