Blame | Last modification | View Log
VERSION 5.00Begin VB.UserControl jjProgressAlignable = -1 'TrueAppearance = 0 'FlatAutoRedraw = -1 'TrueClientHeight = 300ClientLeft = 0ClientTop = 0ClientWidth = 3330ClipControls = 0 'FalseScaleHeight = 20ScaleMode = 3 'PixelScaleWidth = 222ToolboxBitmap = "jjProgress.ctx":0000Begin VB.PictureBox picGrafAppearance = 0 'FlatAutoRedraw = -1 'TrueBackColor = &H80000005&BorderStyle = 0 'NoneClipControls = 0 'FalseDrawWidth = 2FillStyle = 0 'SolidForeColor = &H80000008&Height = 300Left = 0ScaleHeight = 20ScaleMode = 3 'PixelScaleWidth = 31TabIndex = 0TabStop = 0 'FalseTop = 0Visible = 0 'FalseWidth = 465EndEndAttribute VB_Name = "jjProgress"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = TrueAttribute VB_PredeclaredId = FalseAttribute VB_Exposed = FalseOption Explicit'Kontrollens bredde og høydeDim ucWidth As LongDim ucHeight As LongPublic Enum jjStyleStandard = 0Flat = 1Forløp = 2Rør = 3XP = 4Mac81 = 5End EnumPublic Enum jjForløpjjHorisontal = 0jjVertical = 1End EnumPublic Enum jjViewPercentjjFalse = 0jjTrue = 1End Enum'Default Property Values:Const m_def_ForeColor = 0Const m_def_ColorA = vbWhiteConst m_def_ColorB = &HD78853Const m_def_MaxValue = 100Const m_def_Style = 0Const m_def_Border = 1Const m_def_BorderColor = 0Const m_def_BackColor = vbWhiteConst m_def_ViewPercent = 0Const m_def_Value = 0'Property Variables:Dim m_ForeColor As OLE_COLORDim m_ColorA As OLE_COLORDim m_ColorB As OLE_COLORDim m_MaxValue As LongDim m_Style As IntegerDim m_Border As BooleanDim m_BorderColor As OLE_COLORDim m_BackColor As OLE_COLORDim m_ViewPercent As IntegerDim m_Value As Long'For Triangel-fargefyllPrivate Type TRIANGEL_COLORColorTL As LongColorTR As LongColorBL As LongColorBR As LongEnd Type'For Gradient-fargefyllPrivate Type GRADIENT_COLORColorFrom As LongColorTo As LongEnd TypePrivate Type RECTLeft As LongTop As LongRight As LongBottom As LongEnd TypePrivate Type GRADIENT_TRIANGLEVertex1 As LongVertex2 As LongVertex3 As LongEnd TypePrivate Type TRIVERTEXx As Longy As LongRed As IntegerGreen As IntegerBlue As IntegerAlpha As IntegerEnd TypePrivate Type GRADIENT_RECTUpperLeft As LongLowerRight As LongEnd TypeConst GRADIENT_FILL_RECT_H As Long = &H0Const GRADIENT_FILL_RECT_V As Long = &H1Const GRADIENT_FILL_TRIANGLE As Long = &H2Private Declare Function GradientFillTriangle Lib "msimg32" Alias "GradientFill" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_TRIANGLE, ByVal dwNumMesh As Long, ByVal dwMode As Long) As LongPrivate Declare Function GradientFill Lib "msimg32" (ByVal hdc As Long, pVertex As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long, ByVal dwMode As Long) As LongPrivate Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As LongPrivate Declare Sub OleTranslateColor Lib "oleaut32.dll" (ByVal clr As Long, ByVal hpal As Long, ByRef lpcolorref As Long)Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As LongPrivate Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As LongPrivate Declare Function FrameRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long, ByVal nWidth As Long, ByVal nHeight As Long) As LongPrivate Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPrivate Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As LongPrivate Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As LongPrivate Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long'Flytte til et punkt og tegne linjerPrivate Type POINTAPIx As Longy As LongEnd TypePrivate Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongPrivate Declare Function RoundRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As LongPrivate Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As LongPrivate Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As LongPrivate Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As LongPrivate Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As LongPrivate Const PS_SOLID = 0'Event Declarations:Event Resize() 'MappingInfo=UserControl,UserControl,-1,ResizeEvent Click() 'MappingInfo=UserControl,UserControl,-1,ClickEvent DblClick() 'MappingInfo=UserControl,UserControl,-1,DblClickEvent MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseDownEvent MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseMoveEvent MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseUpPrivate Function TranslateColor(aColor As OLE_COLOR) As LongDim newcolor As LongOleTranslateColor aColor, UserControl.Palette, newcolorTranslateColor = newcolorEnd FunctionPrivate Function Prosent(Verdi As Long, Maks As Long) As Long'Returnerer prosent av Verdi i forhold til MaksOn Error Resume NextDim Pros As DoublePros = (Maks - Verdi) / Maks * 100Prosent = 100 - ProsEnd FunctionPrivate Sub Graf()'Gjør et kall på denne prosedyren, er evhengig av en PictureBox(picGraf)Dim Til As LongDim ProsentVerdi As StringDim TempHdc As LongDim hRgn As LongDim hPen As LongDim hBrush As LongDim pnt As POINTAPIStatic SjekkTil As LongTil = Prosent(m_Value, m_MaxValue)'Sjekk at det er kommet ny til verdi, avbryt om den er likIf Til > 0 Then 'Denne linjen er med for at den skal tegnes i design-modus ogsåIf SjekkTil = Til ThenExit SubEnd IfEnd IfSjekkTil = TilProsentVerdi = Til & "%" 'For visning av prosentTil = Til * ucWidth / 100 'Antall piksler av kontrollens lengde som skal merkespicGraf.ClsTempHdc = picGraf.hdcSetWindowRgn UserControl.hwnd, 0, True 'Fjern en evt. region'Tegn bakgrunn på stiler <= 3If Style <= Rør ThenhBrush = CreateSolidBrush(m_BackColor)hPen = CreatePen(PS_SOLID, 1, m_BackColor)SelectObject TempHdc, hBrushSelectObject TempHdc, hPenRectangle TempHdc, 0, 0, ucWidth, ucHeightDeleteObject hPenDeleteObject hBrushEnd If'Tegn progress i valgt stilIf Style = Standard ThenCall ProgressStandard(Til)ElseIf Style = Flat ThenCall ProgressForlop(Til)ElseIf Style = Forløp ThenCall ProgressForlop(Til)ElseIf Style = Rør ThenCall ProgressRor(Til)ElseIf Style = XP ThenCall ProgressXP(Til)ElseIf Style = Mac81 ThenCall ProgressMac81(Til)End If'Vis prosent i midten på stiler <= 3If Style <= Rør ThenIf ViewPercent = jjTrue ThenpicGraf.CurrentX = ucWidth / 2 - Len(ProsentVerdi) / 0.3picGraf.CurrentY = ucHeight / 2 - picGraf.TextHeight("ProsentVerdi") / 2SetTextColor TempHdc, m_ForeColorpicGraf.Print ProsentVerdiEnd IfEnd If'Tegn ramme på stiler <= 3If Style <= Rør ThenIf m_Border = True ThenhPen = CreatePen(PS_SOLID, 1, m_BorderColor)SelectObject TempHdc, hPenMoveToEx TempHdc, 0, 0, pntLineTo TempHdc, ucWidth - 1, 0LineTo TempHdc, ucWidth - 1, ucHeight - 1LineTo TempHdc, 0, ucHeight - 1LineTo TempHdc, 0, 0DeleteObject hPenEnd IfEnd If'Refresh tempbildetpicGraf.Refresh'Kopier tempbildet over til kontrollenBitBlt UserControl.hdc, 0, 0, ucWidth, ucHeight, picGraf.hdc, 0, 0, vbSrcCopy'Refresh kontrollenUserControl.RefreshSet picGraf = NothingEnd SubPrivate Sub FadeGradient(Farge As GRADIENT_COLOR, LeftRight As Boolean, X1 As Long, Y1 As Long, X2 As Long, Y2 As Long)On Error GoTo PROC_ERRDim gRect As GRADIENT_RECTDim Vert(1) As TRIVERTEXDim f As IntegerDim rgbRed(1) As Long, rgbGreen(1) As Long, rgbBlue(1) As LongDim rHex(1) As String, gHex(1) As String, bHex(1) As StringDim Retning As LongFor f = 0 To 1Select Case fCase Is = 0'Konverter FraFargen til RGBrgbRed(f) = Farge.ColorFrom Mod 256rgbGreen(f) = ((Farge.ColorFrom And &HFF00FF00) / 256)rgbBlue(f) = (Farge.ColorFrom And &HFF0000) / 65536Case Is = 1'Konverter TilFargen til RGBrgbRed(f) = Farge.ColorTo Mod 256rgbGreen(f) = ((Farge.ColorTo And &HFF00FF00) / 256)rgbBlue(f) = (Farge.ColorTo And &HFF0000) / 65536End Select'Gang RGB sin verdi med 256 for å tilpasse maksverdien til GradientFill sin maksverdi som er 65280rgbRed(f) = rgbRed(f) * 256rgbGreen(f) = rgbGreen(f) * 256rgbBlue(f) = rgbBlue(f) * 256'Konverter de nye verdiene til Hex verdierrHex(f) = "&h" & Hex(rgbRed(f))gHex(f) = "&h" & Hex(rgbGreen(f))bHex(f) = "&h" & Hex(rgbBlue(f))Next f'Fra-fargeVert(0).x = X1Vert(0).y = Y1Vert(0).Red = rHex(0)Vert(0).Green = gHex(0)Vert(0).Blue = bHex(0)Vert(0).Alpha = 0&'Til-fargeVert(1).x = X2Vert(1).y = Y2Vert(1).Red = rHex(1)Vert(1).Green = gHex(1)Vert(1).Blue = bHex(1)Vert(1).Alpha = 0&'Rektangelets ytterpunktergRect.UpperLeft = 0gRect.LowerRight = 1'Retning på fadingIf LeftRight = False ThenRetning = GRADIENT_FILL_RECT_VElseRetning = GRADIENT_FILL_RECT_HEnd If'APIGradientFill picGraf.hdc, Vert(0), 2, gRect, 1, RetningpicGraf.RefreshPROC_EXIT:Exit SubPROC_ERR:If Err.Number = 91 Then GoTo PROC_EXITEnd SubPrivate Sub FadeGradientInit(Vanlig As Boolean, Lengde As Long)On Error GoTo PROC_ERRDim Farger As GRADIENT_COLORDim r As LongIf m_Border = True Then r = 1'FadeFargeFarger.ColorFrom = TranslateColor(m_ColorA)Farger.ColorTo = TranslateColor(m_ColorB)'RørIf Vanlig = False ThenCall FadeGradient(Farger, Vanlig, r, r, Lengde - r, Prosent2(50, ucHeight))Farger.ColorTo = TranslateColor(m_ColorA)Farger.ColorFrom = TranslateColor(m_ColorB)Call FadeGradient(Farger, Vanlig, r, Prosent2(50, ucHeight), Lengde - r, ucHeight - r)'Forløp og flatElseIf Vanlig = True ThenIf Style = Flat ThenFarger.ColorFrom = TranslateColor(m_ColorA)Farger.ColorTo = TranslateColor(m_ColorA)Call FadeGradient(Farger, Vanlig, r, r, Lengde - r, ucHeight - r)ElseIf Style = Forløp ThenCall FadeGradient(Farger, Vanlig, r, r, Lengde - r, ucHeight - r)End IfEnd IfPROC_EXIT:Exit SubPROC_ERR:If Err.Number = 91 Then GoTo PROC_EXITEnd SubPrivate Sub ProgressMac81(Lengde As Long)On Error GoTo PROC_ERRDim Farger As GRADIENT_COLORDim r As LongDim TempHdc As LongDim hBrush As LongDim hPen As LongDim pnt As POINTAPIDim ProsentVerdi As StringTempHdc = picGraf.hdc'Skyggestreker, venstre/topphPen = CreatePen(PS_SOLID, 1, RGB(170, 170, 170))SelectObject TempHdc, hPenMoveToEx TempHdc, 0, ucHeight - 2, pntLineTo TempHdc, 0, 0LineTo TempHdc, ucWidth - 1, 0DeleteObject hPen'høyre/bunnhPen = CreatePen(PS_SOLID, 1, vbWhite)SelectObject TempHdc, hPenMoveToEx TempHdc, ucWidth - 1, 1, pntLineTo TempHdc, ucWidth - 1, ucHeight - 1LineTo TempHdc, 0, ucHeight - 1DeleteObject hPen'Sort innerrammehPen = CreatePen(PS_SOLID, 1, vbBlack)hBrush = CreateSolidBrush(m_BackColor)SelectObject TempHdc, hPenSelectObject TempHdc, hBrushRectangle TempHdc, 1, 1, ucWidth - 1, ucHeight - 1DeleteObject hPenDeleteObject hBrush'InnerSkyggestreker, venstre/topphPen = CreatePen(PS_SOLID, 1, RGB(136, 136, 136))SelectObject TempHdc, hPenMoveToEx TempHdc, 2, ucHeight - 3, pntLineTo TempHdc, 2, 2LineTo TempHdc, ucWidth - 2, 2DeleteObject hPen'InnerSkyggestreker, høyre/bunnhPen = CreatePen(PS_SOLID, 1, RGB(221, 221, 221))SelectObject TempHdc, hPenMoveToEx TempHdc, ucWidth - 3, 3, pntLineTo TempHdc, ucWidth - 3, ucHeight - 3LineTo TempHdc, 3, ucHeight - 3DeleteObject hPen'Fading'Fade grenserIf Lengde < 2 Then Lengde = 2If Lengde > ucWidth - 3 Then Lengde = ucWidth - 3'Fade øverste halvdelFarger.ColorFrom = TranslateColor(m_ColorA)Farger.ColorTo = TranslateColor(vbWhite)Call FadeGradient(Farger, False, 2, 2, Lengde, Prosent2(50, ucHeight))'Fade nederste halvdelFarger.ColorFrom = TranslateColor(vbWhite)Farger.ColorTo = TranslateColor(m_ColorA)Call FadeGradient(Farger, False, 2, Prosent2(50, ucHeight), Lengde, ucHeight - 2)'Mørk innerstrek høyre/bunn/venstrehPen = CreatePen(PS_SOLID, 1, RGB(40, 40, 40))SelectObject TempHdc, hPenMoveToEx TempHdc, Lengde - 1, 3, pntLineTo TempHdc, Lengde - 1, ucHeight - 3LineTo TempHdc, 2, ucHeight - 3LineTo TempHdc, 2, 2DeleteObject hPen'Endestrek1hPen = CreatePen(PS_SOLID, 1, vbBlack)SelectObject TempHdc, hPenMoveToEx TempHdc, Lengde, 2, pntLineTo TempHdc, Lengde, ucHeight - 2DeleteObject hPenIf Lengde > 2 And Lengde < ucWidth - 3 Then'Endestrek2hPen = CreatePen(PS_SOLID, 1, RGB(85, 85, 85))SelectObject TempHdc, hPenMoveToEx TempHdc, Lengde + 1, 2, pntLineTo TempHdc, Lengde + 1, ucHeight - 2DeleteObject hPen'Endestrek3hPen = CreatePen(PS_SOLID, 1, RGB(136, 136, 136))SelectObject TempHdc, hPenMoveToEx TempHdc, Lengde + 2, 2, pntLineTo TempHdc, Lengde + 2, ucHeight - 2DeleteObject hPenEnd If'Vis prosentverdiIf ViewPercent = jjTrue ThenhPen = CreatePen(PS_SOLID, 1, RGB(104, 104, 104))hBrush = CreateSolidBrush(RGB(236, 233, 216))SelectObject TempHdc, hPenSelectObject TempHdc, hBrushRectangle TempHdc, ucWidth / 2 - 15, 3, (ucWidth / 2) + 20, ucHeight - 4DeleteObject hPenDeleteObject hBrush'høyrestrekhPen = CreatePen(PS_SOLID, 1, RGB(190, 190, 190))SelectObject TempHdc, hPenMoveToEx TempHdc, (ucWidth / 2) + 21, 4, pntLineTo TempHdc, (ucWidth / 2) + 21, ucHeight - 3DeleteObject hPen'bunnstrekhPen = CreatePen(PS_SOLID, 1, RGB(190, 190, 190))SelectObject TempHdc, hPenMoveToEx TempHdc, ucWidth \ 2 - 14, ucHeight - 4, pntLineTo TempHdc, (ucWidth \ 2) + 21, ucHeight - 4DeleteObject hPen'Vis verdienProsentVerdi = Prosent(Lengde, ucWidth)picGraf.CurrentX = ucWidth / 2 - Len(ProsentVerdi) / 0.3picGraf.CurrentY = ucHeight / 2 - picGraf.TextHeight("ProsentVerdi") / 2SetTextColor TempHdc, m_ForeColorpicGraf.Print ProsentVerdi & "%"End IfPROC_EXIT:Exit SubPROC_ERR:If Err.Number = 91 Then GoTo PROC_EXITEnd SubPrivate Function Prosent2(Prosent As Long, MaksVerdi As Long, Optional Desimal As Boolean) As Long'Returnerer verdien av gitt Prosent i forhold til gitt MaksVerdi'---------------------------------------------------------------'Prosent = en verdi fra 0 til 100'MaksVerdi = tallet det skal finnes en prosentverdi av'Desimal = Settes til true om det ønskes en desimal på returverdien'Returvariabelen til Prosent2 må endres fra Long til String før denne virker.On Error Resume NextDim DesFormat As StringDim Pros As LongDesFormat = "#0"If Desimal = True Then DesFormat = "#0.0"Pros = (MaksVerdi * Prosent) / 100Prosent2 = Format(Pros, DesFormat)End FunctionPrivate Sub UserControl_ReadProperties(PropBag As PropertyBag)m_Value = PropBag.ReadProperty("Value", m_def_Value)m_ViewPercent = PropBag.ReadProperty("ViewPercent", m_def_ViewPercent)m_BackColor = PropBag.ReadProperty("BackColor", m_def_BackColor)m_ForeColor = PropBag.ReadProperty("ForeColor", m_def_ForeColor)m_ColorA = PropBag.ReadProperty("ColorA", m_def_ColorA)m_ColorB = PropBag.ReadProperty("ColorB", m_def_ColorB)m_MaxValue = PropBag.ReadProperty("MaxValue", m_def_MaxValue)m_Style = PropBag.ReadProperty("Style", m_def_Style)m_Border = PropBag.ReadProperty("Border", m_def_Border)m_BorderColor = PropBag.ReadProperty("BorderColor", m_def_BorderColor)End SubPrivate Sub UserControl_Resize()RaiseEvent Resize'Bredden og høyden på knappen legges i disseucWidth = UserControl.ScaleWidthucHeight = UserControl.ScaleHeightpicGraf.Width = ucWidthpicGraf.Height = ucHeightCall GrafEnd Sub'Initialize Properties for User ControlPrivate Sub UserControl_InitProperties()m_Value = m_def_Valuem_ViewPercent = m_def_ViewPercentm_BackColor = m_def_BackColorm_ForeColor = m_def_ForeColorm_ColorA = m_def_ColorAm_ColorB = m_def_ColorBm_MaxValue = m_def_MaxValuem_Style = m_def_Stylem_Border = m_def_Borderm_BorderColor = m_def_BorderColorEnd Sub'Write property values to storagePrivate Sub UserControl_WriteProperties(PropBag As PropertyBag)Call PropBag.WriteProperty("Value", m_Value, m_def_Value)Call PropBag.WriteProperty("ViewPercent", m_ViewPercent, m_def_ViewPercent)Call PropBag.WriteProperty("BackColor", m_BackColor, m_def_BackColor)Call PropBag.WriteProperty("ForeColor", m_ForeColor, m_def_ForeColor)Call PropBag.WriteProperty("ColorA", m_ColorA, m_def_ColorA)Call PropBag.WriteProperty("ColorB", m_ColorB, m_def_ColorB)Call PropBag.WriteProperty("MaxValue", m_MaxValue, m_def_MaxValue)Call PropBag.WriteProperty("Style", m_Style, m_def_Style)Call PropBag.WriteProperty("Border", m_Border, m_def_Border)Call PropBag.WriteProperty("BorderColor", m_BorderColor, m_def_BorderColor)End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=8,0,0,0Public Property Get Value() As LongAttribute Value.VB_Description = "Verdi som skal vises"Value = m_ValueEnd PropertyPublic Property Let Value(ByVal New_Value As Long)If New_Value < 0 Then New_Value = 0If New_Value > m_MaxValue Then New_Value = m_MaxValuem_Value = New_ValuePropertyChanged "Value"Call GrafEnd Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=7,0,0,0Public Property Get ViewPercent() As jjViewPercentAttribute ViewPercent.VB_Description = "Settes til True om forløpet skal vises i prosent på midten."ViewPercent = m_ViewPercentEnd PropertyPublic Property Let ViewPercent(ByVal New_ViewPercent As jjViewPercent)m_ViewPercent = New_ViewPercentPropertyChanged "ViewPercent"Call GrafEnd Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MappingInfo=UserControl,UserControl,-1,EnabledPublic Property Get Enabled() As BooleanAttribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."Enabled = UserControl.EnabledEnd PropertyPrivate Sub UserControl_Click()RaiseEvent ClickEnd SubPrivate Sub UserControl_DblClick()RaiseEvent DblClickEnd SubPrivate Sub UserControl_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)RaiseEvent MouseDown(Button, Shift, x, y)End SubPrivate Sub UserControl_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)RaiseEvent MouseMove(Button, Shift, x, y)End SubPrivate Sub UserControl_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)RaiseEvent MouseUp(Button, Shift, x, y)End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=10,0,0,0Public Property Get BackColor() As OLE_COLORAttribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object."BackColor = m_BackColorEnd PropertyPublic Property Let BackColor(ByVal New_BackColor As OLE_COLOR)m_BackColor = TranslateColor(New_BackColor)PropertyChanged "BackColor"Call GrafEnd PropertyPrivate Sub ProgressStandard(Lengde As Long)Dim TempHdc As LongDim f As IntegerDim hBrush As LongDim hPen As LongDim BlockW As IntegerBlockW = ucHeight \ 3 'Bredden på hvert segment er 1/3 i forhold til høyden på kontrollenTempHdc = picGraf.hdchBrush = CreateSolidBrush(m_ColorB)hPen = CreatePen(PS_SOLID, 1, m_ColorA)SelectObject TempHdc, hBrushSelectObject TempHdc, hPenFor f = 2 To Lengde Step BlockW + 1Rectangle TempHdc, f, 2, f + BlockW, ucHeight - 2Next fDeleteObject hPenDeleteObject hBrushEnd SubPrivate Sub ProgressXP(Lengde As Long)Dim TempHdc As LongDim f As LongDim hBrush As LongDim hPen As LongDim BlockW As IntegerDim hRgn As LongDim pnt As POINTAPIDim Farger As GRADIENT_COLORDim ProsentVerdi As StringBlockW = 6TempHdc = picGraf.hdc'Progress blokker fadetFor f = 4 To Lengde Step BlockW + 2Farger.ColorFrom = TranslateColor(m_ColorA)Farger.ColorTo = TranslateColor(m_ColorB)Call FadeGradient(Farger, False, f, 2, f + BlockW, ucHeight - 4)Next f'Skyggestreker, topp1hPen = CreatePen(PS_SOLID, 1, RGB(190, 190, 190))SelectObject TempHdc, hPenMoveToEx TempHdc, 0, 1, pntLineTo TempHdc, ucWidth, 1DeleteObject hPen'topp2hPen = CreatePen(PS_SOLID, 1, RGB(239, 239, 239))SelectObject TempHdc, hPenMoveToEx TempHdc, 0, 2, pntLineTo TempHdc, ucWidth, 2DeleteObject hPen'BunnhPen = CreatePen(PS_SOLID, 1, RGB(239, 239, 239))SelectObject TempHdc, hPenMoveToEx TempHdc, 0, ucHeight - 3, pntLineTo TempHdc, ucWidth, ucHeight - 3DeleteObject hPen'venstre1hPen = CreatePen(PS_SOLID, 1, RGB(190, 190, 190))SelectObject TempHdc, hPenMoveToEx TempHdc, 1, 1, pntLineTo TempHdc, 1, ucHeight - 3DeleteObject hPen'venstre2hPen = CreatePen(PS_SOLID, 1, RGB(239, 239, 239))SelectObject TempHdc, hPenMoveToEx TempHdc, 2, 1, pntLineTo TempHdc, 2, ucHeight - 3DeleteObject hPen'høyrehPen = CreatePen(PS_SOLID, 1, RGB(239, 239, 239))SelectObject TempHdc, hPenMoveToEx TempHdc, ucWidth - 3, 1, pntLineTo TempHdc, ucWidth - 3, ucHeight - 3DeleteObject hPen'Vis prosentverdiIf ViewPercent = jjTrue ThenhPen = CreatePen(PS_SOLID, 1, RGB(104, 104, 104))hBrush = CreateSolidBrush(RGB(236, 233, 216))SelectObject TempHdc, hPenSelectObject TempHdc, hBrushRectangle TempHdc, ucWidth / 2 - 15, 3, (ucWidth / 2) + 20, ucHeight - 4DeleteObject hPenDeleteObject hBrush'høyrestrekhPen = CreatePen(PS_SOLID, 1, RGB(190, 190, 190))SelectObject TempHdc, hPenMoveToEx TempHdc, (ucWidth / 2) + 21, 4, pntLineTo TempHdc, (ucWidth / 2) + 21, ucHeight - 3DeleteObject hPen'bunnstrekhPen = CreatePen(PS_SOLID, 1, RGB(190, 190, 190))SelectObject TempHdc, hPenMoveToEx TempHdc, ucWidth \ 2 - 14, ucHeight - 4, pntLineTo TempHdc, (ucWidth \ 2) + 21, ucHeight - 4DeleteObject hPen'Vis verdienProsentVerdi = Prosent(Lengde, ucWidth)picGraf.CurrentX = ucWidth / 2 - Len(ProsentVerdi) / 0.3picGraf.CurrentY = ucHeight / 2 - picGraf.TextHeight("ProsentVerdi") / 2SetTextColor TempHdc, m_ForeColorpicGraf.Print ProsentVerdi & "%"End If'Lag regionhRgn = CreateRoundRectRgn(0, 0, ucWidth, ucHeight, 5, 5)hBrush = CreateSolidBrush(RGB(104, 104, 104))FrameRgn TempHdc, hRgn, hBrush, 1, 1SetWindowRgn UserControl.hwnd, hRgn, TrueDeleteObject hRgnDeleteObject hBrushEnd SubPrivate Sub ProgressRor(Lengde As Long)Call FadeGradientInit(False, Lengde)End SubPrivate Sub ProgressForlop(Lengde As Long)Call FadeGradientInit(True, Lengde)End Sub'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=10,0,0,0Public Property Get ForeColor() As OLE_COLORAttribute ForeColor.VB_Description = "Farge på teksten om ViewPercent er satt til True."ForeColor = m_ForeColorEnd PropertyPublic Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)m_ForeColor = TranslateColor(New_ForeColor)PropertyChanged "ForeColor"End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=10,0,0,0Public Property Get ColorA() As OLE_COLORAttribute ColorA.VB_Description = "Fra farge (gradering)"ColorA = m_ColorAEnd PropertyPublic Property Let ColorA(ByVal New_ColorA As OLE_COLOR)m_ColorA = TranslateColor(New_ColorA)PropertyChanged "ColorA"End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=10,0,0,0Public Property Get ColorB() As OLE_COLORAttribute ColorB.VB_Description = "Til farge (gradering)"ColorB = m_ColorBEnd PropertyPublic Property Let ColorB(ByVal New_ColorB As OLE_COLOR)m_ColorB = TranslateColor(New_ColorB)PropertyChanged "ColorB"End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=8,0,0,0Public Property Get MaxValue() As LongAttribute MaxValue.VB_Description = "Maks verdi."MaxValue = m_MaxValueEnd PropertyPublic Property Let MaxValue(ByVal New_MaxValue As Long)m_MaxValue = New_MaxValuePropertyChanged "MaxValue"Call GrafEnd Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=7,0,0,0Public Property Get Style() As jjStyleStyle = m_StyleEnd PropertyPublic Property Let Style(ByVal New_Style As jjStyle)m_Style = New_StylePropertyChanged "Style"Call GrafEnd Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=0,0,0,0Public Property Get Border() As BooleanAttribute Border.VB_Description = "Skal det tegnes ramme settes denne til True."Border = m_BorderEnd PropertyPublic Property Let Border(ByVal New_Border As Boolean)m_Border = New_BorderPropertyChanged "Border"Call GrafEnd Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!'MemberInfo=10,0,0,0Public Property Get BorderColor() As OLE_COLORAttribute BorderColor.VB_Description = "Farge på ramme om Border er satt til True."BorderColor = m_BorderColorEnd PropertyPublic Property Let BorderColor(ByVal New_BorderColor As OLE_COLOR)m_BorderColor = TranslateColor(New_BorderColor)PropertyChanged "BorderColor"Call GrafEnd Property