⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modgeral.bas

📁 这个代码是基于软盘修复
💻 BAS
字号:
Attribute VB_Name = "modGeral"
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/03/20
'描    述:软盘分析修复维护工具 Ver 1.3.0
'网    站:http://www.Mndsoft.com/  (VB6源码博客)
'网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
'e-mail  :Mndsoft@163.com
'e-mail  :Mndsoft@126.com
'OICQ    :88382850
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************

Option Explicit

'------------------------------------------------Windows API
Private Declare Function Polygon Lib "gdi32" (ByVal hDC As Long, lpPoint As Point, ByVal nCount As Long) As Long
Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As Any, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
Private Declare Function FillRgn Lib "gdi32" (ByVal hDC As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Public Declare Function GetVersionEx Lib "kernel32" Alias _
       "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long


Const ALTERNATE = 1

'--------------------------------------------Types and Enums
Public Type Point
  X As Long
  Y As Long
End Type

Public Enum AMPMmode
  H24 = 1
  H12 = 2
End Enum


Private Type OSVERSIONINFO
  dwOSVersionInfoSize As Long
  dwMajorVersion As Long
  dwMinorVersion As Long
  dwBuildNumber As Long
  dwPlatformId As Long
  szCSDVersion As String * 128 '  Maintenance string for PSS usage
End Type

'dwPlatforID Constants
Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2


'-------------------------------------------------------GetWindowsVersion
Public Function GetWindowsVersion() As Long  '0-don't know  1-Win9x/Me  2-WinNT/2000/XP
  Dim tOSVer As OSVERSIONINFO
    
  tOSVer.dwOSVersionInfoSize = Len(tOSVer)
  GetVersionEx tOSVer
  GetWindowsVersion = 0
  Select Case tOSVer.dwPlatformId
    Case VER_PLATFORM_WIN32_NT
      If tOSVer.dwMajorVersion >= 5 Then
        GetWindowsVersion = 2  ' Windows 2000
      Else
        GetWindowsVersion = 2  ' Windows NT
      End If
    Case Else
      If tOSVer.dwMajorVersion >= 5 Then
        GetWindowsVersion = 1  ' Windows ME
      ElseIf tOSVer.dwMajorVersion = 4 And tOSVer.dwMinorVersion > 0 Then
        GetWindowsVersion = 1  ' Windows 98
      Else
        GetWindowsVersion = 1  ' Windows 95
      End If
  End Select
End Function

'-------------------------------------------------------Hi and Low Word
Public Function LoWord(ByVal LongVal As Long) As Long
  LoWord = LongVal And &HFFFF&
End Function

Public Function HiWord(ByVal LongVal As Long) As Long
  If LongVal = 0 Then
    HiWord = 0
    Exit Function
  End If
  HiWord = LongVal \ &H10000 And &HFFFF&
End Function

'-------------------------------------------------------Str3
Public Function Str03(ByVal Value As Long) As String
  Dim res As String
  
  res = Trim(Str(Value))
  Do While Len(res) < 3
    res = "0" & res
  Loop
  Str03 = res
End Function

'-------------------------------------------------------Str0N
Public Function Str0N(ByVal Value As Long, ByVal Tam As Byte) As String
  Dim res As String
  
  res = Trim(Str(Value))
  Do While Len(res) < Tam
    res = "0" & res
  Loop
  Str0N = res
End Function

'-------------------------------------------------------StrN
Public Function StrN(ByVal Tam As Long, ByVal Text As String) As String
  Do While Len(Text) < Tam
    Text = Text & " "
  Loop
  StrN = Text
End Function

'---------------------------------------------------StrClock
Public Function StrClock(ByVal Value As Long) As String
  Dim Horas As Long, aux As Long, Minu As Long, Secs As Long
  Dim res As String
  
  Horas = Value \ 3600
  aux = Value - (Horas * 3600)
  Minu = aux \ 60
  Secs = aux - (Minu * 60)
  res = Str0N(Horas, 2) & ":" & Str0N(Minu, 2) & ":" & Str0N(Secs, 2)
  StrClock = res
End Function

'-------------------------------------------GetFormCursorPos
Public Sub GetFormCursorPos(ByRef Mouse As Point, ByVal fX As Long, ByVal fY As Long, ByRef FormPos As Point)
  Dim formX As Long
  Dim formY As Long
  
  formX = fX / Screen.TwipsPerPixelX
  formY = fY / Screen.TwipsPerPixelY
  FormPos.X = Mouse.X - formX
  FormPos.Y = Mouse.Y - formY
End Sub

'----------------------------------------------IsInsideImage
Public Function IsInsideImage(ByRef pos As Point, ByRef Pic As Image) As Boolean
  Dim resp As Boolean
  
  resp = False
  If pos.X >= Pic.Left And pos.X < Pic.Left + Pic.Width And _
     pos.Y >= Pic.Top And pos.Y < Pic.Top + Pic.Height Then
    resp = True
  End If
  IsInsideImage = resp
End Function

'------------------------------------------------IsInsideBox
Public Function IsInsideBox(ByVal X As Long, ByVal Y As Long, _
  ByVal X1 As Long, ByVal Y1 As Long, ByVal W As Long, ByVal H As Long) As Boolean
  Dim resp As Boolean
  
  resp = False
  If X >= X1 And X < X1 + W And Y >= Y1 And Y < Y1 + H Then
    resp = True
  End If
  IsInsideBox = resp
End Function

'--------------------------------------------------DrawBox3D
Public Sub DrawBox3D(ByRef DrawForm As Form, ByVal modo As Byte, ByVal X As Long, ByVal Y As Long, ByVal W As Long, ByVal H As Long)
  Select Case modo
    Case 1: 'Lowered 2 lines
      DrawForm.ForeColor = RGB(68, 70, 68)
      DrawForm.Line (X, Y)-(X + W - 1, Y)
      DrawForm.Line (X, Y)-(X, Y + H - 1)
      DrawForm.ForeColor = RGB(148, 146, 148)
      DrawForm.Line (X + 1, Y + 1)-(X + W - 1, Y + 1)
      DrawForm.Line (X + 1, Y + 1)-(X + 1, Y + H - 1)
      DrawForm.Line (X, Y + H - 1)-(X, Y + H)
      DrawForm.ForeColor = RGB(204, 206, 204)
      DrawForm.Line (X + W - 2, Y + 2)-(X + W - 2, Y + H - 1)
      DrawForm.Line (X + 2, Y + H - 2)-(X + W - 1, Y + H - 2)
      DrawForm.ForeColor = RGB(244, 246, 244)
      DrawForm.Line (X + 1, Y + H - 1)-(X + W, Y + H - 1)
      DrawForm.Line (X + W - 1, Y)-(X + W - 1, Y + H)
    Case 2: 'Raised 2 lines
      DrawForm.ForeColor = RGB(244, 246, 244)
      DrawForm.Line (X, Y)-(X + W - 1, Y)
      DrawForm.Line (X, Y)-(X, Y + H - 1)
      DrawForm.ForeColor = RGB(204, 206, 204)
      DrawForm.Line (X + 1, Y + 1)-(X + W - 2, Y + 1)
      DrawForm.Line (X + 1, Y + 1)-(X + 1, Y + H - 2)
      DrawForm.ForeColor = RGB(148, 146, 148)
      DrawForm.Line (X + W - 2, Y + 1)-(X + W - 2, Y + H - 1)
      DrawForm.Line (X + 1, Y + H - 2)-(X + W - 1, Y + H - 2)
      DrawForm.Line (X, Y + H - 1)-(X, Y + H)
      DrawForm.ForeColor = RGB(68, 70, 68)
      DrawForm.Line (X + 1, Y + H - 1)-(X + W, Y + H - 1)
      DrawForm.Line (X + W - 1, Y)-(X + W - 1, Y + H)
    Case 3: 'Lowered 1 line
      DrawForm.ForeColor = RGB(68, 70, 68)
      DrawForm.FillColor = RGB(68, 70, 68)
      DrawForm.Line (X, Y)-(X + W - 1, Y), , BF
      DrawForm.Line (X, Y)-(X, Y + H - 2), , BF
      DrawForm.ForeColor = RGB(244, 246, 244)
      DrawForm.FillColor = RGB(244, 246, 244)
      DrawForm.Line (X, Y + H - 1)-(X + W - 1, Y + H - 1), , BF
      DrawForm.Line (X + W - 1, Y + 1)-(X + W - 1, Y + H - 1), , BF
    Case 4: 'Raised 1 line
      DrawForm.ForeColor = RGB(244, 246, 244)
      DrawForm.FillColor = RGB(244, 246, 244)
      DrawForm.Line (X, Y)-(X + W - 1, Y), , BF
      DrawForm.Line (X, Y)-(X, Y + H - 2), , BF
      DrawForm.ForeColor = RGB(68, 70, 68)
      DrawForm.FillColor = RGB(68, 70, 68)
      DrawForm.Line (X, Y + H - 1)-(X + W - 1, Y + H - 1), , BF
      DrawForm.Line (X + W - 1, Y + 1)-(X + W - 1, Y + H - 1), , BF
  End Select
End Sub

'---------------------------------------Ponteiros do Relogio
Public Sub Ponteiros(ByRef DrawForm As Form, ByVal t As Long, ByVal modo As Long, ByVal relX As Integer, ByVal relY As Integer, ByVal relL As Integer)
  Dim Horas As Long, aux As Long, Minu As Long, Secs As Long
  Dim ho As Single, mi As Single, se As Single
  Dim X1 As Integer, Y1 As Integer
  Dim X2 As Integer, Y2 As Integer

  Horas = t \ 3600
  aux = t - (Horas * 3600)
  Minu = aux \ 60
  Secs = aux - (Minu * 60)
  If (modo = 1) Or (modo = 3) Then
    DrawForm.ForeColor = RGB(84, 250, 164)
  Else
    DrawForm.ForeColor = RGB(11, 35, 34)
  End If
  'afixar horas
  ho = Horas * 0.52359877 - 1.570796327
  If modo < 2 Then ho = ho + Minu * 0.008726646
  X2 = Round(relL * 0.6 * Cos(ho))
  Y2 = Round(relL * 0.6 * Sin(ho))
  If (Horas > 0) Or (modo < 2) Then
    DrawForm.Line (relX, relY)-(relX + X2, relY + Y2)
  End If
   'afixar minutos
  mi = Minu * 0.10471955 - 1.570796327
  X2 = Round(relL * Cos(mi))
  Y2 = Round(relL * Sin(mi))
  If (Minu > 0) Or (modo < 2) Then
    DrawForm.Line (relX, relY)-(relX + X2, relY + Y2)
  End If
  'afixar segundos
  se = Secs * 0.10471955 - 1.570796327
  X1 = Round(relL * 0.65 * Cos(se))
  Y1 = Round(relL * 0.65 * Sin(se))
  X2 = Round(relL * Cos(se))
  Y2 = Round(relL * Sin(se))
  DrawForm.Line (relX + X1, relY + Y1)-(relX + X2, relY + Y2)
End Sub

'----------------------------------------------DigitalNumber
Public Sub DigitalNumber(ByRef DrawForm As Form, ByVal X As Long, ByVal Y As Long, ByVal Numero As Byte, Tam As Byte)
  Dim isON As Boolean
  Dim Segment As Byte
  
  For Segment = 1 To 7
    'determinar se o segmento est

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -