文本方向 Flexgrid
有没有办法像 Excel 一样在垂直方向上对齐 msflexgrid 中的文本?
谢谢
Is there anyway to align the text in msflexgrid in vertical orientation like excel does?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
君勿笑2024-09-26 22:55:33
如果您谈论的是文本的垂直旋转,则不是。
您可以将文本转换为旋转图像,然后加载图像。
进一步...
您可以将旋转文本打印到图片框控件,然后将图片框分配给单元格。
此链接显示了该方法的类似用法,但原因略有不同。
此岸叶落2024-09-26 22:55:33
没有任何内置内容,但这是我几年前使用的一个技巧。您将一个字符串传递给该函数,它会传回一个字符串,每个字符后带有回车符和换行符。
Private Function VerticalString(ByVal strInput As String) As String
Dim strReturn As String
Dim i As Integer
For i = 1 To Len(strInput)
strReturn = strReturn & Mid$(strInput, i, 1) & vbCrLf
Next i
If Len(strReturn) > 1 Then
strReturn = Mid$(strReturn, 1, Len(strReturn) - 1)
End If
VerticalString = strReturn
End Function
Private Sub FillGrid()
flexgrid1.TextMatrix(1, 0) = VerticalString("Kc Chiefs")
End Sub
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
将字体旋转 90 度有很多作用。 VB6 使用 stdole2 类型库的 OLE StdFont 对象部分。
您必须将 StdFont 转换为 GDI 字体才能对其进行操作。
这是一篇非常好的文章(Text At Any Angle)和示例代码继续执行此操作。
该示例在表单上绘图,但我认为您可以获取 MSFlexGrid 的句柄并在其中进行绘制。
然后,您可以控制绘制文本的时间和方式。如果您想在运行时编辑垂直文本,则可以在编辑文本时在单元格上显示水平文本框,然后在完成编辑后绘制新文本。
There is a lot to rotating Fonts by 90 degrees. VB6 uses an OLE StdFont object part of the stdole2 type library.
You will have to convert the StdFont into a GDI font to be able to manipulated it.
Here is a very nice post (Text At Any Angle) with sample code to go on doing exactly that.
The sample is drawing on a form, but I would think you can get a handle to a MSFlexGrid and draw into that.
You can then control when and how the text is drawn. If you want to edit the vertical text at runtime, you can show a horizontal textbox over the cell instead while editing the text and then draw the new text when finished editing.