📄 vb0103.htm
字号:
<HTML>
<head><title>洪恩在线 - CommomDialog使用的例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="Pragma" CONTENT="no_cache">
<link rel="stylesheet" href="/pub/css/home.css">
<link rel="stylesheet" href="/pc/program/program.css">
<meta name="keywords" content="程序设计,趣味编程,源码,源程序,源码讲解,commomdialog,commomdialog使用全解,通用对话框,VB,教程,电脑,教育,电脑乐园,交互">
<script language="javascript">
<!--
function change(myform)
{
var url="www.hongen.com/pc/program/index.htm";
url=myform.select.options[myform.select.options.selectedIndex].value;
top.location.href=url;
}
//-->
</script></head>
<body bgcolor="white" text="black" topmargin="10" leftmargin="0" marginwidth="0" marginheight="10">
<!--顶部开始--><script language=javascript src=/pub/js/head.js></script><!--顶部结束-->
<table width="760" height="20" border=0 cellspacing="0" cellpadding="0" align="center">
<tr valign="middle" align="left">
<td height=20 class="p1" width="297" bgcolor="#D3E7FF" align=center><div align="left"> <a href="/pc/program/index.htm" class=under>程序设计栏目首页</a></div></td>
<td align=left class="p1" height="20" width="58" valign="top"><img src="/pc/program/img/leftnew-0.gif" width="52" height="20"></td>
<td align="right" class="p1" height="20" width="405"><font color="#330099">当前位置:<a href="/default.htm" class="under">洪恩在线</a>
-> <a href="/pc/index.htm" class="under">电脑乐园</a> -> CommomDialog使用的例子</font><img name="image2" src="/pc/img/blank.gif" width="8" height="8">
</td>
</tr>
</table>
<table width=760 border=0 align="center" cellspacing="0" cellpadding="0">
<tr>
<td height=15><img src="/pc/img/blank.gif" width="1" height="1" border=0></td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" height="909">
<tr>
<th width="150" bgcolor="6082CF" align="center" height="1076" valign="top"> <!-- 左边条开始 -->
<script language="Javascript" src="/pc/program/js/proleft.js"></script>
<!-- 左边条结束 --><p align="center" class=p1> <a href=/pc/bin/msg.pl?file_id=k_tutor_vb target="_blank"><img src="/pc/img/message.gif" width="64" height="54" alt="请您留言" border="0"><br> 谈谈您的看法</a>
<br>
<script language="javascript">
speak_num="za"
</script>
<script language="javascript" src=/pc/var/pc_k_tutor_vb.js>
</script>
<script language="javascript">
var num=0
if (!isNaN(speak_num)){
num=speak_num;
}
else{
num=0
}
document.writeln ("已有")
document.writeln (num)
document.writeln ("条发言")
</script>
</p>
<br>
</th>
<td bgcolor="#000000" width="1" height="1076"><img src="img/blank.gif" width="1" height="1"></td>
<td valign="top" align="center" height="1076"> <br>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td width="13" valign="middle"><img src="/pc/program/img/dot.gif" width="13" height="13"></td>
<td class="p2" width="150" align="center" valign="middle"><font color="B85959"><b>编
程 入 门</b></font></td>
<td width="179"><img src="/pc/program/img/logo2.gif" width="179" height="52"></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0" class="p2">
<tr>
<td height="15" valign="bottom" colspan="3" class="p2">--看实例学VB6.0--<b>CommomDialog使用的例子--</b></td>
<td height="15" valign="bottom" class="p2" width="23%">
<div align="right" class="p1"><a href="/pc/program/tutors/vb/vb0104.htm">下一节</a></div>
</td>
</tr>
<tr>
<td bgcolor="FF9700" height="1" width="4%"><img src="img/blank.gif" width="1" height="2"></td>
<td bgcolor="FF9700" height="1" width="4%"><img src="img/blank.gif" width="1" height="2"></td>
<td bgcolor="FF9700" height="1" width="69%"><img src="img/blank.gif" width="1" height="2"></td>
<td bgcolor="FF9700" height="1" width="23%"><img src="img/blank.gif" width="1" height="2"></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0" class="p2" background="../../../img/line.gif">
<tr align="center">
<td class="p2" height="120" colspan="4">
<p align="left"><span class="p2" style="line-height:17pt"> CommonDialog控件是常用的一个控件,它为我们提供了打开、另存为、字体、颜色、打印、帮助等几种类型的标准对话框,本例演示了所有这些类型的对话框的使用方法。</span></p>
<p align="left"><span class="p2" style="line-height:17pt"> 为了学习方便,提供的源码已经作了详细的中文注释,看看源码框中的代码:</span></p>
<div align="center">
<p>
<textarea name="textfield" cols="80" rows="7" onMouseOver="this.focus()" onFocus="this.select()" readonly>'-------------------------------------------
' 通用对话框使用方法全解
'-------------------------------------------
' 洪恩在线 求知无限
'-------------------------------------------
'------名称-----------------作用-------------
' CdlTest 通用对话框
' CmdOpen “打开”对话框按钮
' CmdSave “另存为”对话框按钮
' CmdFont “字体”对话框按钮
' CmdColor “颜色”对话框按钮
' CmdPrint “打印”对话框按钮
' CmdHelp “帮助”对话框按钮
'-------------------------------------------
'当“颜色”对话框按钮被按下时
Private Sub CmdColor_Click()
On Error Resume Next
CdlTest.CancelError = True
CdlTest.Flags = cdlCCRGBInit
CdlTest.ShowColor
If Err = cdlCancel Then Exit Sub
TextBoxColor.ForeColor = CdlTest.Color
End Sub
'当“字体”对话框按钮被按下时
Private Sub CmdFont_Click()
On Error Resume Next
'当用户按下“取消”按钮,返回一个错误信息,这样使我们可以对其进行控制
CdlTest.CancelError = True
'此句必须要
CdlTest.Flags = cdlCFBoth + cdlCFEffects
'显示“字体”对话框
CdlTest.ShowFont
'出现“取消”错误时,跳出
If Err = cdlCancel Then
Exit Sub
Else
'将TextBox的字体属性根据“字体”对话框的变化作相应设置
'如果用户选择了字体才将字体改变,避免字体为空的错误
If CdlTest.FontName <> "" Then
TextBoxFont.FontName = CdlTest.FontName
End If
TextBoxFont.FontSize = CdlTest.FontSize
TextBoxFont.FontBold = CdlTest.FontBold
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -