1
我想通過C#
代碼爲Windows-Phone 8
應用程序添加文本。這甚至有可能嗎?我有一些線路如在環 -在C#中添加行中的文本
Line[] l = new Line[300];
int cnt=0;
for(int i=0;i<20;i++)
{
for(int j=0;j<24;j++)
{
l[cnt] = new Line();
text1[cnt] = new TextBlock();
l[cnt].X1 = centre_X[i];
l[cnt].Y1 = centre_Y[i];
l[cnt].X2 = centre_X[j];
l[cnt].Y2 = centre_Y[j];
---
---
Here I want to insert the text say "Hello"
---
Canvas12.Children.Add(l[cnt]);
}
}
那麼下面,有一些方法通過在線條的中心加入一些textbox
或以其他方式添加一些文字?
這是不是很清楚你到底想做什麼。你想把這個文本放在哪裏? –
@AlexIsayenko我想把文本放在行的中心。我不能使用任何其他元素,比如'Button'或'Rectangle',因爲這些線條與橢圓的中心相連。基本上我想在這條線上添加文字,最好在這條線的中心。這與這個問題類似,但是在這裏他們已經在'XAML'中完成了,我想通過'C#'來完成 - http://stackoverflow.com/questions/27251787/adding-text-to-wpf-line – Noober