求VB环境韩文显示录入表格

closevb 2011-05-03 12:00:15
手里一堆的表格控件,楞是总总不如意。不知道各位大牛,能给俺点指点。
...全文
151 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
closevb 2011-05-06
  • 打赏
  • 举报
回复
谢谢大家给予的建议与意见,尤其是SupermanKing的源码很受用。我是新手,所以分不多,再次感谢。
closevb 2011-05-04
  • 打赏
  • 举报
回复
再次感谢您无私的解析。GDI重绘,这个可能是治本的方案。我一直想找第三方控件,主要是想图省事。楼上真是技术大牛呀。太感谢了,有种顿悟的感觉。
现在还是人类 2011-05-04
  • 打赏
  • 举报
回复
效果图



现在还是人类 2011-05-04
  • 打赏
  • 举报
回复
只能发三贴,没发完,继续发

If Table(1).TD(nSetX).vType = CheckType Then
If IsNumeric(PrintCaption) = True Then
If Int(PrintCaption) = 1 Then
PrintCaption = 1
Else
PrintCaption = 0
End If
Else
PrintCaption = 0
End If
TmpRect.Left = DRect.Left + ((DRect.Right - DRect.Left) / 2 - Check1.Width / 2)
TmpRect.Top = DRect.Top + ((DRect.Bottom - DRect.Top) / 2 - Check1.Height / 2)
TmpRect.Right = TmpRect.Left + Check1.Width
TmpRect.Bottom = TmpRect.Top + Check1.Height
If Int(PrintCaption) = 0 Then
DrawFrameControl GDI.hdc, TmpRect, DFC_BUTTON, DFCS_BUTTONCHECK
Else
DrawFrameControl GDI.hdc, TmpRect, DFC_BUTTON, DFCS_CHECKED
End If
Else
DRect.Left = DRect.Left + 3
DRect.Top = DRect.Top + 2
DRect.Right = DRect.Right - 3
DRect.Bottom = DRect.Bottom - 2
Select Case Table(1).TD(nSetX).Alignment
Case 0: DrawText GDI.hdc, PrintCaption, LenB(StrConv(PrintCaption, vbFromUnicode)), DRect, DT_VCENTER Or DT_SINGLELINE
Case 1: DrawText GDI.hdc, PrintCaption, LenB(StrConv(PrintCaption, vbFromUnicode)), DRect, DT_RIGHT Or DT_VCENTER Or DT_SINGLELINE
Case 2: DrawText GDI.hdc, PrintCaption, LenB(StrConv(PrintCaption, vbFromUnicode)), DRect, DT_CENTER Or DT_VCENTER Or DT_SINGLELINE
End Select
End If
End If
NextX:
Next X
Next Y
Dim LeftX As Long
Dim RightX As Long
Dim TopY As Long
Dim BottomY As Long
If IsMouseSelect = True Then
If MovX < MovOverX Then
LeftX = MovX
RightX = MovOverX
Else
LeftX = MovOverX
RightX = MovX
End If
If MovY < MovOverY Then
TopY = MovY
BottomY = MovOverY
Else
TopY = MovOverY
BottomY = MovY
End If
sCoolWidth = RightX - LeftX
sCoolHeight = BottomY - TopY
CollRes.DrawLine 0, 0, sCoolWidth, sCoolHeight, m_TableColor, m_BackColor, LineTypeBf
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = 60
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, LeftX, TopY, sCoolWidth + 1, sCoolHeight + 1, CollRes.hdc, 0, 0, sCoolWidth, sCoolHeight, lBF
GDI.DrawLine LeftX, TopY, RightX, BottomY, m_TableColor, m_BackColor, LineTypeB
End If
BitBlt UserControl.hdc, 0, 0, DBGridWidth, DBGridHeight, GDI.hdc, 0, 0, vbSrcCopy
If IsEdit = True Then
If FocusRect.Left = 0 And FocusRect.Top = 0 And FocusRect.Right = 0 And FocusRect.Bottom Then
GoTo HideEdit
End If
If EditRow > memVScrollValue And EditRow <= memVScrollValue + ForData Then
RectW = FocusRect.Right - FocusRect.Left
RectH = FocusRect.Bottom - FocusRect.Top
Select Case EditType
Case DateTimeType:
If FocusRect.Left + RectW > 0 And FocusRect.Left < DBGridWidth Then
TimeText1.Move FocusRect.Left, FocusRect.Top + Int(RectH / 2 - Check1.Height / 2) - 1, RectW
TimeText1.Visible = False
TimeText1.Visible = True
TimeText1.SetFocus
Else
TimeText1.Visible = False
End If
Case CheckType:
If FocusRect.Left + Int(RectW / 2 - Check1.Width / 2) + 1 + Check1.Width > 0 And FocusRect.Left + Int(RectW / 2 - Check1.Width / 2) + 1 < DBGridWidth Then
Check1.Move FocusRect.Left + Int(RectW / 2 - Check1.Width / 2) + 1, FocusRect.Top + Int(RectH / 2 - Check1.Height / 2) + 1
Check1.Visible = False
Check1.Visible = True
Check1.SetFocus
Else
Check1.Visible = False
End If
Case ComboType:
If FocusRect.Left + RectW > 0 And FocusRect.Left < DBGridWidth Then
Combo1.Move FocusRect.Left, FocusRect.Top + Int(RectH / 2 - Check1.Height / 2) - 1, RectW
Combo1.Visible = False
Combo1.Visible = True
Else
Combo1.Visible = False
End If
Case ComboTextType:
If FocusRect.Left + RectW > 0 And FocusRect.Left < DBGridWidth Then
Combo2.Move FocusRect.Left, FocusRect.Top + Int(RectH / 2 - Check1.Height / 2) - 1, RectW
Combo2.Visible = False
Combo2.Visible = True
Combo2.SetFocus
Else
Combo2.Visible = False
End If
Case TextCoLfType:
If FocusRect.Left + RectW > 0 And FocusRect.Left + 1 < DBGridWidth Then
Text2.Move FocusRect.Left + 1, FocusRect.Top + 1, RectW - 1, RectH - 1
Text2.Visible = False
Text2.Visible = True
Text2.SetFocus
Else
Text2.Visible = False
End If
Case TextType:
If FocusRect.Left + RectW > 0 And FocusRect.Left + 1 < DBGridWidth Then
Text1.Move FocusRect.Left + 1, FocusRect.Top + 1, RectW - 1, RectH - 1
Text1.Visible = False
Text1.Visible = True
Text1.SetFocus
Else
Text1.Visible = False
End If
Case NumericType:
If (FocusRect.Left + RectW) > 0 And (FocusRect.Left + 1) < DBGridWidth Then
Text1.Move FocusRect.Left + 1, FocusRect.Top + 1, RectW - 1, RectH - 1
Text1.Visible = False
Text1.Visible = True
Text1.SetFocus
Else
Text1.Visible = False
End If
Case TextButton
If (FocusRect.Left + 1) + (RectW - 1 - TRHeight) > 0 And FocusRect.Left + 1 < DBGridWidth Then
Text1.Move FocusRect.Left + 1, FocusRect.Top + 1, RectW - 1 - TRHeight, RectH - 1
Text1.Visible = False
Text1.Visible = True
Text1.SetFocus
Else
Text1.Visible = False
End If
If (Text1.Left + Text1.Width) + TRHeight > 0 And (Text1.Left + Text1.Width) < DBGridWidth Then
Command1.Move Text1.Left + Text1.Width, Text1.Top, TRHeight, Text1.Height
Command1.Visible = False
Command1.Visible = True
Else
Command1.Visible = False
End If
End Select
Else
HideEdit:
Select Case EditType
Case DateTimeType:
TimeText1.Visible = False
Case CheckType:
Check1.Visible = False
Case ComboType:
Combo1.Visible = False
Case ComboTextType:
Combo2.Visible = False
Case TextCoLfType:
Text2.Visible = False
Case TextType:
Text1.Visible = False
Case NumericType:
Text1.Visible = False
Case TextButton
Text1.Visible = False
Command1.Visible = False
End Select
End If
End If
End Sub
closevb 2011-05-04
  • 打赏
  • 举报
回复
非常谢谢您。牛人真多。我好好琢磨琢磨。.
现在还是人类 2011-05-04
  • 打赏
  • 举报
回复

Else
ButtonRECT(ButtonCount).Left = DRect.Left
ButtonRECT(ButtonCount).Top = DRect.Top
ButtonRECT(ButtonCount).Right = DRect.Right
ButtonRECT(ButtonCount).Bottom = DRect.Bottom
If Table(Y + memVScrollValue).TD(X).IsRUnite = True Then
ButtonRECT(ButtonCount).Y = PrintY
nSetY = PrintY
Else
ButtonRECT(ButtonCount).Y = Y + memVScrollValue
nSetY = Y + memVScrollValue
End If
If Table(Y + memVScrollValue).TD(X).IsCUnite = True Then
ButtonRECT(ButtonCount).X = PrintX
nSetX = PrintX
Else
ButtonRECT(ButtonCount).X = X
nSetX = X
End If
If Table(nSetY).IsSelect = True Then
Select Case Table(1).TD(nSetX).Style
Case 0
sCoolWidth = DRect.Right - DRect.Left
sCoolHeight = DRect.Bottom - DRect.Top
CollRes.DrawLine 0, 0, sCoolWidth, sCoolHeight, m_TableColor, m_BackColorSelect, LineTypeBf
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = CollAlpha
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, sCoolWidth, sCoolHeight, CollRes.hdc, 0, 0, sCoolWidth, sCoolHeight, lBF
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Bottom - 1, m_HeadShadowColor, , LineTypeB
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Top, m_HeadBrightColor
GDI.DrawLine DRect.Left, DRect.Top, DRect.Left, DRect.Bottom - 1, m_HeadBrightColor

'GDI.DrawLine DRect.Left, DRect.Top, DRect.Right + 1, DRect.Bottom + 1,m_TableColor, m_BackColorSelect, LineTypeBF
If SelRow = nSetY Then
If SelCol = nSetX Then
FocusRect.Left = DRect.Left
FocusRect.Top = DRect.Top
FocusRect.Right = DRect.Right
FocusRect.Bottom = DRect.Bottom
DFRect.Left = DRect.Left + 2
DFRect.Top = DRect.Top + 2
DFRect.Right = DRect.Right - 1
DFRect.Bottom = DRect.Bottom - 1
'GDI.DrawLine DFRect.Left, DFRect.Top, DFRect.Right, DFRect.Bottom,m_BackColorSelect ,, LineTypeB, 2
DrawFocusRect GDI.hdc, DFRect
End If
End If
GDI.ForeColor = m_ForeColorSelect
Case 1
If HadePic = True Then
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = 255
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, lBF
'StretchBlt GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, vbSrcCopy
Else
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right, DRect.Bottom, m_TableColor, m_HeadBackColor, LineTypeBf
End If
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Bottom - 1, m_HeadShadowColor, , LineTypeB
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Top, m_HeadBrightColor
GDI.DrawLine DRect.Left, DRect.Top, DRect.Left, DRect.Bottom - 1, m_HeadBrightColor
SelectObject GDI.hdc, TableBrush
If SelRow = nSetY Then
If SelCol = nSetX Then
FocusRect.Left = DRect.Left
FocusRect.Top = DRect.Top
FocusRect.Right = DRect.Right
FocusRect.Bottom = DRect.Bottom
DFRect.Left = DRect.Left + 2
DFRect.Top = DRect.Top + 2
DFRect.Right = DRect.Right - 3
DFRect.Bottom = DRect.Bottom - 3
'GDI.DrawLine DFRect.Left, DFRect.Top, DFRect.Right, DFRect.Bottom, , m_TableColor,, LineTypeB, 2
DrawFocusRect GDI.hdc, DFRect
End If
End If
GDI.ForeColor = ForeColorHead
End Select

Else
Select Case Table(1).TD(nSetX).Style
Case 0
sCoolWidth = DRect.Right - DRect.Left
sCoolHeight = DRect.Bottom - DRect.Top
CollRes.DrawLine 0, 0, sCoolWidth, sCoolHeight, m_TableColor, m_BackColor, LineTypeBf
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = CollAlpha
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, sCoolWidth, sCoolHeight, CollRes.hdc, 0, 0, sCoolWidth, sCoolHeight, lBF
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Bottom - 1, m_HeadShadowColor, , LineTypeB
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Top, m_HeadBrightColor
GDI.DrawLine DRect.Left, DRect.Top, DRect.Left, DRect.Bottom - 1, m_HeadBrightColor

'Rectangle GDI.hdc, DRect.Left, DRect.Top, DRect.Right + 1, DRect.Bottom + 1
SelectObject GDI.hdc, TableBrush
If SelRow = nSetY Then
If SelCol = nSetX Then
FocusRect.Left = DRect.Left
FocusRect.Top = DRect.Top
FocusRect.Right = DRect.Right
FocusRect.Bottom = DRect.Bottom
DFRect.Left = DRect.Left + 2
DFRect.Top = DRect.Top + 2
DFRect.Right = DRect.Right - 1
DFRect.Bottom = DRect.Bottom - 1
'GDI.DrawLine DFRect.Left, DFRect.Top, DFRect.Right, DFRect.Bottom,, m_TableColor, , LineTypeB, 2
DrawFocusRect GDI.hdc, DFRect
End If
End If
GDI.ForeColor = m_ForeColor
Case 1
If SelRow = nSetY Then
If SelCol = nSetX Then
FocusRect.Left = DRect.Left
FocusRect.Top = DRect.Top
FocusRect.Right = DRect.Right
FocusRect.Bottom = DRect.Bottom
DFRect.Left = DRect.Left + 2
DFRect.Top = DRect.Top + 2
DFRect.Right = DRect.Right - 3
DFRect.Bottom = DRect.Bottom - 3
'GDI.DrawLine DFRect.Left, DFRect.Top, DFRect.Right, DFRect.Bottom,, m_TableColor, , LineTypeB, 2
DrawFocusRect GDI.hdc, DFRect
End If
End If
If HadePic = True Then
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = 255
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, lBF
'StretchBlt GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, vbSrcCopy
Else
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right, DRect.Bottom, m_HeadBackColor, m_HeadBackColor, LineTypeBf
End If
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Bottom - 1, m_HeadShadowColor, , LineTypeB
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Top, m_HeadBrightColor
GDI.DrawLine DRect.Left, DRect.Top, DRect.Left, DRect.Bottom - 1, m_HeadBrightColor
GDI.ForeColor = ForeColorHead
End Select
End If
现在还是人类 2011-05-04
  • 打赏
  • 举报
回复

For Y = 1 To ForData
AddWidth = DrawXCount
For X = DrawX To DrawXEnd
If m_Check = True Then
If X = 1 Then
If Table(Y + memVScrollValue).IsHead = True Then
DRect.Left = AddWidth
DRect.Top = (Y - (1 + memVScrollValue)) * TRHeight
DRect.Right = DRect.Left + Check1.Width * 2
DRect.Bottom = DRect.Top + TRHeight
If HadePic = True Then
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = 255
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, lBF
'StretchBlt GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, vbSrcCopy
Else
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right, DRect.Bottom, m_TableColor, m_HeadBackColor, LineTypeBf
End If
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Bottom - 1, m_HeadShadowColor, , LineTypeB
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Top, m_HeadBrightColor
GDI.DrawLine DRect.Left, DRect.Top, DRect.Left, DRect.Bottom - 1, m_HeadBrightColor

Else
CheckCount = CheckCount + 1
If CheckCount = 1 Then
ReDim CheckRECT(CheckCount)
Else
ReDim Preserve CheckRECT(CheckCount)
End If
DRect.Left = AddWidth
DRect.Top = (Y - 1) * TRHeight
DRect.Right = DRect.Left + Check1.Width * 2
DRect.Bottom = DRect.Top + TRHeight
CheckRECT(CheckCount).Left = DRect.Left
CheckRECT(CheckCount).Top = DRect.Top
CheckRECT(CheckCount).Right = DRect.Right
CheckRECT(CheckCount).Bottom = DRect.Bottom
CheckRECT(CheckCount).Y = Y + memVScrollValue
CheckRECT(CheckCount).X = 0

sCoolWidth = DRect.Right + 1 - DRect.Left
sCoolHeight = DRect.Bottom + 1 - DRect.Top
If Table(Y + memVScrollValue).IsSelect = True Then
'SelectObject GDI.hdc, TableBrushSelect
CollRes.DrawLine 0, 0, sCoolWidth, sCoolHeight, m_TableColor, m_BackColorSelect, LineTypeBf
Else
'SelectObject GDI.hdc, TableBrush
CollRes.DrawLine 0, 0, sCoolWidth, sCoolHeight, , m_TableColor, m_BackColor, LineTypeBf
End If
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = CollAlpha
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, sCoolWidth, sCoolHeight, CollRes.hdc, 0, 0, sCoolWidth, sCoolHeight, lBF

'Rectangle GDI.hdc, DRect.Left, DRect.Top, DRect.Right + 1, DRect.Bottom + 1

DFRect.Left = Check1.Width / 2
DFRect.Top = ((Y - 1) * TRHeight) + (TRHeight / 2 - Check1.Height / 2)
DFRect.Right = DFRect.Left + Check1.Width
DFRect.Bottom = DFRect.Top + Check1.Height

If Table(Y + memVScrollValue).IsCheck = False Then
DrawFrameControl GDI.hdc, DFRect, DFC_BUTTON, DFCS_BUTTONCHECK
Else
DrawFrameControl GDI.hdc, DFRect, DFC_BUTTON, DFCS_CHECKED
End If
End If
AddWidth = AddWidth + Check1.Width * 2
End If
End If

If Table(1).TD(X).Visible = False Then
GoTo NextX
End If

PrintCaption = Table(Y + memVScrollValue).TD(X).Caption
' If InStr(1, PrintCaption, "变动情况") <> 0 Then
' PrintCaption = PrintCaption
' End If
PrintY = Y + memVScrollValue
PrintX = X
'取得目标单元格的矩形大小
DRect.Bottom = 0
If Table(Y + memVScrollValue).TD(X).IsRUnite = True Then
If Table(Y + memVScrollValue).TD(X).RowUniteCount = 0 Then
AddWidth = AddWidth + Table(1).TD(X).cWidth
GoTo NextX
End If
For I = Y To m_Rows
If Table(I + memVScrollValue).TD(X).IsRUnite = True Then
DRect.Bottom = DRect.Bottom + TRHeight
Else
Exit For
End If
Next I
Else
DRect.Bottom = TRHeight
End If

DRect.Right = 0
If Table(Y + memVScrollValue).TD(X).IsCUnite = True Then
If Table(Y + memVScrollValue).TD(X).ColUniteCount = 0 Then
AddWidth = AddWidth + Table(1).TD(X).cWidth
GoTo NextX
End If
For I = X To m_Cols
If Table(Y + memVScrollValue).TD(I).IsCUnite = True Then
DRect.Right = DRect.Right + Table(1).TD(I).cWidth
Else
X = I - 1
Exit For
End If
Next I
Else
DRect.Right = DRect.Right + Table(1).TD(X).cWidth
End If
DRect.Left = AddWidth
DRect.Top = (Y - 1) * TRHeight
AddWidth = AddWidth + DRect.Right
DRect.Right = DRect.Left + DRect.Right
DRect.Bottom = DRect.Top + DRect.Bottom
ButtonCount = ButtonCount + 1
If ButtonCount = 1 Then
ReDim ButtonRECT(ButtonCount)
Else
ReDim Preserve ButtonRECT(ButtonCount)
End If
If Table(Y + memVScrollValue).IsHead = True Then
ButtonRECT(ButtonCount).Left = DRect.Left
ButtonRECT(ButtonCount).Top = DRect.Top
ButtonRECT(ButtonCount).Right = DRect.Right
ButtonRECT(ButtonCount).Bottom = DRect.Bottom
If Table(Y + memVScrollValue).TD(X).IsRUnite = True Then
ButtonRECT(ButtonCount).Y = PrintY
Else
ButtonRECT(ButtonCount).Y = Y + memVScrollValue
End If
If Table(Y + memVScrollValue).TD(X).IsCUnite = True Then
ButtonRECT(ButtonCount).X = PrintX
Else
ButtonRECT(ButtonCount).X = X
End If
' FocusRect.Left = DRect.Left
' FocusRect.Top = DRect.Top
' FocusRect.Right = DRect.Right
' FocusRect.Bottom = DRect.Bottom
If HadePic = True Then
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = 255
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, lBF
'StretchBlt GDI.hdc, DRect.Left, DRect.Top, DRect.Right - DRect.Left, DRect.Bottom - DRect.Top, HadeRes.hdc, 0, 0, HadeRes.sWidth, HadeRes.sHeight, vbSrcCopy
Else
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right, DRect.Bottom, m_HeadBackColor, m_HeadBackColor, LineTypeBf
End If
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Bottom - 1, m_HeadShadowColor, , LineTypeB
GDI.DrawLine DRect.Left, DRect.Top, DRect.Right - 1, DRect.Top, m_HeadBrightColor
GDI.DrawLine DRect.Left, DRect.Top, DRect.Left, DRect.Bottom - 1, m_HeadBrightColor
GDI.ForeColor = ForeColorHead
DrawText GDI.hdc, PrintCaption, LenB(StrConv(PrintCaption, vbFromUnicode)), DRect, DT_CENTER Or DT_VCENTER Or DT_SINGLELINE
现在还是人类 2011-05-04
  • 打赏
  • 举报
回复
自己用 GDI 绘制,用 DrawTextW 或 TextOutW 绘制文本就可以支持多国语言。
给你看一个我的DBGrid控件刷新界面过程,应该会对你有启发

Public Sub Refresh()
Dim DrawX As Long
Dim DrawXCount As Long
Dim DrawXEnd As Long
Dim DrawXEndCount As Long
Dim DRect As RECT
Dim DFRect As RECT
Dim ForData As Long
Dim AddWidth As Long
Dim X As Long
Dim Y As Long
Dim nSetX As Long
Dim nSetY As Long
Dim I As Long
Dim PrintCaption As String
Dim PrintY As Long
Dim PrintX As Long
Dim ButtonCount As Long
Dim CheckCount As Long
Dim TmpRect As RECT
Dim BackBrush As Long
Dim BF As blendFunction, lBF As Long
Dim sCoolWidth As Long
Dim sCoolHeight As Long
If IsMessageBoxFocu = True Then
Exit Sub
End If
Dim RectW As Long
Dim RectH As Long

If m_Rows < 1 Then
Exit Sub
End If
If m_Cols < 1 Then
Exit Sub
End If
If MemResize = False Then
MemRefresh = True
UserControl_Resize
MemRefresh = False
End If
GDI.Cls
If BackPic = True Then
If m_BackFillStyle = Tile_Image Then
BackBrush = CreatePatternBrush(BackRes.hBitmap)
FillRect GDI.hdc, DBGridRect, BackBrush
DeleteObject BackBrush
Else
BF.AlphaFormat = 0
BF.BlendFlags = 0
BF.BlendOp = AC_SRC_OVER
BF.SourceConstantAlpha = 255
CopyMemory lBF, BF, 4
AlphaBlend GDI.hdc, 0, 0, DBGridRect.Right, DBGridRect.Bottom, BackRes.hdc, 0, 0, BackRes.sWidth, BackRes.sHeight, lBF
End If
End If
If m_Rows < 1 Or m_Cols < 1 Then
Exit Sub
End If
DrawX = 0
DrawXCount = 0
DrawXEnd = 0
DrawXEndCount = 0
ButtonCount = 0
CheckCount = 0
'找出开始横向绘制的开始项目数
For X = 1 To Cols
DrawXCount = DrawXCount + Table(1).TD(X).cWidth
If DrawXCount >= memHScrollValue Then
DrawXCount = DrawXCount - Table(1).TD(X).cWidth
DrawX = X
Exit For
End If
Next X
DrawXCount = (DrawXCount - memHScrollValue)
DrawXEndCount = -DrawXCount
DrawXEnd = DrawX
'找出开始横向绘制的停止项目数
For X = DrawXEnd To Cols
DrawXEndCount = DrawXEndCount + Table(1).TD(X).cWidth
DrawXEnd = X
If DrawXEndCount >= DBGridWidth + Table(1).TD(DrawX).cWidth * 2 Then
Exit For
End If
Next X
If NowShowRowCount > Rows Then
ForData = Rows
Else
ForData = NowShowRowCount
End If
FocusRect.Left = 0
FocusRect.Top = 0
FocusRect.Right = 0
FocusRect.Bottom = 0
closevb 2011-05-04
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 chenjl1031 的回复:]
用微软扩展对象库:Microsoft Forms 2.0 Object Library,这一套控件支持Unicode.不过,好像没有表格控件,有文本框、列表框、组合框等众多控件。
[/Quote]

首先感觉您的回复,

是呀。Forms 2.0里面是没有的。
Unicode虽然可以转换显示打印到到hDc上,但就是琢磨不出怎么叫表格里显示出来。例如:"가을이오면
",我转换后赋值,放表格里还是"???",在窗体上是能打印出来的。
closevb 2011-05-04
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 jiashie 的回复:]
韩文环境下编程,自然就支持韩文了
[/Quote]

谢谢你。确实很多人这么说的。我现在还没有试,我不知道会不会带来更多的问题。不过至少有办法了,黑暗中有一点光明是很欣慰的。谢谢。
closevb 2011-05-04
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 li163 的回复:]
一堆都是什么?又怎么不如意?

说出来,大家才可能帮你
[/Quote]

首先谢谢你热心的回复。

手中确实使用过很多表格控件。
每一个都使用过一段很长时间,现在用得最多的还是
MSHFlexGrid ,dataGrid,DidaGrid,CoolGrid,FlexGrid8
这几个各有好处。
我现在需要用表格显示数据库里的韩文数据,
MSHFlexGrid ,dataGrid,设置字符集与字体是可以支持韩文显示的。但我不知道为什么,MSHFlexGrid总是不能显示超过二千四百多行的数据。分页吧。dataGrid,也支持,并且没有行的限制。可长得太丑了。我又没有可以美化它的技术水平。所以一直在找第三方的控件。

DidaGrid,经常用它,蛮方便的,据说支持韩文。我一次也没试成功。后来才知道,它们说的是收费版本支持。所以这次给我教训,等俺有钱了,俺一定要买原版。

总结上面的教训后,我最后终于找了一个原版的FlexGrid8,而不是破解版了。可是试了半天还是没试出来。显示出来,全是问号。

现在用的是CoolGrid第三方控件. MSHFlexGrid 的升级版,非常方便。也支持韩文。但同样,受最多行的限制。并且很杯具的是这个软件现在以经不支持升级了。所以它很多明显的bug.它也不会修正了。但没办法,只能凑合着用。

各位大牛们,你们有什么能显示韩文的表格么?在表格中显示,像显示下面的它一样:가을이오면
介绍得不太清楚的地方请多见谅。再次感谢了。
东方之珠 2011-05-04
  • 打赏
  • 举报
回复
用微软扩展对象库:Microsoft Forms 2.0 Object Library,这一套控件支持Unicode.不过,好像没有表格控件,有文本框、列表框、组合框等众多控件。
jiashie 2011-05-04
  • 打赏
  • 举报
回复
韩文环境下编程,自然就支持韩文了
li163 2011-05-04
  • 打赏
  • 举报
回复
一堆都是什么?又怎么不如意?

说出来,大家才可能帮你
001、VB串口通讯视频教程源码41个 002、Visual Basic串口通信工程开发实例导航随书源码7个 003、Visual Basic串口通信与测控应用技术实战详解 源代码(15个全) 004、GE PLC串口通讯,VB编制,读取内存单元 005、PC机与51单片机之间的串口通讯,VB编的,分PC和单片机两部分 006、VB6的串口通信程序,还有crc校验 007、VB Modbus RTU源码,其中协议部分已生成DLL,可直接调用 008、VB.net开发的串口调试程序 009、VB.net实现串口编程,希望大家有用 010、VB版串口调试程序,包含VB源码及安装文件,适合调试串口 011、VB编程RS232串口控制DA数模转换 012、VB编程实现的串口调试工具源码 013、VB编写的RS232串口通信测试程序,以txt格式接受,可定义发送字符 014、VB编写的SouthStar串口测试与51串口烧写器V1.0版 015、VB编写的串口调试助手1.0的源码 016、VB编写的串口短信发送程序,需要数据线支持 017、VB编写的串口通信程序,实现多机通信 018、VB编写的串口通信程序,主要用于上位机与下位机间的通信 019、VB编写的串口通信程序界面参考网上的程序较简单 020、VB编写的串口通讯界面,主要面向51单片机的串口通信 021、VB编写的单片机和PC串口通信的调试程序 022、VB编写的仿真实电子琴操作界面,包含与FPGA串口通信的功能 023、VB串口API通讯,附带BAS文件全部源码,实现与饭卡读卡器通讯 024、VB串口编程,关于上位机的应用,特别适合初级学习VB的学员 025、VB串口编程调试精灵源码 026、VB串口编程实现完整的多费率电表读数软件 027、VB串口程序,,是一个串口使用例程,对初学者有用,特别是工控类的 028、VB串口传输文本,实现2台PC间的通信,类似简单的聊天工具 029、VB串口的一个电子称的项目 030、VB串口调试程序,用于通过串口控制松下空调测试 031、VB串口调试程序及源码 032、VB串口调试软件源代码,可以参考修改为其它通讯程序 033、VB串口调试软件源文件 034、VB串口控制步进电机程序完整源码 035、VB串口通信 6路10位AD转换数据采集源程序 036、VB串口通信,API串口通信模块源码 037、VB串口通信,适用简单,适合初学者 038、VB串口通信操作界面,进行数据采集,画实时曲线 039、VB串口通信程序,可以读取串口并显示保存数据,且能显示数据曲线 040、VB串口通信的源码,学习的好资料 041、VB串口通信调试器的源码程序 042、VB串口通信设计视频演示源码 043、VB串口通信示例 044、VB串口通信数据源码 045、VB串口通信之串口接收程序 046、VB串口通讯测试源代码,有文本和图形两种端口数据观察方式 047、VB串口通讯程序,用来跟单片机通讯 048、VB串口通讯代码(部分) 049、VB串口通讯的参考源程序 050、VB串口通讯实例 高精度电压表(24bit) VB源程序 051、vb串口通讯示例 052、VB串口与伺服电机DSP2407通讯完整代码源程序 053、VB串口源码,动力电池检测数据采集,内含电导巡检模块通讯报文,可,读写,保存,备份数据 054、VB串口字节通信程序,包括:1字节发送子程序,n字节接收子程序 055、VB串行口通信测试示例 056、VB串行通信试验程序 057、VB的MODEM通信源代码,智能化水电远端数据读取系统 058、VB的串口源程序,包括串口的配置界面,接收功能和发送功能 059、VB访问串口,并读取电子秤上显示的数据 060、VB和西门子S7-300 PLC串口通讯程序能实现读写功能 061、VB检测串口工作状态 062、VB简单的串口短信收发功能,使用短信猫测试通过 063、VB开发串口通信,关于生物医学工程专业的血氧饱和度的设计 064、VB开发串口通信软件,利用按钮控件控制高清晰数字展示台 065、VB开发的RS232串口图像处理器驱动(摄像头驱动) 066、VB开发的串口通信源码 067、VB开发的串口与三菱FX PLC通讯源码 068、VB控制串口232通讯,对飞利浦M1卡内数据进行处理,支持密码修改等 069、VB利用Mscomm控件编写的通讯终端,可做串口通讯编程参考示例 070、VB平台单片机与PC机串口通信的PC端程序。小巧易用,功能丰富 071、VB嵌入式串口通讯波形分析显示软件 072、VB实现串口调试LED信息显示屏设备主要代码 073、VB实现串口调试工具的完整源码 074、vb实现串口通信 文件传送系统,用vb以及mscomm控件实现 075、VB实现串口通信,发送命令从而接收相应数据 076、VB使用mscom控件实现PC机与单片机串口通信 077、VB通过COM串口读取条形码设备 078、VB通过串口控制单片机读写24C02源代码 079、VB通讯程序,连接串口可在电脑显示来电号码 080、VB下的串口发短信程序,可选择端口,设置短信中心号码 081、VB写的串口通信,发送和接收实例 082、VB写的串口通信分析程序源码 083、VB写的串口通讯,通过串口对单片机进行控制 084、VB写的串口通讯软件,简单易学,适合初学者 085、VB写的通过串口与考勤机连接通讯的程序 086、vb用控件的写的串口程序,是vb的经典之作 087、VB与USB转串口的通讯完整程序,有详细说明,不需要安装驱动 088、vb与串口通信的关于回路测试的小程序很实用 089、vb语言开发的串口通信,可实现拨号传送文件等 090、VB中串口事件处理函数的示例 091、VB中的串口通讯,串口通讯作为一种古老而又灵活的通讯方式,被广泛地应用 092、VB自动枚举系统串口加摄象头图象采集,坐标系变换 093、Visual Basic2005与自动化系统监控(串并行控制)光盘

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧