C# ToolTip 阻止执行?
我不知道如何问这个问题,但这是最后的努力,因为我被难住了。
我有一段 c# 代码,它将向服务器(使用 JSON)发送一个请求,以将 wms 图层绘制到地图上。该服务器开始执行其职责,然后 wms 图层出现在地图上。
在这段代码中,我有时想输出他们单击渲染此地图的时间(它是基于时间线的渲染),因此使用 c# 中包含图片框的 UserControl,我渲染此时间线,然后放置一个工具提示显示鼠标沿着该图片框移动的不同时间。
工具提示被定义为全局:
ToolTip myToolTip;
然后,当我在我的代码中使用它时:
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
//...blah blah blah stuff to calculate time where user clicked based on width of timeline drawn in the picturebox etc.
prisms.callServer("Timetable", "setSelection", selection, null); //call to server to tell it to render the map at the time defined by selection
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
//...blah blah..code to calculate mTheDate showing what the time is where they are where they are hovering
myToolTip.Show(mTheDate, this, toolTipX, toolTipY, 100);
}
因此,当发生上述情况时,地图不会呈现,直到我将鼠标从 userControl 上移开上面有图片框。
但是,如果我在 MouseMove 中取出 myToolTip.show,然后我单击地图渲染(我意识到它可能与我正在点击的 WMS 服务器等有很多关系,但这让我相信它与工具提示有关) ,因为删除它可以使事情工作得足够好,无需将鼠标从图片框控件上移开即可渲染地图)。
所以我意识到这是一个模糊的问题,但我被困住了,只是把它扔在那里寻求任何想法。也许工具提示还有更多我不理解的内容,或者我需要一种不使用工具提示的不同方法?
我还应该指出,即使有工具提示,prisms.Call 服务器也会执行(使用断点解决了这个问题),所以不确定发生了什么。
I have no clue how to ask this question but this is a last ditch effort as I am stumped.
I have this bit of c# code that will send off to a server (using JSON) a request to draw a wms layer to a map. That server goes and does its duty and bam the wms layer appears on the map.
IN this bit of code I sometimes wanna output the times they are clicking on to render this map (its a timeline based render), so using a UserControl in c# that contains a picture box, I render this timeline and then put up a tooltip that shows the various times as the mouse moves along this pictureBox.
The Tooltip is defined as globally:
ToolTip myToolTip;
Then when I use it in my bit of code:
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
//...blah blah blah stuff to calculate time where user clicked based on width of timeline drawn in the picturebox etc.
prisms.callServer("Timetable", "setSelection", selection, null); //call to server to tell it to render the map at the time defined by selection
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
//...blah blah..code to calculate mTheDate showing what the time is where they are where they are hovering
myToolTip.Show(mTheDate, this, toolTipX, toolTipY, 100);
}
So when the scenario above happens, the map doesn't render until i move the mouse off the userControl that has the picturebox on it.
BUT if i take out the myToolTip.show in the MouseMove then minute I click the map renders (i realize it could have lots to do with the WMS server I am hitting etc etc, but it leads me to believe it is something with the tooltips, since removing it makes things work well enough that the map renders without having to move my mouse off the picturebox control).
So I realize this is a vague, hazy question but I am stuck and just throwing this out there for any ideas. Maybe there is something more to the tooltips I don't understand or I need a different approach that does not use the tool tips?
I should also state that the prisms.Call server does get executed (using breakpoint figured this out) even with tool tip there so not sure what is going on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在运行 WMS 调用时,您始终可以隐藏工具提示(如果显示),然后恢复显示工具提示。
我没有任何特定于工具提示的知识。
You could always hide the tooltip (if its showing) while you run the WMS call, then resume showing the tooltip.
I do not have any tooltip-specific knowledge.