Sofficebutton 1.0.2

Description

All rights Reserved © HACKPRO TM 2005
__________________________________________________________
Version 1.0.2
Control: SOfficeButton
Author: Heriberto Mantilla Santamaría
Description: This usercontrol simulates a Office button.
Started on: Sunday, 09-jan-2005.
Release date: Sunday, 09-jan-2005.
__________________________________________________________
All rights Reserved © HACKPRO TM 2005

Source / Exemple :


'* English: Draw appearance of the control.
Private Sub Refresh(Optional ByVal State As OfficeState = 0)
 Dim lColor  As Long, lBase   As Long, iColor1 As Long
 Dim iColor2 As Long, iColor3 As Long, iColor4 As Long
 Dim iColor5 As Long, iColor6 As Long
 
 '* Crea la apariencia del control.
 If (isSystemColor = False) Then
  iColor1 = isBackColor
  iColor2 = isBorderColor
  iColor3 = isDisabledColor
  iColor4 = isForeColor
  iColor5 = isHighLightColor
  iColor6 = isHotColor
 Else
  iColor1 = ConvertSystemColor(defBackColor)
  iColor2 = ConvertSystemColor(defBorderColor)
  iColor3 = ConvertSystemColor(defDisabledColor)
  iColor4 = ConvertSystemColor(defForeColor)
  iColor5 = ConvertSystemColor(defHighLightColor)
  iColor6 = ConvertSystemColor(defHotColor)
 End If
 With UserControl
  isHeight = .ScaleHeight
  isWidth = .ScaleWidth
  .AutoRedraw = True
  .ScaleMode = vbPixels
  .Cls
 On Error Resume Next
  Set .Font = g_Font
  Call GetClientRect(.hWnd, RectButton)
  Call GetClientRect(.hWnd, isTxtRect)
  .BackColor = iColor1
  lBase = &HB0
  Select Case State
   Case &H0 '* Normal State.
    If (isSetBorder = True) Then
     If (isButtonShape = &H0) Then
      Call DrawRectangle(.hDC, 0, 0, isWidth, isHeight, iColor1, iColor2, False)
     Else
      Call DrawBox(.hDC, 4, 5, iColor1, iColor2, RectButton.Right + 2, RectButton.Bottom + 3)
     End If
    Else
     Call DrawRectangle(.hDC, 0, 0, isWidth, isHeight, iColor1, iColor1)
    End If
   Case &H1, &H2 '* HighLight or Hot State.
    If (isSetHighLight = True) Then
     If (State = &H1) Then
      lColor = ShiftColorOXP(iColor5, &H40)
     Else
      lColor = iColor6
      lBase = &H9C
     End If
    ElseIf (isSetBorder = True) Then
     lColor = iColor1
     lBase = 0
    End If
    If (isButtonShape = &H0) Then
     Call DrawRectangle(.hDC, 0, 0, isWidth, isHeight, ShiftColorOXP(lColor, lBase), iColor2)
    Else
     Call DrawBox(.hDC, 4, 5, ShiftColorOXP(lColor, lBase), iColor2, RectButton.Right + 2, RectButton.Bottom + 3)
    End If
   Case &H3 '* Disabled State.
    lColor = iColor3
    If (isSetBorder = True) Then
     If (isButtonShape = &H0) Then
      Call DrawRectangle(.hDC, 0, 0, isWidth, isHeight, iColor1, lColor)
     Else
      Call DrawBox(.hDC, 4, 5, iColor1, lColor, RectButton.Right + 2, RectButton.Bottom + 3)
     End If
    End If
  End Select
  isState = State
  If (isAutoSizePic = True) Then
   .Width = isPicture.Width
   .Height = isPicture.Height
   isHeight = .ScaleHeight
   isWidth = .ScaleWidth
  End If
  Call DrawCaption(iColor3, iColor4)
  Call DrawPicture
  If (isState <> &H3) Then Call DrawFocus
 End With
End Sub

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.