Type Class_Label Extends Class_Virtual '属于虚拟控件，是直接画在窗口上的 ，所有私有属性记录，保存在主窗口中，

    Declare Property Caption() As CWSTR                 '返回/设置控件中的文本
    Declare Property Caption(sText As CWSTR)
    Declare Property TextAlign() As Long      '返回/设置控件上显示的文本的对齐方式。{=.0 - 左对齐.1 - 居中.2 - 右对齐.3 - 中左对齐.4 - 置中.5 - 中右对齐.6 - 下左对齐.7 - 下居中.8 - 下右对齐}
    Declare Property TextAlign(bValue As Long) 
    Declare Property Style() As Long      '返回/设置指示控件边界的外观和行为。{=.0 - 无边框.1 - 细边框}
    Declare Property Style(bValue As Long) 
    Declare Property ForeColor() As Long       '返回/设置前景色：特殊合成色，设置用：BGRA (r, g, b, a) ，获取用：GetCodeColorGDI 或 GetCodeColorGDIplue 转换
    Declare Property ForeColor(nColor As Long)
    Declare Property BackColor() As Long      '返回/设置背景色：特殊合成色，设置用：BGRA (r, g, b, a) ，获取用：GetCodeColorGDI 或 GetCodeColorGDIplue 转换
    Declare Property BackColor(nColor As Long)
    Declare Property Font() As String          '返回/设置用于在控件中绘制文本的字体，格式为：字体,字号,加粗,斜体,下划线,删除线  中间用英文豆号分割，可以省略参数 默认为：宋体,9,0,0,0,0  自动响应系统DPI创建字体大小。
    Declare Property Font(nFont As String)     '
    Declare Property Prefix() As Boolean                 '处理前缀字符，通常将助记符前缀＆解释为下划线{=.True.False}
    Declare Property Prefix(ByVal bValue As Boolean)
    Declare Property Ellipsis() As Boolean                 '截断所有不适合大小的单词并添加省略号。{=.True.False}
    Declare Property Ellipsis(ByVal bValue As Boolean)
    Declare Sub Drawing(gg as yGDI,hWndForm As hWnd,nBackColor As Long)  '描绘控件，窗口需要描绘，通知类把控件画到 gg 中。（** VFB系统自用）
End Type

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

Property Class_Label.Caption() As CWSTR
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->nText
   End If
   Dim ww As String ="的我陪垃圾啊的时候去"
End Property
Property Class_Label.Caption(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_Label.TextAlign() As Long ' "LABEL"  样式结构：&H01020304  01主样式 02对齐 03 04 选项 &H1=允许 &H2=显示 &H4=前缀 &H8=省略号
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return (fp->Style And &H00FF0000) Shr 16
   End If
End Property
Property Class_Label.TextAlign(bValue As Long )
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Dim sy As UInteger = bValue
      if sy>8 then sy=8
      fp->Style = (fp->Style And &HFF00FFFF) Or (sy Shl 16)
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Label.Style() As Long
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then  ' "LABEL"  样式结构：&H01020304  01主样式 02对齐 03 04 选项 &H1=允许 &H2=显示 &H4=前缀 &H8=省略号
      Return  ((fp->Style And &HFF000000) Shr 24)  
   End If
End Property
Property Class_Label.Style(bValue As Long)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Dim sy As UInteger = bValue
      if sy>255 then sy=255
      fp->Style = (fp->Style And &H00FFFFFF) Or (sy Shl 24)
      AfxRedrawWindow m_hWndParent
   End If
End Property
Property Class_Label.ForeColor() As Long    
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->ForeColor
   End If
End Property
Property Class_Label.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_Label.BackColor() As Long    
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      Return fp->BackColor
   End If
End Property
Property Class_Label.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_Label.Font() As String
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then   
      Return fp->nFont  
   End If
End Property
Property Class_Label.Font(nFont As String)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      fp->nFont = nFont
      AfxRedrawWindow m_hWndParent
   end if
End Property
Property Class_Label.Prefix() As Boolean 
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then    ' "LABEL"  样式结构：&H01020304  01主样式 02对齐 03 04 选项 &H1=允许 &H2=显示 &H4=前缀 &H8=省略号
      Return (fp->Style and &H4 )<>0
   End If
End Property
Property Class_Label.Prefix(ByVal bValue As Boolean)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      If bValue Then fp->Style Or= &H4 Else fp->Style And= Not &H4 
      AfxRedrawWindow m_hWndParent
   end if
End Property
Property Class_Label.Ellipsis() As Boolean 
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then   
      Return (fp->Style and &H8 )<>0
   End If
End Property
Property Class_Label.Ellipsis(ByVal bValue As Boolean)
   Dim fp As FormControlsPro_TYPE ptr = GetFP()
   if fp then
      If bValue Then fp->Style Or= &H8 Else fp->Style And= Not &H8
      AfxRedrawWindow m_hWndParent
   end if
End Property
Sub Class_Label.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
   '样式结构：&H01020304  01主样式 02对齐 03 04 选项 &H1=允许 &H2=显示 &H4=前缀 &H8=省略号
   if (fp->Style and &H2) = 0 Then Return
   dim cc As Long = GetCodeColorGDIplue(fp->BackColor)
   gg.gpBrush cc
   
   cc = GetCodeColorGDIplue(fp->ForeColor)
   If ((fp->Style And &HFF000000) Shr 24) = 1 Then
      gg.GpPen 1, cc
   Else
      gg.GpPen 0
   End If
   gg.gpDrawFrame fp->nLeft, fp->nTop, fp->nWidth, fp->nHeight
   
   cc = GetCodeColorGDI(fp->ForeColor)
   If cc <> -1 Then gg.SetColor cc
   
   'Windows使用带有dt_wordbreak和dt_expandtabs参数的drawtext绘制带有ss_left、cc_center和ss_right样式的标签。其他样式必须使用dt_单线，而不是换行。
   Dim As Long lWrapMode = DT_SINGLELINE
   Dim As Long lFormat
   
   Select Case (fp->Style And &H00FF0000) Shr 16
      Case 7 '下居中
         lFormat = DT_CENTER Or DT_BOTTOM
      Case 6 '下左对齐
         lFormat = DT_LEFT Or DT_BOTTOM
      Case 8 ' 下右对齐
         lFormat = DT_RIGHT Or DT_BOTTOM
      Case 4 '置中
         lFormat = DT_CENTER Or DT_VCENTER
      Case 3 '中左对齐
         lFormat = DT_LEFT Or DT_VCENTER
      Case 5 '中右对齐
         lFormat = DT_RIGHT Or DT_VCENTER
      Case 1 '居中
         lFormat = DT_CENTER Or DT_TOP
         lWrapMode = DT_WORDBREAK
      Case 0 ' 左对齐
         lFormat = DT_LEFT Or DT_TOP
         lWrapMode = DT_WORDBREAK
      Case 2 '右对齐
         lFormat = DT_RIGHT Or DT_TOP
         lWrapMode = DT_WORDBREAK
   End Select
   If (fp->Style And &H4) = 0 Then lFormat Or= DT_NOPREFIX
   If (fp->Style And &H8) Then lFormat Or= DT_WORD_ELLIPSIS
   lFormat = lFormat Or lWrapMode Or DT_EXPANDTABS
   Dim oFont As HGDIOBJ = SelectObject(gg.m_Dc, gFLY_GetFontHandles(fp->nFont))
   gg.DrawTexts fp->nLeft, fp->nTop, fp->nWidth, fp->nHeight, fp->nText, lFormat
   SelectObject(gg.m_Dc, oFont)
End Sub



