📄 r.html
字号:
<!DOCTYPE html PUBLIC "-//Netscape Comm. Corp.//DTD HTML//EN">
<html>
<head>
<title>Windows 95 API Dictionary: R</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">- R -</h1>
<hr ALIGN="center" WIDTH="85%" SIZE="5">
<p ALIGN="left"><a NAME="rectangle"></a></p>
<h3 ALIGN="center">Rectangle Function</h3>
<code>
<p align="center">Declare Function Rectangle Lib "gdi32.dll" (ByVal hdc As Long,
ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long</code><br>
Rectangle draws a rectangular-shaped box on a graphical object. The rectangle is drawn
with the color of the object's <code>ForeColor</code> property. It basically performs the
same function as Visual Basic's Line command when used with the B parameter. However, my
own tests have shown that the Rectangle API function is slightly faster than the Visual
Basic equivalent! So, if you are going to do a lot of graphics-intensive programming, use
this code. If not, you should probably use Line. This function returns an error code you
can safely disregard.<br>
</p>
<table WIDTH="95%" BORDER="2" CELLSPACING="0">
<tr>
<td WIDTH="20%"><code>hdc</code></td>
<td WIDTH="80%">The device context of the object. </td>
</tr>
<tr>
<td><code>X1</code></td>
<td>The x coordinate of the rectangle's upper-left corner. </td>
</tr>
<tr>
<td><code>Y1</code></td>
<td>The y coordinate of the rectangle's upper-left corner. </td>
</tr>
<tr>
<td><code>X2</code></td>
<td>The x coordinate of the rectangle's lower-right corner. </td>
</tr>
<tr>
<td><code>Y2</code></td>
<td>The y coordinate of the rectangle's lower-right corner. </td>
</tr>
</table>
<b>
<p>Example:</b><br>
<code> Draw a green rectangle<br>
Picture1.ForeColor = RGB(0, 255, 0) 'green<br>
x = Rectangle(Picture1.hdc, 25, 25, 100, 50)</code><br>
<br>
<b>Related Call:</b> <a HREF="#roundrect">RoundRect</a><br>
<b>Category:</b> <a HREF="index.html#graphics" REL="Index">Graphics</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>
<hr ALIGN="center" WIDTH="85%" SIZE="5">
<p ALIGN="left"><a NAME="releasedc"></a></p>
<h3 ALIGN="center">ReleaseDC Function</h3>
<code>
<p align="center">Declare Function ReleaseDC Lib "user32.dll" (ByVal hWnd As
Long, ByVal hdc As Long) As Long</code><br>
ReleaseDC breaks the association between an object and a variable holding its device
context (DC). 99% of the time they will have been linked with GetDC. You should break the
association when you are done using the device context of an object in order to free
memory and system resources. It is save to ignore the return value.<br>
</p>
<table WIDTH="95%" CELLSPACING="0" BORDER="2">
<tr>
<td WIDTH="20%"><code>hWnd</code></td>
<td WIDTH="80%">The handle of the object to break the association with. </td>
</tr>
<tr>
<td><code>hdc</code></td>
<td>The variable holding the object's device context. </td>
</tr>
</table>
<b>
<p>Example:</b><br>
<code> x = ReleaseDC(desktophWnd, desktophdc)</code><br>
<br>
<b>Related Call:</b> <a HREF="g.html#getdc">GetDC</a><br>
<b>Category:</b> <a HREF="index.html#devices" REL="Index">Devices</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>
<hr ALIGN="center" WIDTH="85%" SIZE="5">
<p ALIGN="left"><a NAME="roundrect"></a></p>
<h3 ALIGN="center">RoundRect Function</h3>
<code>
<p align="center">Declare Function RoundRect Lib "gdi32.dll" (ByVal hdc As Long,
X1 As Long, Y1 As Long, X2 As Long, Y2 As Long, X3 As Long, Y3 As Long) As Long</code><br>
RoundRect draws a rectangle with rounded corners on a graphical object. It is drawn in the
object's <code>ForeColor</code> property. The first two (x,y) coordinate pairs in the
parameter list are the upper-left and lower-right corners of a square-cornered rectangle
the same dimensions as the one to be drawn. The last pair are the height and width of the
ellipse used to make the rounded corners. Each corner is drawn as a corresponding
"corner" of an ellipse of height 2*Y3 and width 2*X3. That is, X3 and Y3 are the
width and height of the rounded corner. You can safely ignore the value returned.<br>
</p>
<table WIDTH="95%" BORDER="2" CELLSPACING="0">
<tr>
<td WIDTH="20%"><code>hdc</code></td>
<td WIDTH="80%">The device context of the graphical object to draw on. </td>
</tr>
<tr>
<td><code>X1</code></td>
<td>The x coordinate of the upper-left corner of the corresponding square-edged rectangle.
</td>
</tr>
<tr>
<td><code>Y1</code></td>
<td>The y coordinate of the upper-left corner of the corresponding square-edged rectangle.
</td>
</tr>
<tr>
<td><code>X2</code></td>
<td>The x coordinate of the lower-right corner of the corresponding square-edged
rectangle. </td>
</tr>
<tr>
<td><code>Y2</code></td>
<td>The y coordinate of the lower-right corner of the corresponding square-edged
rectangle. </td>
</tr>
<tr>
<td><code>X3</code></td>
<td>The width of each elliptical rounded corner. </td>
</tr>
<tr>
<td><code>Y3</code></td>
<td>The height of each elliptical rounded corner. </td>
</tr>
</table>
<b>
<p>Example:</b><br>
<code> 'Draw a rounded rectangle with rounded corners 10 pixels wide and 5 high<br>
'The rectangle stretches from (10,10) to (150,100).<br>
'Draw this on Form1<br>
Form1.Cls 'Clear drawings on the form<br>
x = RoundRect(Form1.hDC, 10, 10, 150, 100, 10, 5)</code><br>
<br>
<b>Related Call:</b> <a HREF="#rectangle">Rectangle</a><br>
<b>Category:</b> <a HREF="index.html#graphics" REL="Index">Graphics</a><br>
<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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -