我正在繪製一個wpf畫布中的五角形,它工作正常,但我真的不知道如何在畫布中繪製一個簡單的點/點。我問過谷歌,我找不到合適/簡單的答案。如何使用x和y座標在c#wpf畫布中繪製一個簡單點?
private void Button_Click(object sender, RoutedEventArgs e)
{
string x = xCoo.Text;
string y = yCoo.Text;
commandText = "Select f.p_ID, f.bezeichnung from figure05 f " +
"where SDO_CONTAINS(f.shape, " +
"SDO_GEOMETRY(2001, NULL, " +
"SDO_POINT_TYPE("+Convert.ToInt32(x)+", "+Convert.ToInt32(y)+", NULL), NULL, NULL" +
")) = 'TRUE';";
using (OleDbConnection conn = new OleDbConnection(cs))
{
try
{
conn.Open();
MessageBox.Show("Connection open!");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
cmd = new OleDbCommand(commandText, conn);
OleDbDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
MessageBox.Show("Point is in Pentagon");
//Drawing point here
}
}
}
我的畫布:
<Canvas Name="myCanvas" Background="LightBlue" HorizontalAlignment="Left" Height="301" Margin="10,10,0,0" VerticalAlignment="Top" Width="318"/>
感謝任何形式的幫助!
可在畫一條線具有零長度,即相同的開始和結束點,一個適當的StrokeThickness,並將StrokeStartLineCap和StrokeEndLineCap設置爲Square或Round。 – Clemens