开发者

Which WPF Control to use to visualize points

开发者 https://www.devze.com 2023-02-01 19:18 出处:网络
I\'m a complete beginner in WPF. I want to create an application such as when the user clicks on it the point clicked should be visualized in some colour(for instance red).

I'm a complete beginner in WPF. I want to create an application such as when the user clicks on it the point clicked should be visualized in some colour(for instance red). Which control should I use? I remember doing something similar in Windows Forms and GDI+ but it was 开发者_开发知识库3 years ago and I haven't done any GUI since.

Thanks for the help.


You have the following options:

  1. Use a canvas and position Ellipse/Rectangle controls on the canvas that are small enough to look as points. The easiest to program.
  2. Use an image with WritableBitmap as its image source and draw pixels. Can be very efficient but a bit difficult to program.
  3. Use a ListBox, and use an Ellipse/Rectangle as its DataTemplate (most compatible with MVVM-type scenarios). Quite easy to program and inefficient.
  4. Write a custom control that will draw points using low-level geometric primitives (StreamGeometry). This is the hardest to program task.

You can have other options, but I believe the list I mentioned is enough.

0

精彩评论

暂无评论...
验证码 换一张
取 消