Type Class_Frame Extends Class_Virtual
   Declare Property Caption() As CWStr                '返回/设置控件中的文本
   Declare Property Caption(ByVal sText As CWStr)
   Declare Property TextAlign() As Long      '返回/设置0 - 左对齐,1 - 居中,2 - 右对齐
   Declare Property TextAlign(bValue As Long)
   Declare Property BackColor() As Long                  '返回/设置背景色：特殊合成色，设置用：BGRA (r, g, b, a) ，获取用：GetCodeColorGDI 或 GetCodeColorGDIplue 转换
   Declare Property BackColor(nColor As Long)
   Declare Property ForeColor() As Long                  '返回/设置前景色：特殊合成色，设置用：BGRA (r, g, b, a) ，获取用：GetCodeColorGDI 或 GetCodeColorGDIplue 转换
   Declare Property ForeColor(nColor As Long)
   Declare Property BorderColor() As Long                  '返回/设置用于周围的线条颜色：特殊合成色，设置用：BGRA (r, g, b, a) ，获取用：GetCodeColorGDI 或 GetCodeColorGDIplue 转换
   Declare Property BorderColor(nColor As Long)
   Declare Property Fillet() As Long      '返回/设置圆角半径 0--999
   Declare Property Fillet(bValue As Long)
   Declare Property BorderWidth() As Long      '返回/设置边框宽度0到15
   Declare Property BorderWidth(bValue As Long)
   Declare Property Font() As String          '返回/设置用于在控件中绘制文本的字体，格式为：字体,字号,加粗,斜体,下划线,删除线  中间用英文豆号分割，可以省略参数 默认为：宋体,9,0,0,0,0  自动响应系统DPI创建字体大小。
   Declare Property Font(nFont As String)     '
   Declare Sub Drawing(gg as yGDI, hWndForm As hWnd, nBackColor As Long)  '描绘控件，窗口需要描绘，通知类把控件画到 gg 中。（** VFB系统自用）
   
End Type

'----------------------------------------------------------------------------------------------------------------------------------------------------------------

Property Class_Frame.Caption() As CWStr
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->nText
   end if
End Property
Property Class_Frame.Caption(ByVal sText As CWStr)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      fp->nText = sText
      AfxRedrawWindow m_hWndParent
   end if
End Property
Property Class_Frame.TextAlign() As Long  '样式结构：&H12345678  12主样式 34填充 5宽度   678 选项 &H1=允许 &H2=显示
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return (fp->Style And &HFF000000) Shr 24
   End If
End Property
Property Class_Frame.TextAlign(bValue As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Dim sy As UInteger = bValue
      if sy > 5 then sy = 5
      fp->Style = (fp->Style And &H00FFFFFF) Or (sy Shl 24)
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Frame.BackColor() As Long    
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->BackColor
   End If
End Property
Property Class_Frame.BackColor(ByVal nColor As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      If ((nColor And &HFF000000) Shr 6)=0 Then nColor Or=&HFF000000
      fp->BackColor = nColor
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Frame.ForeColor() As Long    
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->ForeColor
   End If
End Property
Property Class_Frame.ForeColor(ByVal nColor As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      If ((nColor And &HFF000000) Shr 6)=0 Then nColor Or=&HFF000000
      fp->ForeColor = nColor
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Frame.BorderColor() As Long    
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->ForeColorHot
   End If
End Property
Property Class_Frame.BorderColor(ByVal nColor As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      fp->ForeColorHot = nColor
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Frame.BorderWidth() As Long  '样式结构：&H12345678  12主样式 34填充 5宽度   678 选项 &H1=允许 &H2=显示
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return (fp->Style And &H0000F000) Shr 12
   End If
End Property
Property Class_Frame.BorderWidth(bValue As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Dim sy As UInteger = bValue
      if sy > 15 then sy = 15
      fp->Style = (fp->Style and &HFFFF0FFF) Or (sy Shl 12)
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Frame.Fillet() As Long  '样式结构：&H12345678  12主样式 34填充 5宽度   678 选项 &H1=允许 &H2=显示
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return (fp->Style And &H00FF0000) Shr 16
   End If
End Property
Property Class_Frame.Fillet(bValue As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Dim sy As UInteger = bValue
      if sy > 9 then sy = 9
      fp->Style = (fp->Style and &HFF00FFFF) Or (sy Shl 16)
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Frame.Font() As String
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then   
      Return fp->nFont  
   End If
End Property
Property Class_Frame.Font(nFont As String)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      fp->nFont = nFont
      AfxRedrawWindow m_hWndParent
   end if
End Property
Sub Class_Frame.Drawing(gg as yGDI, hWndForm As hWnd, nBackColor As Long)
   m_hWndParent = hWndForm
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp = 0 then return
   if (fp->Style and &H2 ) =0 Then Return 
   Dim As Long nStyles = (fp->Style And &HFF000000) Shr 24,nFillet = (fp->Style And &H00FF0000) Shr 16 , _
      nBorderWidth = (fp->Style And &H0000F000) Shr 12, x, y, w, h, zh, fc, bc
   x = fp->nLeft : y = fp->nTop : w = fp->nWidth : h = fp->nHeight
   SetBkMode gg.m_Dc, 0  '设置这个后，画上的字是透明的
   fc = GetCodeColorGDI(fp->ForeColor)
   If fc = -1 Then fc = GetSysColor(COLOR_WINDOWTEXT)
   bc = GetCodeColorGDI(fp->BackColor)
   If bc = -1 Then bc = nBackColor
   If bc = -1 Then bc = GetSysColor(COLOR_BTNFACE)
   gg.SetColor fc, bc

   Dim As Long lFormat
   Select Case nStyles
      Case 1 '居中
         lFormat = DT_CENTER Or DT_TOP
      Case 0 ' 左对齐
         lFormat = DT_LEFT Or DT_TOP
      Case 2 '右对齐
         lFormat = DT_RIGHT Or DT_TOP
   End Select
   lFormat = lFormat Or DT_SINGLELINE Or DT_EXPANDTABS
   Dim oFont As HGDIOBJ = SelectObject(gg.m_Dc, gFLY_GetFontHandles(fp->nFont))
   zh = gg.DrawTextS(x + 10, y, w -20, h, fp->nText, lFormat Or DT_CALCRECT) / AfxScaleY(1)
   
   gg.GpPen nBorderWidth, GetCodeColorGDIplue(fp->ForeColorHot)
   gg.GpBrush GetCodeColorGDIplue(fp->BackColor)
   zh /= 2
   gg.GpDrawCircleFrame x, y + zh, w, h - zh, nFillet, nFillet
   
   gg.DrawTextS(x + 10, y, w -20, h, fp->nText, lFormat)
   SetBkMode gg.m_Dc, 1  '设置这个后，画上的字是透明的
   SelectObject(gg.m_Dc, oFont)
   
   
End Sub

