绘制带有由字母分隔的破折号的虚线 [英] To Draw dashed line having dashes separated by alphabets

查看:116
本文介绍了绘制带有由字母分隔的破折号的虚线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WPF中绘制一条虚线,并用字母替换为空格。



例如:-LLLL

或-XXXX-



请有人为此提供代码

解决方案

您好SnehSudha,

您需要编写代码来实现此目的。不确定你的要求。用户TextBlock控件下面的代码片段将帮助您在xaml.cs文件中进行简单的while循环。随便更改字母。



Line.Xaml:TextBlock Name =LetterLineHorizo​​ntalAlignment =Stretch/>



Line.Xaml.cs

将此代码放在构造函数中。这给你类似的输出。



int i = 0;

while(i <= 200)

{

LetterLine.Text = LetterLine.Text +A-;

i ++;

}

Sriram .B

I want to draw a dashed line in WPF with space in line replaced by alphabets.

For example: -L-L-L-L
or -X-X-X-X-

Please could anyone provide code for this

解决方案

Hi SnehSudha,
You need to write code to implement this. Not sure about your requirement. Below piece of code which users TextBlock control will help you just a simple while loop in xaml.cs file. Change the letter whatever you like.

Line.Xaml : TextBlock Name="LetterLine" HorizontalAlignment="Stretch"/>

Line.Xaml.cs
place this code inside constructor. This gives you similar output.

int i=0;
while(i<=200)
{
LetterLine.Text = LetterLine.Text + "A-";
i++;
}
Sriram.B


这篇关于绘制带有由字母分隔的破折号的虚线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆