资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

包含vb.net显示文本的词条

求大神指点vb.net PictureBox1 上面怎么显示文字呢? 要最小化在还原也不会变的那种

VB.NET在PicTureBox控件里显示文本,似乎并不简单,试试这段代码,自己琢磨一下:

我们提供的服务有:成都做网站、成都网站制作、成都外贸网站建设、微信公众号开发、网站优化、网站认证、诸暨ssl等。为近1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的诸暨网站制作公司

Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint

Dim format1 As New StringFormat(StringFormatFlags.NoClip) '封装文本布局信息(如对齐、文字方向和 Tab 停靠位)

format1.LineAlignment = StringAlignment.Center '垂直居中

format1.Alignment = StringAlignment.Center '水平居中

Dim MyFont As New Font("宋体", 12, FontStyle.Regular)

Dim displayRectangle As New Rectangle() '存储一组整数,共四个,表示一个矩形的位置和大小

displayRectangle = New Rectangle(New Point(20, 20), New Size(200, 100))

e.Graphics.DrawString("欢迎使用VB Net", MyFont, Brushes.Black, RectangleF.op_Implicit(displayRectangle), format1) '显示单元格里的文本

End Sub

VB.NET怎样打开text文件并显示到文本框里

文本框通常用来显示文本字符,以下是用

VB

编写的打开某

txt

文件,并把文件内容显示在文本框的步骤及代码:

1、添加必要的组件(文本框、按钮)

2、设置属性:

3、编写按钮的响应代码:

VB.NET如何显示多种颜色的一段文本?

Label控件是没有办法实现多种颜色的文字的,只能用RichTextBox来实现,而且你的自定义格式字符串也没有结尾的,这样很不好,至少也要red红色字/redyellow黄色字/yellow,而且实现也很麻烦的,下面的代码我没有检测正确性,有错误的自己改一改吧

Dim colortag() as string

dim colors() as color

const txt as string="red红色字/redyellow黄色字/yellow"

private sub Form_Load(object sender,eventargs e)handles mybase.load

colortag(0)="red":Colortag(1)="yellow"

colors(0)=color.red:colors(1)=color.yellow

richtextbox1.text=txt

for i as integer=0 to colortag.lenght-1

dim tag as string="" colortag(i) ""

dim endtag as string="/" colortag(i) ""

dim find as integer=1

do

find=instr(find,txt,tag)+tag.lenght

if(find0)then

dim find1 as integer=instr(find,txt,endtag)

richtextbox1.SelectionStart=find

richtextbox1.selectionlenght=find1-find

richtextbox1.selectioncolor=colors(i)

find=find1

else

exit do

end if

loop

next

end sub


网站标题:包含vb.net显示文本的词条
标题路径:http://cdkjz.cn/article/hhpgjo.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220