如何使用WPF绘制鼠标点击的密度配置文件? [英] How to use WPF to draw the density profile of mouse clicks?

查看:73
本文介绍了如何使用WPF绘制鼠标点击的密度配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的想法是使用GetPosition方法获取多次点击的坐标,然后将它们保存在字符串中,然后使用以下if语句:

  如果     x  <     192    &&   y  <     108      {  
计数 ++;
} 其他 如果 x < 192 & y > = 108 & y < 216 {
Count2 ++;
}



我要将屏幕划分为100个区域,我将根据项目的数量为该区域着色。这样效率不高,我想知道是否更容易这样做的方法。



解决方案

您好iDontKnowEverything,


现在像热图这样的图像可能会使用数万个点甚至数百万个点,而在画布上直接使用
也是个不错的主意。对于这种操作,您需要像素才能玩,它意味着特殊类型的容器,例如 
WritableImage
请查看链接。


https://stackoverflow.com/questions/33139140/generate-heatmap-using-canvas-in-wpf


最好的问候,


樱桃


My idea was to use the GetPosition method to get the coordinates for multiple clicks, then save them in a string, and then use the following if statement:

if (x < 192 && y < 108) {
    Count++;
} else if (x < 192 & y > = 108 & y < 216) {
    Count2++;
}

I'm going to divide the screen into 100 areas, and I'm going to color that area according to the count of items. This is not efficient, and I wonder if there's an easier way to do that.

解决方案

Hi iDontKnowEverything,

Now an image like an heat map could use tens of thousands points or even millions of points and that would be a pretty bad idea to play with it directly in canvas. For this kind manipulation, you need pixels to play with and it means special kind of container, like WritableImage. Please look on the link.

https://stackoverflow.com/questions/33139140/generate-heatmap-using-canvas-in-wpf

Best Regards,

Cherry


这篇关于如何使用WPF绘制鼠标点击的密度配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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