o.html

来自「windowsAPI介绍。很详细的」· HTML 代码 · 共 79 行

HTML
79
字号
<!DOCTYPE html PUBLIC "-//Netscape Comm. Corp.//DTD HTML//EN">
<html>

<head>
<title>Windows 95 API Dictionary: O</title>
<base TARGET="_self">
<script LANGUAGE="JavaScript">
<!--Cloak
function statbar(txt) {
  window.status = txt;
  setTimeout("erase()",3000);
}
function erase() {
  window.status = "";
}
//Decloak-->
</script>
</head>

<body BGCOLOR="#004000" TEXT="#FFFFFF" LINK="#FFFF00" VLINK="#FF8000" ALINK="#80FF80">

<p><a NAME="top"></a></p>

<h1 ALIGN="center">- O -</h1>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="offsetrect"></a></p>

<h3 ALIGN="center">OffsetRect Function</h3>
<code>

<p align="center">Declare Function OffsetRect Lib &quot;user32.dll&quot; (lpRect As <a
HREF="appa.html#rect">RECT</a>, ByVal x As Long, ByVal y As Long) As Long</code><br>
OffsetRect slides a RECT-type variable without changing its size. The rectangle is moved <code>x</code> 
pixels horizontally and <code>y</code> pixels vertically, while the size is preseved. If 
the value to slide is negative, it is moved left or up (depending on which direction it 
is), and positive moves to the right or down. Really, the <code>x</code> value is added to 
the .Left and .Right values, while <code>y</code> is added to the .Top and .Bottom values. 
You can safely ignore the value returned.<br>
</p>

<table WIDTH="95%" BORDER="2" CELLSPACING="0">
  <tr>
    <td WIDTH="20%"><code>lpRect</code></td>
    <td WIDTH="80%">The rectangle to slide. </td>
  </tr>
  <tr>
    <td><code>x</code></td>
    <td>How many pixels horizontally to move. Negative values move to the left, positive 
    values move to the right. </td>
  </tr>
  <tr>
    <td><code>y</code></td>
    <td>How many pixels vertically to move. Negative values move up, positive values move 
    down. </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'Move a rectangle 100 to the right and 25 up<br>
&nbsp;&nbsp;Dim r As RECT<br>
&nbsp;&nbsp;x = SetRect(r, 50, 50, 150, 150) 'API function sets the values of the 
rectangle<br>
&nbsp;&nbsp;'.Left = 50, .Top = 50, .Right = 100, .Bottom = 100<br>
&nbsp;&nbsp;x = OffsetRect(r, 100, -25)<br>
&nbsp;&nbsp;'Now, .Left = 150, .Top = 25, .Right = 200, .Bottom = 75</code><br>
<br>
<b>Related Call:</b> <a HREF="i.html#inflaterect">InflateRect</a><br>
<b>Category:</b> <a HREF="index.html#rectmanipulation" REL="Index">RECT Manipulation</a><br>
<a HREF="#top">返回到索引</a><a HREF="index.html" REL="Index">.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"> </p>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?