喜欢就点一下“推荐”,给我点写下去的动力,谢谢!

声明:

本文版权归作者碧血黄沙.NET所有,欢迎转载,但转载必须保留以下版权信息,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

作者:碧血黄沙.net
出处:博客园http://www.cnblogs.com/wjj/archive/2010/02/25/1673157.html

你可以免费使用或修改提供的源代码,但请保留源代码中的版权信息。

本人继仿QQMusic、仿360杀毒、仿QQRadio播放器之后,最近疯狂迷恋上了“金山网盾”的界面。老在思考如何用C#做出象“金山网盾”那样的界面。

想模仿它,那就先研究它。打开“金山网盾”的安装目录,发现有一个webui文件夹,哈哈,真爽,软件所有的界面资源全在这里了,我就以webui\kwebshield\main.htm文件为例子说明一下吧!

直接在浏览器打开main.htm,发现和软件主界面一模一样,嘿嘿,终于找到了。但点击上面的按钮均无反应,看看WEB页面的代码如下:

代码

1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">2 <html>3 <head>4 <metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>5 <title>金山网盾首页</title>6 <linkrel="stylesheet"type="text/css"href="../public/css/common.css">7 <linkrel="stylesheet"type="text/css"href="style/index/index.css">8 <scripttype="text/javascript"src="../public/lib/jquery.js"></script>9 <scripttype="text/javascript"src="js/index/js_loader.js"></script>10 </head>11 <bodyondrag="return false;"kcore="OnKWebApp"onselectstart="return false;">12 <divid="DivMain">13 <divid="DivTitle">14 <divid="DivSystemBtn">15 <imgsrc="images/index/icob1_normal.gif"/>16 <imgsrc="images/index/icob2_normal.gif"/>17 <imgsrc="images/index/icob3_normal.gif"/>18 </div>19 <divid="DivMenuFeedBack">20 <ahref="javascript:void(0);"hidefocus="true"><imgsrc="images/index/fankui_normal.gif"/></a>21 </div>22 </div>23 <divid="DivMenu">24 <divid="DivSafeStatus"><imgid="ImgSafeSta"src="images/index/anquan.jpg"/></div>25 <divid="DivMenuMon"><imgclass="MenuBtn"id="ImgMenuMon"src="images/index/jiankong_on.jpg"/></div>26 <divid="DivMenuSet"><imgclass="MenuBtn"id="ImgMenuSet"src="images/index/shezhi_normal.jpg"/></div>27 <divid="DivMenuBkList"><imgclass="MenuBtn"id="ImgMenuBkList"src="images/index/mingdan_normal.jpg"/></div>28 <divid="DivMenuLog"><imgclass="MenuBtn"id="ImgMenuLog"src="images/index/chakan_normal.jpg"/></div>29 </div>30 <divid="DivContent">31 <divid="DivMon">32 <divid="DivTextSta">金山网盾正在保护您的上网安全</div>33 <divid="DivStaTab">34 <table>35 <tr>36 <tdwidth="290"height="55"id="sta_item_1"class="sta_item">启用浏览器保护37 <pstyle="color:#000;font-size:12px;">防止浏览网页时中毒或者上当受骗</p></td>38 <tdwidth="50"class="sta_text"id="bStartKWS">已启用</td>39 <tdwidth="72"><spanid="BtnOpenBrowserMon"class="BtnStart">关闭</span></td>40 </tr>41 <tr>42 <tdheight="65"id="sta_item_2"class="sta_item">启用搜索引擎保护43 <pstyle="color:#000;font-size:12px;">保护百度、Google、Bing、搜狗等搜索安全</p></td>44 <tdclass="sta_text"id="bStartKWS4Search">已启用</td>45 <td><spanid="BtnOpenSearchMon"class="BtnStart">关闭</span></td>46 </tr>47 <tr>48 <tdheight="50"id="sta_item_2"class="sta_item">主页保护49 <pstyle="color:#000;font-size:12px;"id="CurIeIndex">防止IE主页被恶意窜改</p></td>50 <tdclass="sta_text"id="bStartIEProt">已锁定</td>51 <td><spanid="BtnOpenProtIE"class="BtnStart">锁定</span></td>52 </tr>53 </table>54 </div>55 <divid="DivLanJie">56 <table>57 <tr>58 <td>保护天数:</td>59 <td><spanid="SpanProtDay">0</span></td>60 <td></td>61 </tr>62 <tr>63 <td>拦截木马病毒总数:</td>64 <tdwidth="50"align="center"><ahref="javascript:void(0);"title="查看日志"id="SpanHoldCount"hidefocus="true">0</a></td>65 <tdstyle="padding-top:3px;padding-left:10px;"><ahref="javascript:void(0);"hidefocus="true"title="清空所有拦截记录"id="BtnResetHoldCount">清零</a></td>66 </tr>67 </table>68 <tablestyle="margin-top:50px;">69 <tr>70 <tdcolspan="2">病毒库版本:<spanid="SpanLibVer">查询中...</span></td>71 </tr>72 <tr>73 <tdwidth="180">程序版本:<spanid="SpanVersionVal">查询中...</span></td>74 <tdalign="center"><spanid="BtnUpdate"><ahref="javascript:void(0);"hidefocus="true"id="notify_call_update">立即升级</a></span></td>75 </tr>76 </table>77 </div>78 <divid="Frame4Report">79 <!--<iframe src="http://labs.duba.net/kws/kwsad/kwsad.html" frameborder="no" border="0" width="200" height="168" allowtransparency="true"></iframe>-->80 <iframesrc=""id="BOBAO"frameborder="no"border="0"width="209"height="168"allowtransparency="true"></iframe>81 </div>82 </div>83 <divid="DivSet"style="display:none;">84 <divclass="DivSetMenu">85 <divid="BaseSetMenu"class="BaseSetMenu">86 <table>87 <tr>88 <tdwidth="5"><imgsrc="images/index/table_button_left.jpg"/></td>89 <tdwidth="72"class="menu_on">基本设置</td>90 <tdwidth="3"><imgsrc="images/index/table_button_right.jpg"/></td>91 </tr>92 </table>93 </div>94 <divid="BaseSetMenu_1"class="BaseSetMenu"style="display:none;">基本设置</div>95 <divid="CustomSetMenu"class="CustomSetMenu"style="display:none;">96 <table>97 <tr>98 <tdwidth="5"><imgsrc="images/index/table_button_left.jpg"/></td>99 <tdwidth="112"class="menu_on">自定义浏览器保护</td>100 <tdwidth="3"><imgsrc="images/index/table_button_right.jpg"/></td>101 </tr>102 </table>103 </div>104 <divid="CustomSetMenu_1"class="CustomSetMenu">自定义浏览器保护</div>105 <divid="ProtIEMenu"class="ProtIEMenu"style="display:none;">106 <table>107 <tr>108 <tdwidth="5"><imgsrc="images/index/table_button_left.jpg"/></td>109 <tdwidth="112"class="menu_on">IE首页锁定</td>110 <tdwidth="3"><imgsrc="images/index/table_button_right.jpg"/></td>111 </tr>112 </table>113 </div>114 <divid="ProtIEMenu_1"class="ProtIEMenu">IE首页锁定</div>115 </div>116 <divid="DivBaseSetContent">117 <divid="DivStepFirst">118 <table>119 <tr>120 <tdwidth="285">121 <inputtype='checkbox'id="ChkStartTray"/>122 <labelfor="ChkStartTray">启动托盘图标</label>123 </td>124 <td>125 <inputtype='checkbox'id="ChkStartTrayFlash"disabled="true"/>126 <labelfor="ChkStartTrayFlash">启动托盘闪动提示</label>127 </td>128 </tr>129 </table>130 </div>131 <divid="DivStepSecond">132 <table>133 <tr>134 <tdwidth="175">135 <inputtype='checkbox'id="ChkStartBox"/>136 <labelfor="ChkStartBox">开启闪框提醒</label>137 </td>138 <tdwidth="175">139 <inputtype='checkbox'id="ChkRedBox"disabled="true"/>140 <labelfor="ChkRedBox">仅危险时闪框</label>141 </td>142 </tr>143 </table>144 <tablestyle="margin-top:10px;">145 <tr>146 <tdwidth="85">闪烁时间:</td>147 <tdwidth="88">148 <inputtype='radio'id="RadTimeShort"name="BoxTimeType"value="1">149 <labelfor="RadTimeShort">较短</label>150 </td>151 <tdwidth="107">152 <inputtype='radio'id="RadTimeNormal"name="BoxTimeType"value="3">153 <labelfor="RadTimeNormal">正常</label>154 </td>155 <td>156 <inputtype='radio'id="RadTimeLong"name="BoxTimeType"value="5">157 <labelfor="RadTimeLong">较长</label>158 </td>159 </tr>160 </table>161 <tablestyle="margin-top:10px;">162 <tr>163 <tdwidth="85">颜色设置:</td>164 <td>安全提醒:</td>165 <tdwidth="65"><divid="SafeColor"class="ColorSelect"selfparam="0"></div></td>166 <td>钓鱼警告:</td>167 <tdwidth="65"><divid="FraudColor"class="ColorSelect"selfparam="1"></div></td>168 <td>挂马警告:</td>169 <tdwidth="65"><divid="TrojanColor"class="ColorSelect"selfparam="2"></div></td>170 </tr>171 </table>172 </div>173 <divid="DivStep4">174 <table>175 <tr>176 <tdwidth="185"height="85"valign="center"><inputtype="checkbox"id="StartProtMouse"/>177 <labelfor="StartProtMouse">开启鼠镖保护</label>178 <pstyle="color:#000;">(为鼠标所指链接给出安全提示)</p>179 </td>180 </tr>181 </table>182 </div>183 <divid="DivStepThree"style="display:none;">184 <tablestyle="margin-top:5px;">185 <tr>186 <tdwidth="175"><inputtype="checkbox"id="StartProtDownLoad"/>187 <labelfor="StartProtDownLoad">启动下载保护</label></td>188 </tr>189 </table>190 <tablestyle="margin-top:20px;margin-left:10px;">191 <tr>192 <tdwidth="120"><inputtype="checkbox"id="ProtBrowser"/>193 <labelfor="ProtBrowser">浏览器</label></td>194 <tdwidth="120"><inputtype="checkbox"id="ProtXunLei"/>195 <labelfor="ProtXunLei">迅雷</label></td>196 <tdwidth="120"><inputtype="checkbox"id="ProtXuanFeng"/>197 <labelfor="ProtXuanFeng">QQ旋风</label></td>198 <tdwidth="120"><inputtype="checkbox"id="ProtFlashGet"/>199 <labelfor="ProtFlashGet">FlashGet</label></td>200 </tr>201 </table>202 </div>203 <divid="DivTipReboot">设置需浏览器重启才生效</div>204 <divid="DivSetDef"class="BtnComBig">恢复默认设置</div>205 <divid="DivSetApply"class="BtnComMid">应   用</div>206 </div>207 <divid="DivCustomSetContent"style="display:none;">208 <divid="CustomSetTip">金山网盾支持所有浏览器,但不能避免一些程序腾空而出,您可以在列表中添加需要保护的程序</div>209 <!--模拟表格头部-->210 <divid="DivCustomTabHead">211 <tableclass="TabListHead">212 <trheight="24">213 <tdwidth="450"style="padding-left:30px;">程序名</td>214 <tdwidth="3"><imgsrc="images/index/rz_table_line.gif"/></td>215 <tdwidth="67"style="padding-left:30px;">删除</td>216 </tr>217 </table>218 </div>219 <!--带滚动条表格-->220 <divid="DivScroCustomTab">221 <tableid="TabCustomList"class="TabCom">222 </table>223 <tablestyle="display:none;">224 <trheight="20"id="TrForCreateProtEXE">225 <tdwidth="450"style="padding-left:10px;"></td>226 <tdwidth="70"><ahref="javascript:void(0);"class="DelProtExe">删除</a></td>227 </tr>228 </table>229 </div>230 <divid="DivLinkCustom"><ahref="javascript:void(0);"hidefocus="true"title="只保护exe类型的可执行文件"id="BtnAddCustom">添加</a></div>231 </div>232 <!--改成IE首页保护-->233 <divid="DivProtIESetContent"style="display:none;">234 <divid="DivClock"class="DivClock">235 <tablestyle="margin-top:10px;">236 <tr>237 <tdwidth="386">输入要锁定的网址:<inputtype="text"class="IeUrl"value=""id="IEIndexText"/></td>238 <td><divid="BtnLockIE"class="BtnComMid">锁  定</div></td>239 </tr>240 </table>241 <tablestyle="margin-top:10px;">242 <tr>243 <tdwidth="125"align="right"><spanid="URLBlank"class="LinkBtn">使用空白页</span></td>244 <tdwidth="125"align="right"><spanid="URLBaidu"class="LinkBtn"><spanid="svt_name_2"style="cursor:pointer;">baidu</span>设为首页</span></td>245 <tdwidth="125"align="right"><spanid="URLSVT"class="LinkBtn"><spanid="svt_name"style="cursor:pointer;">hao123</span>设为首页</span></td>246 </tr>247 </table>248 </div>249 <!--专版情况下是用-->250 <divid="DivSVTClock"class="DivClock"style="display:none;">251 <tablestyle="margin-top:10px;">252 <tr>253 <tdwidth="460">您当前使用的是<spanid="SVTNAME"></span>专版金山网盾,IE首页锁定能有效防止IE首页被恶意篡改</td>254 </tr>255 <tr>256 <tdwidth="460"height="35"><spanid="TipSVT">已经将您的IE浏览器首页保护为:</span><ahref=""target="_blank"hidefocus="true"id="SVTURL"></a></td>257 </tr>258 <tr>259 <tdalign="right"><ahref="javascript:void(0);"id="ChangeIndex"hidefocus="true">我要锁定其他首页</a></td>260 </tr>261 </table>262 </div>263 <divid="DivClockErr">264 <tablestyle="margin-top:10px;">265 <tr>266 <tdheight="25"style="color:#ff8040;font-weight:700;">如果锁定IE首页失败可以尝试以下解决方案:</td>267 </tr>268 <tr>269 <tdheight="25">1.添加“强制屏蔽列表”。(遇到顽固恶意首页,请将它添加到列表中,直接屏蔽。)</td>270 </tr>271 <tr>272 <td><table><tr><td>输入要屏蔽网址:<inputtype="text"id="InputPingBi"value=""/></td><tdstyle="padding-left:20px;"><divid="BtnAddShield"class="BtnComMid">添  加</div></td></tr></table></td>273 </tr>274 <tr>275 <tdstyle="padding-top:10px;padding-bottom:5px;">276 <divclass="DivTabIE">277 <tablewidth="100%"id="TabIeIndex"style="table-layout:fixed;"></table>278 <!--为克隆提供模板-->279 <tablestyle="display:none;">280 <trid="tr_ie_pb">281 <tdwidth="410"><nobr></nobr></td>282 <tdwidth="100%"><ahref="javascript:void(0);"class="DelTabIe"hidefocus="true">删除</a></td>283 </tr>284 </table>285 </div>286 </td>287 </tr>288 <tr>289 <tdheight="25"><ahref="javascript:void(0);"id="UseKSfa"hidefocus="true">2.使用金山急救箱修复IE首页</a></td>290 </tr>291 <tr>292 <tdheight="25"><ahref="javascript:void(0);"hidefocus="true"id="ToFeedBack">3.向网盾研发人员反馈,请注意留下您的联系方式</a></td>293 </tr>294 </table>295 </div>296 </div>297 </div>298 <divid="DivBkList"style="display:none;">299 <divclass="DivSetMenu">300 <divid="BkListMenu"class="CLSBkListMenu">301 <table>302 <tr>303 <tdwidth="5"><imgsrc="images/index/table_button_left.jpg"/></td>304 <tdwidth="72"class="menu_on">网站黑名单</td>305 <tdwidth="3"><imgsrc="images/index/table_button_right.jpg"/></td>306 </tr>307 </table>308 </div>309 <divid="BkListMenu_1"class="CLSBkListMenu"style="display:none;">网站黑名单</div>310 <divid="FilterMenu"class="CLSFilterMenu"style="display:none;">311 <table>312 <tr>313 <tdwidth="5"><imgsrc="images/index/table_button_left.jpg"/></td>314 <tdwidth="100"class="menu_on">网页内容净化</td>315 <tdwidth="3"><imgsrc="images/index/table_button_right.jpg"/></td>316 </tr>317 </table>318 </div>319 <divid="FilterMenu_1"class="CLSFilterMenu">网页内容净化</div>320 </div>321 <divid="DivAddBkList">322 <table>323 <tr>324 <tdcolspan="5"height="35"class="BkTit">将你认为存在威胁网址添加到黑名单,金山网盾将阻止对该网站的访问</td>325 </tr>326 <tr>327 <tdheight="35"><inputtype="text"mamaxlength="128"id="TextAddURL"value=""/></td>328 <tdwidth="88"><inputtype="radio"value="1"name="WebType"checked id="ChkTypeM"/><labelfor="ChkTypeM">带毒网站</label></td>329 <tdwidth="88"><inputtype="radio"value="3"name="WebType"id="ChkTypeD"/><labelfor="ChkTypeD">欺诈网站</label></td>330 <tdwidth="88"><inputtype="radio"value="4"name="WebType"id="ChkTypeV"/><labelfor="ChkTypeV">恶意广告</label></td>331 <td><divid="BtnAddBkList"class="BtnComBig">添加到黑名单</div></td>332 </tr>333 </table>334 </div>335 <!--模拟表格头部-->336 <divid="DivListTabHead">337 <tableclass="TabListHead">338 <trheight="24">339 <tdwidth="350"style="padding-left:30px;">网址</td>340 <tdwidth="3"><imgsrc="images/index/rz_table_line.gif"/></td>341 <tdwidth="100"style="padding-left:30px;">性质</td>342 <tdwidth="3"><imgsrc="images/index/rz_table_line.gif"/></td>343 <tdwidth="85"style="padding-left:30px;">删除</td>344 </tr>345 </table>346 </div>347 <!--带滚动条表格-->348 <divid="DivListTab">349 <tableid="TabBkList"class="TabCom">350 </table>351 <tablestyle="display:none;">352 <trheight="18"id="TrForCreateBkList">353 <tdwidth="353"style="padding-left:10px;"></td>354 <tdwidth="103"></td>355 <tdwidth="68"><ahref="javascript:void(0);"class="DelBkList">删除</a></td>356 </tr>357 </table>358 </div>359 <divid="DivListLink">360 <table>361 <tr>362 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="notify_import_black_url">导入</a></td>363 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="notify_export_black_url">导出</a></td>364 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="notify_clean_black_url">清空</a></td>365 <tdwidth="130"align="center">当前第<spanid="cur_page">1</span>/<spanid="total_page">1</span></td>366 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="first_page">首页</a></td>367 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="prev_page">上页</a></td>368 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="next_page">下页</a></td>369 <tdwidth="40"><ahref="javascript:void(0);"hidefocus="true"id="last_page">末页</a></td>370 <tdwidth="75"style="padding-top:0px;">转到<inputtype="text"id="go_page"value=""style="width:30px;"size="1"maxlength="6"/></td>371 <tdwidth="30"style="padding-top:0px;"><imgid="Btn_go"style="cursor:pointer;"src="images/index/go_normal.gif"alt="转到"/></td>372 </tr>373 </table>374 </div>375 <!--改成 网页净化-->376 <divid="DivFilterSetContent"style="display:none;">377 <divid="FilterSetTip">378 <table>379 <tr><tdheight="30"><inputtype="checkbox"id="StartFilter"/><labelfor="StartFilter"style="color:#326D00;font-weight:700;outline:none;">启用网页内容净化</label></td><td></td></tr>380 <tr><tdstyle="padding-left:30px;height:30px;"><inputtype="text"id="InputFilter"value=""maxlength="256"></td><tdstyle="padding-left:30px;"><divid="DivAddFilter"class="BtnComMid">添  加</div></tr>381 </table>382 </div>383 <!--模拟表格头部-->384 <divid="DivFilterTabHead">385 <tableclass="TabListHead">386 <trheight="24">387 <tdwidth="37"style="padding-left:10px;">启用</td>388 <tdwidth="3"><imgsrc="images/index/rz_table_line.gif"/></td>389 <tdwidth="410"style="padding-left:30px;">规则</td>390 <tdwidth="3"><imgsrc="images/index/rz_table_line.gif"/></td>391 <tdwidth="67"style="padding-left:30px;">删除</td>392 </tr>393 </table>394 </div>395 <!--带滚动条表格-->396 <divid="DivScroFilterTab">397 <tableid="TabFilterList"class="TabCom">398 </table>399 <tablestyle="display:none;">400 <trheight="20"id="TrForCreateFilter">401 <tdwidth="43"align="center">402 <inputtype="checkbox"class="StartItemFilter"checked="true"/>403 </td>404 <tdwidth="390"style="padding-left:10px;"><nobr></nobr></td>405 <tdwidth="70"align="center"><ahref="javascript:void(0);"class="DelFilter">删除</a></td>406 </tr>407 </table>408 </div>409 <divid="DivLinkCustom">410 <ahref="javascript:void(0);"hidefocus="true"id="notify_import_filter_rule">导入</a>411 &nbsp;&nbsp;&nbsp;&nbsp;412 <ahref="javascript:void(0);"hidefocus="true"id="notify_export_filter_rule">导出</a>413 </div>414 </div>415 </div>416 417 <divid="DivLog"style="display:none;">418 <divid="LogTabTit">419 <table>420 <tr>421 <tdwidth="127"style="padding-left:30px;">时间</td>422 <tdwidth="3"><imgsrc="images/index/rz_table_line.gif"/></td>423 <tdwidth="399"style="padding-left:30px;">日志内容</td>424 </tr>425 </table>426 </div>427 <divid="LogTabContent">428 <tableid="TabLog"style="table-layout:fixed;"></table>429 <tablestyle="width:519px;table-layout:fixed;display:none;">430 <trheight="20"id="TrForCreateLog">431 <tdwidth="145"></td>432 <tdwidth="100%"></td>433 </tr>434 </table>435 </div>436 <divid="LogBtn">437 <table>438 <tr>439 <tdwidth="70"><ahref="javascript:void(0);"hidefocus="true"id="RefreshLog">刷新日志</a></td>440 <tdwidth="70"><ahref="javascript:void(0);"hidefocus="true"id="CleanLog">清空日志</a></td>441 <td><ahref="javascript:void(0);"id="notify_view_log">查看全部日志</a></td>442 </tr>443 </table>444 </div>445 </div>446 </div>447 <divid="DivBottom">448 <table>449 <tr><tdwidth="470"align="right"><atarget="_blank"hidefocus="true"href="http://blog.duba.net/wd">拦截测试</a></td>450 <tdwidth="100"align="right"><atarget="_blank"hidefocus="true"href="http://labs.duba.net/dairy_wd.shtml">更新日志</a></td>451 <tdwidth="120"align="center"><atarget="_blank"hidefocus="true"href="http://bbs.duba.net/forum-6394-1.html">网盾论坛</a></td>452 </tr>453 </table>454 <!--Begin 事件触发C++-->455 <!--Begin 首页-->456 <inputtype="hidden"id="query_init_param"title="查询默认先显示哪个页面"/>457 <inputtype="hidden"id="notify_sysmenu_close"title="关闭界面"/>458 <inputtype="hidden"id="notify_sysmenu_minimize"title="最小化界面"/>459 <inputtype="hidden"id="query_version_time"title="查询版本信息"/>460 <!--input type="hidden" id="notify_call_update"         title="调用升级"/-->461 <inputtype="hidden"id="query_log_count"title="查询日志数量,拦截网页木马病毒总数"/>462 <inputtype="hidden"id="notify_clean_log"title="清空日志,清零"/>463 <inputtype="hidden"id="notify_setting_enable_kws"title="通知网盾开启与关闭,保护浏览器开启与关闭"/>464 <inputtype="hidden"id="query_setting_enable_kws"title="查询网盾是否开启"/>465 <inputtype="hidden"id="notify_setting_enable_sep"title="搜索引擎保护开启与关闭"/>466 <inputtype="hidden"id="query_setting_enable_sep"title="查询搜索引擎保护是否开启"/>467 <inputtype="hidden"id="query_prot_days"title="查询保护了多少天"/>468 <inputtype="hidden"id="notify_call_ksfa"title="调用急救箱"/>469 <inputtype="hidden"id="newsinfo"title="刷XXX"/>470 <inputtype="hidden"id="open_dlg"title="打开关于对话框"/>471 <!--End 首页-->472 <!--Begin 日志-->473 <!--<input type="hidden" id="notify_view_log"           title="用记事本打开(查看全部日志)">直接附在元素上-->474 <inputtype="hidden"id="query_log"title="查询日志详细信息"/>475 <!--End 日志-->476 <!--Begin 黑名单-->477 <inputtype="hidden"id="query_black_url"title="查询黑名单"/>478 <inputtype="hidden"id="notify_del_balck_url"title="删除黑名单"/>479 <inputtype="hidden"id="notify_add_black_url"title="添加黑名单"/>480 <inputtype="hidden"id="notify_export_black_url"title="导出黑名单"/>481 <inputtype="hidden"id="notify_import_black_url"title="导入黑名单"/>482 <!--End 黑名单-->483 <!--Begin 设置-->484 <inputtype="hidden"id="query_bat_setting_basic"title="查询基础设置"/>485 <inputtype="hidden"id="notify_bat_setting_basic"title="更改基础设置"/>486 <inputtype="hidden"id="query_setting_color_dlg"title="打开颜色选择对话框"/>487 <inputtype="hidden"id="notify_def_basic_setting"title="基础设置恢复默认设置"/>488 <inputtype="hidden"id="query_fileopen_dialog"title="打开文件选择器"/>489 <inputtype="hidden"id="notify_setting_add_exe"title="添加保护EXE"/>490 <inputtype="hidden"id="notify_setting_del_exe"title="删除保护EXE"/>491 <inputtype="hidden"id="query_protected_exe"title="查询保护EXE"/>492 <!--End 设置-->493 <!--Begin 意见反馈-->494 <inputtype="hidden"id="notify_set_feedback_time"title="设置意见反馈时间"/>495 <!--End 意见反馈-->496 <!--Begin IE 首页保护-->497 <inputtype="hidden"id="query_startpage"title="查询保护的首页url"/>498 <inputtype="hidden"id="notify_set_startpage"title="锁定IE首页"/>499 <inputtype="hidden"id="notify_add_ssp"title="增加屏蔽首页"/>500 <inputtype="hidden"id="notify_del_ssp"title="删除屏蔽首页"/>501 <inputtype="hidden"id="query_ssp"title="查询屏蔽首页列表"/>502 <inputtype="hidden"id="query_locksp"title="查询是否开启IE首页保护"/>503 <inputtype="hidden"id="notify_set_locksp"title="通知是否开启IE首页保护"/>504 <inputtype="hidden"id="change_svt"title="专版转换普通"/>505 <!--End IE 首页保护-->506 <!--Begin 网页净化-->507 <inputtype="hidden"id="query_set_filter"title="查询是否开启净化"/>508 <inputtype="hidden"id="notify_set_filter"title="设置是否开启净化"/>509 <inputtype="hidden"id="notify_add_filter_rule"title="增加规则"/>510 <inputtype="hidden"id="notify_del_filter_rule"title="删除规则"/>511 <inputtype="hidden"id="query_filter_rule"title="查询规则列表"/>512 <inputtype="hidden"id="notify_export_filter_rule"title="导出"/>513 <inputtype="hidden"id="notify_import_filter_rule"title="导入"/>514 <!--End 网页净化-->515 516 <!--End 事件触发C++-->517 </div>518 </div>519 </body>520 </html>

我们首先关注一下

代码

1 <divid="DivTitle">2 <divid="DivSystemBtn">3 <imgsrc="images/index/icob1_normal.gif"/>4 <imgsrc="images/index/icob2_normal.gif"/>5 <imgsrc="images/index/icob3_normal.gif"/>6 </div>7 <divid="DivMenuFeedBack">8 <ahref="javascript:void(0);"hidefocus="true"><imgsrc="images/index/fankui_normal.gif"/></a>9 </div>10 </div>

这里的DivTitle和DivSystemBtn的CSS定义如下:

#DivTitle
{
    position:relative;
    width:100%;
    height:68px;
}

#DivSystemBtn
{
    left:637px;
    height:30px;
    top:8px;
    width:53px;
    position:absolute;
}

DivTitle自然不必说了,望文生意即可明白它是相当于WINFORM软件标题部分的一个DIV。

DivSystemBtn即是放“关于”、“最小化”、“关闭”按钮的一个DIV容器。

以“最小化”为例阐述一下WEB与WINFORM的交互过程:

<!--Begin 事件触发C++-->
                    <!--Begin 首页-->
                        <input type="hidden" id="query_init_param"             title="查询默认先显示哪个页面"/>
                        <input type="hidden" id="notify_sysmenu_close"           title="关闭界面"/>
                        <input type="hidden" id="notify_sysmenu_minimize"     title="最小化界面"/>
                        <input type="hidden" id="query_version_time"        title="查询版本信息"/>
                        <!--input type="hidden" id="notify_call_update"         title="调用升级"/-->                    
                        <input type="hidden" id="query_log_count"              title="查询日志数量,拦截网页木马病毒总数"/>
                        <input type="hidden" id="notify_clean_log"             title="清空日志,清零"/>
                        <input type="hidden" id="notify_setting_enable_kws" title="通知网盾开启与关闭,保护浏览器开启与关闭"/>
                        <input type="hidden" id="query_setting_enable_kws"  title="查询网盾是否开启"/>
                        <input type="hidden" id="notify_setting_enable_sep" title="搜索引擎保护开启与关闭"/>
                        <input type="hidden" id="query_setting_enable_sep"  title="查询搜索引擎保护是否开启"/>
                        <input type="hidden" id="query_prot_days"             title="查询保护了多少天"/>
                        <input type="hidden" id="notify_call_ksfa"            title="调用急救箱"/>
                        <input type="hidden" id="newsinfo"                     title="刷XXX"/>
                        <input type="hidden" id="open_dlg"                     title="打开关于对话框"/>
                    <!--End 首页-->
                    <!--Begin 日志-->
                        <!--<input type="hidden" id="notify_view_log"           title="用记事本打开(查看全部日志)">直接附在元素上-->
                        <input type="hidden" id="query_log"                 title="查询日志详细信息"/>
                    <!--End 日志-->
                    <!--Begin 黑名单-->
                        <input type="hidden" id="query_black_url"             title="查询黑名单"/>
                        <input type="hidden" id="notify_del_balck_url"      title="删除黑名单"/>
                        <input type="hidden" id="notify_add_black_url"      title="添加黑名单"/>
                        <input type="hidden" id="notify_export_black_url"      title="导出黑名单"/>
                        <input type="hidden" id="notify_import_black_url"      title="导入黑名单"/>
                    <!--End 黑名单-->
                    <!--Begin 设置-->
                        <input type="hidden" id="query_bat_setting_basic"     title="查询基础设置"/>
                        <input type="hidden" id="notify_bat_setting_basic"     title="更改基础设置"/>
                        <input type="hidden" id="query_setting_color_dlg"    title="打开颜色选择对话框"/>
                        <input type="hidden" id="notify_def_basic_setting"    title="基础设置恢复默认设置"/>
                        <input type="hidden" id="query_fileopen_dialog"        title="打开文件选择器"/>
                        <input type="hidden" id="notify_setting_add_exe"    title="添加保护EXE"/>
                        <input type="hidden" id="notify_setting_del_exe"    title="删除保护EXE"/>
                        <input type="hidden" id="query_protected_exe"        title="查询保护EXE"/>
                    <!--End 设置-->
                    <!--Begin 意见反馈-->
                        <input type="hidden" id="notify_set_feedback_time"  title="设置意见反馈时间"/>
                    <!--End 意见反馈-->
                    <!--Begin IE 首页保护-->
                        <input type="hidden" id="query_startpage"             title="查询保护的首页url"/>
                        <input type="hidden" id="notify_set_startpage"         title="锁定IE首页"/>
                        <input type="hidden" id="notify_add_ssp"             title="增加屏蔽首页"/>
                        <input type="hidden" id="notify_del_ssp"             title="删除屏蔽首页"/>
                        <input type="hidden" id="query_ssp"                 title="查询屏蔽首页列表"/>
                        <input type="hidden" id="query_locksp"                 title="查询是否开启IE首页保护"/>
                        <input type="hidden" id="notify_set_locksp"            title="通知是否开启IE首页保护"/>
                        <input type="hidden" id="change_svt"                title="专版转换普通"/>
                    <!--End IE 首页保护-->
                    <!--Begin 网页净化-->
                        <input type="hidden" id="query_set_filter"             title="查询是否开启净化"/>
                        <input type="hidden" id="notify_set_filter"         title="设置是否开启净化"/>
                        <input type="hidden" id="notify_add_filter_rule"     title="增加规则"/>
                        <input type="hidden" id="notify_del_filter_rule"     title="删除规则"/>
                        <input type="hidden" id="query_filter_rule"         title="查询规则列表"/>
                        <input type="hidden" id="notify_export_filter_rule" title="导出"/>
                        <input type="hidden" id="notify_import_filter_rule" title="导入"/>
                    <!--End 网页净化-->
                    
                <!--End 事件触发C++-->

关注其中的 <input type="hidden" id="notify_sysmenu_minimize"     title="最小化界面"/>这一句,在kwebapp.js种可以找 到
// 最小化        $.ImgMouseStyle($("#DivSystemBtn img").eq(1),3).click(function()        {            $("#notify_sysmenu_minimize").click();        });

哈哈,明白了,当点击 #DivSystemBtn里的第2个图片时,触发隐藏按钮notify_sysmenu_minimize的click事件,而notify_sysmenu_minimize的click事件在C#或者C++的程序里是可以截获的。这样就达到了web与winform 的交互目的,下面我来演示一下用C#如何实现一个窗体装载整个WEB页面并带有程序“最小化”功能。

1、创建一个"Windows窗体应用程序"项目,我把项目命名为KSWebShieldSVC,然后修改默认的From1.cs名称为FrmMain.cs,把“金山网盾”的webui文件夹拷贝到项目的bin/Debug目录下
2、修改窗体属性设置边框为无,并设置窗体大小为690*514(这个尺寸当然要根据您的web页的大小适当设置了)
3、往窗体中拖一个webBrowser1进来
4、 FrmMain_Load事件书写如下:
private void FrmMain_Load(object sender, EventArgs e)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory + @"webui\kwebshield\main.htm";

this.webBrowser1.Navigate(path);
        }
5、给webBrowser1添加DocumentCompleted事件:
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlDocument htmlDoc = webBrowser1.Document;
            HtmlElement btnElement = htmlDoc.All["notify_sysmenu_minimize"];
            if (btnElement != null)
            {
                btnElement.Click += new HtmlElementEventHandler(HtmlBtnClose_Click);
            }
        }

6、书写最小化按钮的单击事件:
   private void HtmlBtnClose_Click(object sender, EventArgs e)  
        {
            if(base.WindowState != FormWindowState.Minimized)
            base.WindowState = FormWindowState.Minimized;
           
        }
OK,此时运行程序,界面显示后,点击web上的最小化按钮,程序就最小化了,呵呵,真爽

下次将讲解一下如何拖动窗体,并放出DEMO,敬请期待!!!
我纳闷,为什么我写的文章无法发布到博客园首页而只能发布到候选区呢?

转载于:https://www.cnblogs.com/airfey/archive/2010/02/25/1673157.html

一种开发软件的新思路,给Web页面穿个马甲,用web页面做软件UI,用C#(或者C++等其它语言)代码做功能...相关推荐

  1. 【基基基础】什么?你连软件都还没下载?!手把手教你下载VS/Dev-C++,写出属于自己的第一个C语言代码

    目录 Visual Studio 还是 Dev-C++ ? 下载Visual Studio以及创建一个新文件 下载Dev-C++以及创建一个新文件 终于,第一段代码来了o(╥﹏╥)o 神圣的时刻,运行 ...

  2. 每个程序员必看:如何在40岁后继续做软件开发?

    导读: 这是一个 42 岁的开发者所写经验分享文章.并且列出一些他 18 年多身为软件开发者的经验谈.许多部分看完后都会希望自己当时就能够了解,所以很推荐不论是新手或是老手都要好好阅读这一篇文章. 故 ...

  3. 老骥伏枥,志在千里:如何在40岁后继续做软件开发?

    导读: 这是一个 42 岁的开发者所写经验分享文章.并且列出一些他 18 年多身为软件开发者的经验谈.许多部分看完后都会希望自己当时就能够了解,所以很推荐不论是新手或是老手都要好好阅读这一篇文章. 故 ...

  4. 原生 APP、Web、混合 APP,三种开发模式有何不同?

    前言 原生 App 又称Native App,该开发针对 IOS.Android.Windows 等不同的手机操作系统要采用不同的语言和框架进行开发:无论是从开发难度,价格还是周期来看,原生开发都更复 ...

  5. Web服务常用的几种开发方法

    Web服务常用的几种开发方法 1.概述 Web服务,即通过程序实现网页服务,服务启动后,一般用户可通过访问URL获取到网站提供的网页服务,如网页浏览.留言.商品购买等.开发Web服务的技术有很多,有J ...

  6. Java开发web的几种开发模式

    Java开发web的几种开发模式 Java Web开发方案有多种可供选择,这里列举一些经典的开发模式进行横向比较,为Java Web的开发模式选择提供参考.除此之外还有好多方案(如Tapestry和W ...

  7. JAVA 23种开发模式详解(代码举例)

    设计模式(Design Patterns) --可复用面向对象软件的基础 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.使用设计模式是为了 ...

  8. 用 Go 语言,做 Web 编程开发

    人民邮电出版社和实验楼合作的第 15 本书来了! Web 介绍 Web 应用在我们的生活中无处不在.看看我们日常使用的各个应用程序,它们要么是 Web 应用,要么是移动 App 这类 Web 应用的变 ...

  9. 设置vmware vsphere web client_Arduino+前端高级应用-通过WEB网页控制Arduino开发板上的LED灯...

    在本教程中,让我们继续学习如何控制GPIO 引脚,不过这次进入高级阶段,我们将从一个可以访问的WEB网页中开关led灯.超详细代码解读,前端工程师也可以轻松玩起嵌入式.听起来是不很酷,Let's go ...

最新文章

  1. oracle cols user_tab_columns,user_tab_cols和user_tab_columns的区别
  2. iis mysql php 附件上传大小_修改上传附件2M大小限制的方法/php+iis上传附件默认大小修改方法...
  3. 欧几里得gcd/extend_gcd
  4. java对象序列化为字符串
  5. 跨域问题,解决方案-Nginx反向代理
  6. org.tigris.subversion.javahl.ClientException: Attempted to lock an already-locked dir异常解决方法...
  7. stm8用什么软件编程?stm8开发环境搭建手把手教程!
  8. python课本图片_python爬虫当当网python书籍图片
  9. 大话西游2服务器修改,大话西游2:9.17维护解读:五倍次数修改全服上线,灵兽村要变样啦...
  10. python爬虫-京东全网搜索
  11. 阿波罗服务器的投资项目,阿波罗未来产业城调整规划范围 将重点打造“两轴一片”空间格局...
  12. SPSS处理单元素,多元素logistic,详细流程和操作截图
  13. 基于零日漏洞的自动驾驶预期功能安全风险评估方法
  14. 利用mysql物理文件(*.ibd,*.frm)回复数据
  15. 艾瑞泽5无损换挡机构
  16. 数据库中的数据完整性约束
  17. 绿宝石rom下载_口袋妖怪绿宝石下载
  18. python高级数据分析_Python数据分析-pandas高级操作
  19. 电脑检测软件列表及电脑硬件驱动大全
  20. 2. 嵌入式Linux系统移植 - 交叉编译工具集

热门文章

  1. 如何修改 pytdx 中对应的通达信 IP 地址
  2. python写循环_Python 循环
  3. Ajax的简历技能如何写,web前端岗位个人技能怎么写
  4. 避免最常见的 10 大 JNI 编程错误的技巧和工具
  5. 为什么游戏引擎大多选择使用 C++ 而不是nbsp;C 开发?
  6. MM_ISOTROPIC与MM_ANISOTROPIC映射模式
  7. python控制蓝牙音响_[ESP32+MicroPython]智能音响控制
  8. 电信运营商网络流量采集模型研究及应用
  9. DAC-2020(前50条文献)
  10. [LOJ6179]Pyh的求和