使⽤过ACDSEE的朋友⼀定对它的JPG图⽚旋转功能记忆犹新,其实我们利⽤VB6的先进功能,可以对任意格式的图⽚⽂件(包括JPG、GIF、BMP、ICO等)进⾏45度、180度旋转,确实可以和ACDSEE⼀较⾼下。
  启动vb6建⽴⼀个标准exe⼯程,⾸先添加两个图⽚框(picture1和picture2),添加三个命令按钮
command1(caption=“正常显⽰”)、command2(caption=“180度倒⽴”)、command3(caption=“45度旋转”),双击窗体,写⼊以下代码:
  PrivateConstSRCCOPY=&HCC0020
  PrivateConstPi=3.14
  PrivateDeclareFunctionSetPixelLib"gdi32"(ByValhdcAsLong,
ByValxAsLong,ByValyAsLong,ByValcrColorAsLong)AsLong
  PrivateDeclareFunctionGetPixelLib"gdi32"(ByValhdcAsLong, ByValxAsLong,ByValyAsLong)AsLong
  PrivateDeclareFunctionStretchBltLib"gdi32"(ByValhdcAsLong, 
ByValxAsLong,ByValyAsLong,ByValnWidthAsLong,ByValnHeightAsLong,   
ByValhSrcDCAsLong,ByValxSrcAsLong,ByValySrcAsLong,ByValnSrcWidth
AsLong,ByValnSrcHeightAsLong,ByValdwRopAsLong)  AsLong
  privateSubbmp_rotate(pic1AsPictureBox,pic2AsPictureBox,ByValtheta)‘45度旋转
  Dimc1xAsInteger,c1yAsInteger
  Dimc2xAsInteger,c2yAsInteger
  DimaAsSingle
  Dimp1xAsInteger,p1yAsInteger
  Dimp2xAsInteger,p2yAsInteger
  DimnAsInteger,rAsInteger
  c1x=pic1.ScaleWidth\2
  c1y=pic1.ScaleHeight\2
  c2x=pic2.ScaleWidth\2
  c2y=pic2.ScaleHeight\2
  Ifc2x
   n=n-1
   pic1hDC=pic1.hdc
   pic2hDC=pic2.hdc
   Forp2x=0Ton
   Forp2y=0Tonfunction怎么记忆