📄 h20000127-30.htm
字号:
<p>---- 以 上 两 种 方 法 在 本 人 开 发 的 软 件 当 中 多 次 应 用, 效 果 很 好。 </p> <p>返回</p> <p>C++Builder 中大尺寸图象的显示技巧 </p> <p>罗 洁 才 </p> <p>---- 在C++Builder 中 利 用TImage 控 件 可 以 轻 松 地 读 入 并 显 示 图 象, 但TImage 控 件 本 身 不 可 以 接 收 输 入 焦 点, 也 没 带 有 滚 动 条, 在 显 示 超 出 显 示 区 域 范 围 的 大 图 象 时, 需 要 对TImage 控 件 进 行 加 强。 本 文 提 出 两 种 最 容 易 实 现 且 有 效 的 方 法, 满 足 不 同 应 用 的 需 求。 </p> <p>---- 方 法 一: 增 加 滚 动 条。 </p> <p>---- 增 加 滚 动 条 可 以 通 过 将TImage 放 在TScrollBox 控 件 中 来 实 现。 步 骤 如 下: </p> <p>---- (1)、 在 窗 体 中 放 置 一 个TScrollBox 控 件, 调 整 好 其 尺 寸。 </p> <p>---- (2)、 设 置TScrollBox 控 件 的AutoScroll 属 性 为True。 </p> <p>---- (3)、 在TScrollBox 控 件 是 放 置 一 个TImage 控 件。 </p> <p>---- (4)、 设 置TImage 控 件 的 属 性:AutoSize 为True,Left 为0,Top 为0。 经 以 上 增 强 之 后, 如 果TImage 的 图 象 比 显 示 窗 口 大, 滚 动 条 会 自 动 出 现, 如 果 图 象 小 于 显 示 窗 口, 滚 动 条 自 动 消 失, 实 现 了 大 图 象 的 浏 览。 </p> <p>---- 方 法 二: 图 象 漫 游。 </p> <p>---- 图 象 漫 游 是 指 不 用 滚 动 条, 通 过 键 盘 或 者 鼠 标 控 制 图 象 的 移 动, 从 而 在 较 小 的 显 示 区 域 内 可 以 浏 览 图 象 的 任 何 部 分。 下 面 以 鼠 标 控 制 为 例 说 明。 </p> <p>---- (1)、 在 窗 体 中 放 置 一 个TPanel 控 件, 调 整 好 其 尺 寸。 </p> <p>---- (2)、 在TPanel 控 件 是 放 置 一 个TImage 控 件。 </p> <p>---- (3)、 设 置TImage 控 件 的AutoSize 属 性 为True,Left 属 性 为0,Top 属 性 为0。 </p> <p>---- (4)、 在TForm1 的 类 定 义 中 加 两 个 私 有 变 量: int iX0,iY0; </p> <p>---- (5)、 响 应TImage 控 件 的OnMouseDown 和OnMouseMove 事 件。 </p> <p>void __fastcall TForm1::Image1MouseDown(TObject *Sender,</p> <p>TMouseButton Button, TShiftState Shift, int X, int Y)</p> <p>{</p> <p>iX0 = X;</p> <p>iY0 = Y;</p> <p>}</p> <p>void __fastcall TForm1::Image1MouseMove</p> <p>(TObject *Sender, TShiftState Shift, int X, int Y)</p> <p>{</p> <p>int iDeltaX, iDeltaY;</p> <p>if(Shift.Contains(ssLeft))</p> <p>{</p> <p>iDeltaX = X - iX0;</p> <p>iDeltaY = Y- iY0;</p> <p>if(iDeltaY)</p> <p>Image1->Left += iDeltaX;</p> <p>if(iDeltaY)</p> <p>Image1->Top += iDeltaY;</p> <p>}</p> <p>}</p> <p> </p> <p>---- (6)、 运 行 时 按 住 鼠 标 左 键 拖 动, 图 象 将 跟 随 移 动。 </p> <p>---- (7)、 如 果 通 过 键 盘 控 制, 只 需 参 考 鼠 标 控 制 的 代 码, 加 入 键 盘 控 制 即 可。 </p> <p>---- (8)、 实 际 应 用 时, 根 据 需 要 加 入 边 界 限 制, 保 证 图 象 不 会 被 移 出 显 示 区 域 之 外。 </p> <p>---- 以 上 两 种 方 法 在 本 人 开 发 的 软 件 当 中 多 次 应 用, 效 果 很 好。 </p> <p>返回</p> <p></font> </td> <td align="middle" vAlign="top" width="10"><p class="content4"><span class="font"></span></td> <td align="middle" bgColor="#fff1c0" vAlign="top" width="140"><table border="0" width="100%" cellspacing="1" cellpadding="0"> <tr> <td width="100%" align="center" class="content2" valign="middle" bgcolor="#FFF1C8"> <br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(255,255,255); text-decoration: none"></a><a href="http://fun.wangchenyun.net" style="COLOR: rgb(0,0,0); TEXT-DECORATION: none">网星影院</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a style="color: rgb(0,0,0); text-decoration: none" href="http://202.101.18.141/netstar/news/">业界新闻</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://sales.wangchenyun.net" style="COLOR: rgb(0,0,0); TEXT-DECORATION: none">网星网风</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://person.dreamer.com.cn/netstar/newsoft/index.htm" style="COLOR: rgb(0,0,0); text-decoration: none">软件速递</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://person.dreamer.com.cn/netstar/software/software1.htm" style="COLOR: rgb(0,0,0); text-decoration: none">奇软异件</a><br> <a href="../../software/softuse/H01011-10.htm" style="color: rgb(0,0,0); text-decoration: none">软件宝库</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://person.dreamer.com.cn/netstar/newfree.htm" style="COLOR: rgb(0,0,0); text-decoration: none">最新免费</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://202.101.18.141/netstar/game/" style="COLOR: rgb(0,0,0); text-decoration: none">游戏地带</a><br> <font color="#FFFFFF"><a style="text-decoration: none; color: rgb(0,0,0)" href="../../software/game/H01012-12.htm">游戏下载</a></font><br> <a style="color: rgb(0,0,0); text-decoration: none" href="../../software/game/H01013-13.htm">游戏天地</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://202.101.18.141/netstar/hardware/" style="COLOR: rgb(0,0,0); text-decoration: none">硬件传真</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://www.wangchenyun.net/info/" style="COLOR: rgb(0,0,0); text-decoration: none">网球天地</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://person.dreamer.com.cn/netstar/pick/pick01.htm" style="COLOR: rgb(0,0,0); text-decoration: none">网星品网</a><br> <a href="../image/H01015-15.htm" style="color: rgb(0,0,0); text-decoration: none">制图素材</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://www.wangchenyun.net/others/" style="COLOR: rgb(0,0,0); text-decoration: none">壁纸世界</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://202.101.18.141/netstar/music/html/down.htm" style="COLOR: rgb(0,0,0); text-decoration: none">中文音乐</a><br> <a href="http://www.xa.sn.cn/software/software.htm" style="COLOR: rgb(0,0,0); text-decoration: none"></a><a href="http://www.wangchenyun.net/music/" style="COLOR: rgb(0,0,0); text-decoration: none">英文音乐</a></td> </tr> </table> <div align="center"><center><table border="0" cellPadding="0" cellSpacing="0" width="100%"><tbody> <tr> <td align="middle" bgColor="#3399FF" height="19" width="100%"><p class="content4" align="center"><font color="#FFFFFF"><span class="font"><span>知名软件搜索引擎</span></span></font></td> </tr> <tr> <td bgColor="#000000" height="1" width="100%"><p class="content4"><span class="font"></span></td> </tr> <tr> <td width="100%"><div align="center"><center><table border="0" cellPadding="0" cellSpacing="0" width="90%"><tbody> <tr> <td width="130" bgcolor="#FFF1C8"><p class="content4" align="center"> </p> <form action="http://hotfiles.zdnet.com/cgi-bin/texis/swlib/hotfiles/search.html" method="post" target="_blank"> <input type="hidden" name="Usrt" value="rel"><input type="hidden" name="Usrchtype" value="simple"><div align="center"><center><p class="content4">ZDNet的软件搜索:<br> <input maxLength="30" name="Utext" size="10"><br> <input border="0" name="search" src="../../soft/search.gif" type="image" value="Start Search" WIDTH="36" HEIGHT="17"> </p> </center></div> </form> <form action="http://www.download.com/PC/Result/TitleList/1,2,0-a-0-0-e-1,00.html?st.dl.fd.qs.results" method="post" target="_blank"> <div align="center"><center><p class="content4"><span class="font"><span>DownLoad软件搜索:</span><br> <input maxLength="60" name="search" size="10"><br> <input border="0" name="Search" src="../../soft/search.gif" type="image" value="Start Search" WIDTH="36" HEIGHT="17"></span></p> </center></div> </form> <form action="http://clipartconnection.com/search2.php3" method="post" target="_blank"> <div align="center"><center><p class="content4"><span class="font"><span>图片搜索引擎:</span><br> <input name="SearchText" size="10"><br> <input border="0" name="I1" src="../../soft/search.gif" type="image" value="Start Search" WIDTH="36" HEIGHT="17"></span></p> </center></div> </form> <a href="http://top.263.net/count/top.dll?Type=sharkpwd&id=2771&ReferID=2771" target="_blank"><p align="center"></a> </p> <a href="http://best.netease.com/cgi-bin/view/viewbasic.cgi?haiyuan54" target="_blank"><p align="center"></a> </td> </tr></tbody> </table> </center></div></td> </tr></tbody> </table> </center></div></td> </tr></tbody></table></center></div><hr align="center" SIZE="1" width="700"><p align="center" class="content4"><span><span><font color="#000000"> <a style="color: rgb(0,0,0); text-decoration: none" href="../../soft/network/index.htm">互联网络</font><font color="#FFFFFF"> </font></a><font color="#000000">|</span></span><a href="../../soft/system/index.htm" style="color: rgb(0,0,0); text-decoration: none">系统工具</a><span>|<span> <a href="../../soft/tools/index.htm" style="color: rgb(0,0,0); text-decoration: none">实用工具</a> | <a href="../../soft/multimedia/index.htm" style="color: rgb(0,0,0); text-decoration: none">媒体工具</a> | <a href="../../soft/image/index.htm" style="color: rgb(0,0,0); text-decoration: none">图形图像</a> | <a href="../../soft/game/index.htm" style="color: rgb(0,0,0); text-decoration: none">游戏娱乐</a> | </span><a href="../../soft/usesoft/index.htm" style="color: rgb(0,0,0); text-decoration: none">软件<span>使用</a></font><font color="#FFFFFF"> |</font> </span></span></p><hr align="center" SIZE="1" width="700"><font color="#FFE8BB"><p align="center" class="content4"></font><font color="#000000"><span><span>© Copyright 1999 </span></span>陕西公用计算机互联网信息中心<span><span> 版权所有 </font></p></span></span><p align="center" class="content4"><font color="#000000"><span><span>本站制作维护by <a href="mailto:haiyuan54@163.net" style="color: rgb(0,0,0)">HAIYUAN</a></span></span></font></p><p align="center" class="content4"><font color="#000000"><span><span>电话:(029)8371055 8371049 联系信箱:<a href="mailto:jun@snnic.com">jun@snnic.com</a> </span></span></font></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -