文本方向 Flexgrid

发布于 2024-09-19 22:55:33 字数 125 浏览 8 评论 0原文

有没有办法像 Excel 一样在垂直方向上对齐 msflexgrid 中的文本?

谢谢

alt text

Is there anyway to align the text in msflexgrid in vertical orientation like excel does?

thanks

alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

掩于岁月 2024-09-26 22:55:33

将字体旋转 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.

君勿笑 2024-09-26 22:55:33

如果您谈论的是文本的垂直旋转,则不是。

您可以将文本转换为旋转图像,然后加载图像。

进一步...

您可以将旋转文本打印到图片框控件,然后将图片框分配给单元格。

此链接显示了该方法的类似用法,但原因略有不同。

http://vb.mvps.org/articles/ap199907.pdf

Not if you are talking about vertical rotation of text.

You could convert your text into a rotated image and then load the image.

Further on this...

You can print rotated text to a picturebox control and then assign the picturebox to a cell.

This link shows a similar usage of the method but for a slightly different reason.

http://vb.mvps.org/articles/ap199907.pdf

此岸叶落 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

垂直文本

Nothing built-in, but here is a hack I used a few years back. You pass in a string to the function and it passes back a string with a carriage return and line feed after every character.

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

vertical text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文