📄 slide028.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="blendTrans(Duration=2)" http-equiv="Page-Enter">
<title>Big C++: Chptr. 27 -- Graphical User Interfaces</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Copyright" content="2005 John Wiley & Sons">
<meta name="Author" content="Kurt Schmidt">
</head>
<body>
<div onclick="document.location='slide029.html'">
<h2><font color='#009999'>27.8 Mouse Events (cont.)</font></h2>
<ul>
<li><font size="+1">In the notification functions, you can query the <tt>wxMouseEvent</tt>
about the event type (e.g. <tt>ButtonDown()</tt> returns <tt>true</tt> or
<tt>false</tt>, <tt>GetX()</tt> returns the <i>x</i>-position of the mouse,
etc.).
<blockquote>
<pre>void TriangleWindow::OnMouseEvent(wxMouseEvent& event)
{
if (event.ButtonDown() && corners < 3)
{
x[corners] = event.GetX();
y[corners] = event.GetY();
corners++;
Refresh();
}
}</pre>
</blockquote>
</font></li>
<li><font size="+1">In our program, we allow the user to specify a triangle
by clicking on the three corners.</font></li>
<li><font size="+1">With each press, we record the mouse position.</font></li>
<li><font size="+1">All drawing should happen in the paint handler.</font></li>
<li><font size="+1">The <tt>Refresh</tt> function generates a paint event, which
eventually causes the paint function to be called.</font></li>
<li><font size="+1">Calling the paint function directly should never be done
- always refresh instead.</font></li>
</ul>
<hr>
<center><small>
<a href='slide027.html'>prev</a>
|<a href='slide001.html'>top</a>
|<a href='slide029.html'>next</a>
</small></center>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -