DELPHI里很容易解决,VB里就这么难吗?在VSFlexGrid表格里画线问题(DrawCell里写代码)。
能画出这样的效果我给300分。
http://www.cwsoft.net/money1.jpg
能画出这样的效果我给500分。
http://www.cwsoft.net/money2.jpg最好给代码例子,能把它搞成自定义控件就最好了。MailTo:[email protected]以下是参考的例子。是也是画的例子。VS自代的。Private Sub fa_DrawCell(ByVal hDC As Long, ByVal Row As Long, ByVal col As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long, done As Boolean)
Dim clr&, clrg&, l&
Dim rc As RECT
Dim rc1 As RECT
Dim clr1$, clr2$
Dim r1%, g1%, b1%
Dim r2%, g2%, b2%
Dim rg%, gg%, bg%
With fa
' make sure we need to draw this guy
clr1 = .TextMatrix(Row, 0)
clr2 = .TextMatrix(Row, 1)
If Row > 0 And col = 2 And clr1 <> "" And clr2 <> "" Then
' get rectangle
rc.left = left
rc.top = top
rc.right = right
rc.bottom = bottom
' draw frame
clr = SetBkColor(hDC, 0)
ExtTextOut hDC, rc.left, rc.top, ETO_OPAQUE, rc, " ", 1, l
InflateRect rc, -1, -1
' get colors
GetRGB clr1, r1, g1, b1
GetRGB clr2, r2, g2, b2
' show color
rc1 = rc
For l = rc.left To rc.right Step 3
rg = r1 + (l - rc.left) * (r2 - r1) / (rc.right - rc.left)
gg = g1 + (l - rc.left) * (g2 - g1) / (rc.right - rc.left)
bg = b1 + (l - rc.left) * (b2 - b1) / (rc.right - rc.left)
clrg = RGB(rg, gg, bg)
SetBkColor hDC, clrg
rc1.left = l
ExtTextOut hDC, rc1.left, rc1.top, ETO_OPAQUE, rc1, " ", 1, l
Next
' done, restore hDC and quit
SetBkColor hDC, clr
done = True
End If
End With
End Sub
能画出这样的效果我给300分。
http://www.cwsoft.net/money1.jpg
能画出这样的效果我给500分。
http://www.cwsoft.net/money2.jpg最好给代码例子,能把它搞成自定义控件就最好了。MailTo:[email protected]以下是参考的例子。是也是画的例子。VS自代的。Private Sub fa_DrawCell(ByVal hDC As Long, ByVal Row As Long, ByVal col As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long, done As Boolean)
Dim clr&, clrg&, l&
Dim rc As RECT
Dim rc1 As RECT
Dim clr1$, clr2$
Dim r1%, g1%, b1%
Dim r2%, g2%, b2%
Dim rg%, gg%, bg%
With fa
' make sure we need to draw this guy
clr1 = .TextMatrix(Row, 0)
clr2 = .TextMatrix(Row, 1)
If Row > 0 And col = 2 And clr1 <> "" And clr2 <> "" Then
' get rectangle
rc.left = left
rc.top = top
rc.right = right
rc.bottom = bottom
' draw frame
clr = SetBkColor(hDC, 0)
ExtTextOut hDC, rc.left, rc.top, ETO_OPAQUE, rc, " ", 1, l
InflateRect rc, -1, -1
' get colors
GetRGB clr1, r1, g1, b1
GetRGB clr2, r2, g2, b2
' show color
rc1 = rc
For l = rc.left To rc.right Step 3
rg = r1 + (l - rc.left) * (r2 - r1) / (rc.right - rc.left)
gg = g1 + (l - rc.left) * (g2 - g1) / (rc.right - rc.left)
bg = b1 + (l - rc.left) * (b2 - b1) / (rc.right - rc.left)
clrg = RGB(rg, gg, bg)
SetBkColor hDC, clrg
rc1.left = l
ExtTextOut hDC, rc1.left, rc1.top, ETO_OPAQUE, rc1, " ", 1, l
Next
' done, restore hDC and quit
SetBkColor hDC, clr
done = True
End If
End With
End Sub
'108,32
'1
MoveToEx hdc, 10 + 9 * 1, 10, papi
LineTo hdc, 10 + 9 * 1, 11 + 31
'2
MoveToEx hdc, 10 + 9 * 2, 10, papi
LineTo hdc, 10 + 9 * 2, 11 + 31
'3
MoveToEx hdc, 10 + 9 * 3, 10, papi
LineTo hdc, 10 + 9 * 3, 11 + 31
'4
MoveToEx hdc, 10 + 9 * 4, 10, papi
LineTo hdc, 10 + 9 * 4, 11 + 31
'5
MoveToEx hdc, 10 + 9 * 5, 10, papi
LineTo hdc, 10 + 9 * 5, 11 + 31
'6
MoveToEx hdc, 10 + 9 * 6, 10, papi
LineTo hdc, 10 + 9 * 6, 11 + 31
'7
MoveToEx hdc, 10 + 9 * 7, 10, papi
LineTo hdc, 10 + 9 * 7, 11 + 31
'8
MoveToEx hdc, 10 + 9 * 8, 10, papi
LineTo hdc, 10 + 9 * 8, 11 + 31
'9
MoveToEx hdc, 10 + 9 * 9, 10, papi
LineTo hdc, 10 + 9 * 9, 11 + 31
'SetTextColor hdc, &HFF&
'10
MoveToEx hdc, 10 + 9 * 10, 10, papi
LineTo hdc, 10 + 9 * 10, 11 + 31SetTextColor hdc, &H8000000F
'11
MoveToEx hdc, 10 + 9 * 11, 10, papi
LineTo hdc, 10 + 9 * 11, 11 + 31我都已经画了这么多了。大家帮忙吧。
高手帮帮忙
后面的哪个图的标题可以看做是2行和12列的合并,具体代码我不写了,重复工作而已
我给你关键的代码部分:
With MSHFlexGrid1
.FixedRows = 2 //标题行数
.MergeCells = flexMergeFree //自由合并
.row = 0
.MergeRow(0) = True //合并第一行
.ColAlignmentFixed = flexAlignCenterCenter
.TextMatrix(0, n) = text
.TextMatrix(0, n+1) = text
........................
.TextMatrix(0, n+11) = text //完成上半部分12列的合并
//然后对其他单元格进行2行的合并
.TextMatrix(0, col) = text1
.TextMatrix(1, col) = text1
.MergeCol(col) = True
End With那条红线我不知道怎样画,等别的高手指点吧