vb6中,border style 的1-fixed single 和 3-fixed dialog有什么区别?

eidixk 2013-02-17 03:06:46
vb6中,border style 的1-fixed single 和 3-fixed dialog有什么区别?

谢谢大家。
...全文
790 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
threenewbee 2013-02-17
  • 打赏
  • 举报
回复
VB是20年前诞生的过时玩意,如果你想搞清楚很多事情的来龙去脉,去找一台386运行下Windows 3.1。 用了Windows 3.1,你才知道VB这些古怪的东西是什么渊源——所谓Single,就是不能改变大小的窗口,在那时候的系统,这样的窗口边线只有一条,而可以改变大小的,边线绘制成双线。还有什么3d,在Windows 3.X上,窗体分为白色的平面样式和灰色的立体样式。 如果你不曾用过Windows 3.X,那么搞清楚这些就很难了。
threenewbee 2013-02-17
  • 打赏
  • 举报
回复
一个只有关闭按钮,一个3个按钮齐全。 自己试下就知道了。
‘文本朗读.vbpType=ExeReference=*G{00020430-0000-0000-C000-000000000046}#2.0#0#C:WINDOWSSystem32stdole2.tlb#OLE AutomationReference=*G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:Program FilesCommon FilesMicrosoft SharedSpeechsapi.dll#Microsoft Speech Object LibraryReference=*G{00020905-0000-0000-C000-000000000046}#8.3#0#C:Program FilesMicrosoft OfficeOFFICE11MSWORD.OLB#Microsoft Word 11.0 Object LibraryObject={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; richtx32.ocxObject={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCXForm=文本朗读.frmForm=frmAbout.frmModule=mDeclares; MoudlesmDeclares.basModule=MSubclass; Moudlessubclass.basModule=MTimer; Moudles imer.basClass=cMemDC; ClassMoudlescMemDC.clsClass=cMenuBar; ClassMoudlescMenuBar.clsClass=cNCCalcSize; ClassMoudlescNCCalcSize.clsClass=cNeoCaption; ClassMoudlescNeoCaption.clsClass=cToolbarMenu; ClassMoudlescToolbarMenu.clsClass=INCAreaModifier; ClassMoudlesINCAreaModifier.clsClass=ISubclass; ClassMoudlesisubclass.clsClass=GSubclass; ClassMoudlessubclass.clsClass=CTimer; ClassMoudles imer.clsModule=Module1; Module1.basObject={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCXIconForm="Form1"Startup="Form1"HelpFile=""Title="文本朗读"ExeName32="文本朗读.exe"Command32=""Name="工程1"HelpContextID="0"CompatibleMode="0"MajorVer=1MinorVer=1RevisionVer=22AutoIncrementVer=1ServerSupportFiles=0VersionCompanyName="安阳市监狱"CompilationType=0OptimizationType=0FavorPentiumPro(tm)=0CodeViewDebugInfo=0NoAliasing=0BoundsCheck=0OverflowCheck=0FlPointCheck=0FDIVCheck=0UnroundedFP=0StartMode=0Unattended=0Retained=0ThreadPerObject=0MaxNumberOfThreads=1DebugStartupOption=0[MS Transaction Server]AutoRefresh=1‘文本朗读.frmVERSION 5.00Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"Begin VB.Form Form1 AutoRedraw = -1 ‘True Caption = "文本播放器 1.1版" ClientHeight = 6255 ClientLeft = 165 ClientTop = 555 ClientWidth = 9855 Icon = "文本朗读.frx":0000 LinkTopic = "Form1" ScaleHeight = 6255 ScaleWidth = 9855 StartUpPosition = 2 ‘屏幕心 Begin VB.HScrollBar HScroll2 Height = 255 Left = 1080 Max = 100 TabIndex = 14 Top = 5880 Value = 50 Width = 1815 End Begin VB.PictureBox PicCaption Height = 495 Left = 240 Picture = "文本朗读.frx":08CA ScaleHeight = 435 ScaleWidth = 8715 TabIndex = 11 Top = 3960 Visible = 0 ‘False Width = 8775 Begin VB.PictureBox PicBorder Height = 135 Left = 960 Picture = "文本朗读.frx":1710C ScaleHeight = 75 ScaleWidth = 915 TabIndex = 12 Top = 240 Visible = 0 ‘False Width = 975 End End Begin VB.CommandButton Command6 Caption = "继续朗读" Height = 390 Left = 150 TabIndex = 10 Top = 3480 Width = 2760 End Begin VB.CommandButton Command5 Caption = "暂停朗读" Height = 390 Left = 150 TabIndex = 9 Top = 3000 Width = 2760 End Begin VB.HScrollBar HScroll1 Height = 255 Left = 1080 Max = 100 TabIndex = 8 Top = 5400 Value = 100 Width = 1815 End Begin MSComDlg.CommonDialog CDg1 Left = 6840 Top = 4560 _ExtentX = 847 _ExtentY = 847 _Version = 393216 Filter = "文本文件(*.txt)|*.txt|所有文件|*.*" FilterIndex = 2 End Begin VB.OptionButton Option2 Caption = "朗读选定" Height = 315 Left = 1800 TabIndex = 6 Top = 4920 Width = 1230 End Begin VB.OptionButton Option1 Caption = "朗读全文" Height = 315 Left = 120 TabIndex = 5 Top = 4920 Width = 1230 End Begin VB.CommandButton Command4 Caption = "退出程序" Height = 390 Left = 150 TabIndex = 4 Top = 4440 Width = 2760 End Begin VB.CommandButton Command3 Caption = "结束朗读" Height = 390 Left = 150 TabIndex = 3 Top = 3960 Width = 2760 End Begin VB.CommandButton Command2 Caption = "开始朗读" Height = 390 Left = 150 TabIndex = 2 Top = 2520 Width = 2760 End Begin VB.CommandButton Command1 Caption = "打开文件" Height = 390 Left = 150 TabIndex = 1 Top = 2040 Width = 2760 End Begin RichTextLib.RichTextBox RTf1 Height = 6105 Left = 3120 TabIndex = 0 Top = 30 Width = 6615 _ExtentX = 11668 _ExtentY = 10769 _Version = 393217 BackColor = 15138775 HideSelection = 0 ‘False ScrollBars = 2 AutoVerbMenu = -1 ‘True TextRTF = $"文本朗读.frx":17996 End Begin VB.Label Label1 AutoSize = -1 ‘True Caption = "语速调节:" Height = 180 Index = 1 Left = 120 TabIndex = 13 Top = 5880 Width = 900 End Begin VB.Label Label1 AutoSize = -1 ‘True Caption = "音量调节:" Height = 180 Index = 0 Left = 120 TabIndex = 7 Top = 5400 Width = 900 End Begin VB.Image Image1 Height = 1935 Left = -15 Picture = "文本朗读.frx":17A33 Stretch = -1 ‘True Top = 30 Width = 3075 End Begin VB.Menu FILEMNU Caption = "文件(&F)" Begin VB.Menu OPENMNU Caption = "打开(&O)" End Begin VB.Menu LDMNU Caption = "朗读(&L)" End Begin VB.Menu FG Caption = "-" End Begin VB.Menu EXTMNU Caption = "退出(&X)" End End Begin VB.Menu HILMNU Caption = "帮助(&H)" Begin VB.Menu aboutmnu Caption = "关于…" End EndEndAttribute VB_Name = "Form1"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalseDim ld As New SpeechLib.SpVoiceDim qorx As BooleanDim wb As StringPrivate m_cN As cNeoCaption‘这是我又一次对文本播放器进行修订,‘增加了打开word、rtf文本、音量调节功能‘但是如何保存文声音文件还没做到,对TTS的安装等还没搞清楚,‘今后还需进一步努力加以改进。yxf 2004年5月30日‘------------------------------------------------------------------‘增加语速控制功能 2004年6月28日Private Sub aboutmnu_Click()frmAbout.Show 1End SubPrivate Sub Command1_Click()On Error Resume NextRTf1.Text = ""Dim str As StringDim lstr$CDg1.ShowOpenIf CDg1.FileName <> "" ThenIf LCase(right(CDg1.FileName, 3)) = "rtf" ThenRTf1.LoadFile CDg1.FileName, 0ElseIf LCase(right(CDg1.FileName, 3)) = "doc" ThenForm1.Caption = "文本播放器1.1版--正在打开文件……"Dim myword As New Word.Applicationmyword.Documents.Open FileName:=CDg1.FileName myword.Selection.WholeStoryRTf1.Text = myword.Selectionmyword.Quit Set myword = NothingElseIf LCase(right(CDg1.FileName, 3)) = "txt" ThenForm1.Caption = "文本播放器1.1版--正在打开文件……"RTf1.LoadFile CDg1.FileName, rtfText‘opentxt CDg1.FileName, str, lstr‘RTf1 = lstrElse If MsgBox("文件无法识别,按文本格式打开?", vbYesNo, "提示") = 6 ThenForm1.Caption = "文本播放器1.1版--正在打开文件……"opentxt CDg1.FileName, str, lstrRTf1 = lstr Else Exit Sub End IfEnd IfEnd IfMe.Caption = "文本播放器1.1版--" + CDg1.FileNameEnd SubPrivate Sub Command2_Click()On Error Resume NextIf qorx Thenwb = RTf1.TextElsewb = RTf1.SelTextEnd IfSet ld = New SpeechLib.SpVoiceld.Volume = HScroll1ld.Rate = HScroll2 / 10ld.Speak wb, 1End SubPrivate Sub Command3_Click()ld.Speak "", 2Set ld = NothingEnd SubPrivate Sub Command4_Click()ld.Speak "", 2Set ld = NothingEndEnd SubPrivate Sub Command5_Click()On Error Resume Nextld.PauseEnd SubPrivate Sub Command6_Click()On Error Resume Nextld.ResumeEnd SubPrivate Sub EXTMNU_Click()Command4_ClickEnd SubPrivate Sub Form_Resize()If Form1.Width > 3300 And Me.Height > 5000 ThenForm1.RTf1.Width = Me.Width - 3300RTf1.Height = Me.Height - 1000ElseRTf1.Width = 5895End IfEnd SubPrivate Sub Skin(f As Form, cN As cNeoCaption) cN.ActiveCaptionColor = &HFFFFFF cN.InActiveCaptionColor = &HC0C0C0 cN.ActiveMenuColor = &H0& cN.ActiveMenuColorOver = &H0 cN.InActiveMenuColor = &H0& cN.MenuBackgroundColor = RGB(207, 203, 207) cN.CaptionFont.Name = "宋体" cN.CaptionFont.Size = 9 cN.MenuFont.Name = "宋体" cN.MenuFont.Size = 9 cN.Attach f, f.PicCaption.Picture, f.PicBorder.Picture, 19, 20, 90, 140, 240, 400 f.BackColor = RGB(207, 203, 207)End SubPrivate Sub Form_Load()‘Dim X0 As Long‘Dim Y0 As Long‘让窗体居‘X0 = Screen.Width‘Y0 = Screen.Height‘X0 = (X0 - Me.Width) / 2‘Y0 = (Y0 - Me.Height) / 2‘Me.Move X0, Y0‘ Set m_cN = New cNeoCaption ‘ Skin Me, m_cNqorx = TrueRTf1.Text = " 文本播放器1.1版" + vbCrLf + " 河南省安阳市育才路" + vbCrLf + " 2004年5月8日"Option1.Value = TrueEnd SubPrivate Sub Form_Unload(Cancel As Integer)Command4.Value = TrueEnd SubPrivate Sub HScroll1_Change()On Error Resume Nextld.Volume = HScroll1End SubPrivate Sub HScroll2_Change()On Error Resume Nextld.Rate = HScroll2 / 10End SubPrivate Sub LDMNU_Click()Command2_ClickEnd SubPrivate Sub OPENMNU_Click()Command1_ClickEnd SubPrivate Sub Option2_Click()qorx = FalseEnd SubPrivate Sub Option1_Click()qorx = TrueEnd SubVERSION 5.00Begin VB.Form frmAbout BorderStyle = 3 ‘Fixed Dialog Caption = "关于 文本朗读器" ClientHeight = 3555 ClientLeft = 2340 ClientTop = 1935 ClientWidth = 5730 ClipControls = 0 ‘False Icon = "frmAbout.frx":0000 LinkTopic = "Form2" MaxButton = 0 ‘False MinButton = 0 ‘False ScaleHeight = 2453.724 ScaleMode = 0 ‘User ScaleWidth = 5380.766 ShowInTaskbar = 0 ‘False Begin VB.CommandButton cmdOK Cancel = -1 ‘True Caption = "确定" Default = -1 ‘True Height = 345 Left = 4125 TabIndex = 0 Top = 2625 Width = 1500 End Begin VB.CommandButton cmdSysInfo Caption = "系统信息(&S)..." Height = 345 Left = 4140 TabIndex = 1 Top = 3075 Width = 1485 End Begin VB.Label Label1 Caption = "作者:河南省安阳市监狱 yxf" Height = 255 Left = 240 TabIndex = 6 Top = 3240 Width = 3735 End Begin VB.Image Image1 BorderStyle = 1 ‘Fixed Single Height = 675 Left = 120 Picture = "frmAbout.frx":08CA Stretch = -1 ‘True Top = 240 Width = 720 End Begin VB.Line Line1 BorderColor = &H00808080& BorderStyle = 6 ‘Inside Solid Index = 1 X1 = 84.515 X2 = 5309.398 Y1 = 1687.583 Y2 = 1687.583 End Begin VB.Label lblDescription Caption = $"frmAbout.frx":175602 ForeColor = &H00000000& Height = 1170 Left = 1080 TabIndex = 2 Top = 1125 Width = 3765 End Begin VB.Label lblTitle Caption = "文本朗读器" BeginProperty Font Name = "隶书" Size = 21.75 Charset = 134 Weight = 400 Underline = -1 ‘True Italic = -1 ‘True Strikethrough = 0 ‘False EndProperty ForeColor = &H000000FF& Height = 600 Left = 1080 TabIndex = 4 Top = 120 Width = 3885 End Begin VB.Line Line1 BorderColor = &H00FFFFFF& BorderWidth = 2 Index = 0 X1 = 98.6 X2 = 5309.398 Y1 = 1697.936 Y2 = 1697.936 End Begin VB.Label lblVersion Caption = "版本:1.1" Height = 225 Left = 1050 TabIndex = 5 Top = 780 Width = 3885 End Begin VB.Label lblDisclaimer Caption = "警告:本软件可以自由使用,但因对其使用而 带来的任何不良后果概不负责!" ForeColor = &H00000000& Height = 420 Left = 255 TabIndex = 3 Top = 2625 Width = 3630 EndEndAttribute VB_Name = "frmAbout"Attribute VB_GlobalNameSpace = FalseAttribute VB_Creatable = FalseAttribute VB_PredeclaredId = TrueAttribute VB_Exposed = FalseOption Explicit‘ 注册表关键字安全选项...Const READ_CONTROL = &H20000Const KEY_QUERY_VALUE = &H1Const KEY_SET_VALUE = &H2Const KEY_CREATE_SUB_KEY = &H4Const KEY_ENUMERATE_SUB_KEYS = &H8Const KEY_NOTIFY = &H10Const KEY_CREATE_LINK = &H20Const KEY_ALL_ACCESS = KEY_QUERY_VALUE + KEY_SET_VALUE + _ KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS + _ KEY_NOTIFY + KEY_CREATE_LINK + READ_CONTROL ‘ 注册表关键字 ROOT 类型...Const HKEY_LOCAL_MACHINE = &H80000002Const ERROR_SUCCESS = 0Const REG_SZ = 1 ‘ 独立的空的终结字符串Const REG_DWORD = 4 ‘ 32位数字Const gREGKEYSYSINFOLOC = "SOFTWAREMicrosoftShared Tools Location"Const gREGVALSYSINFOLOC = "MSINFO"Const gREGKEYSYSINFO = "SOFTWAREMicrosoftShared ToolsMSINFO"Const gREGVALSYSINFO = "PATH"Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As LongPrivate Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, ByRef lpType As Long, ByVal lpData As String, ByRef lpcbData As Long) As LongPrivate Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As LongPrivate Sub cmdSysInfo_Click() Call StartSysInfoEnd SubPrivate Sub cmdOK_Click() Unload MeEnd SubPrivate Sub Form_Load()Dim X0 As LongDim Y0 As Long‘让窗体居X0 = Screen.WidthY0 = Screen.HeightX0 = (X0 - Me.Width) / 2Y0 = (Y0 - Me.Height) / 2Me.Move X0, Y0End SubPublic Sub StartSysInfo() On Error GoTo SysInfoErr Dim rc As Long Dim SysInfoPath As String ‘ 试图从注册表获得系统信息程序的路径及名称... If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then ‘ 试图仅从注册表获得系统信息程序的路径... ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then ‘ 已知32位文件版本的有效位置 If (Dir(SysInfoPath & "MSINFO32.EXE") <> "") Then SysInfoPath = SysInfoPath & "MSINFO32.EXE" ‘ 错误 - 文件不能被找到... Else GoTo SysInfoErr End If ‘ 错误 - 注册表相应条目不能被找到... Else GoTo SysInfoErr End If Call Shell(SysInfoPath, vbNormalFocus) Exit SubSysInfoErr: MsgBox "此时系统信息不可用", vbOKOnlyEnd SubPublic Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean Dim i As Long ‘ 循环计数器 Dim rc As Long ‘ 返回代码 Dim hKey As Long ‘ 打开的注册表关键字句柄 Dim hDepth As Long ‘ Dim KeyValType As Long ‘ 注册表关键字数据类型 Dim tmpVal As String ‘ 注册表关键字值的临时存储器 Dim KeyValSize As Long ‘ 注册表关键自变量的尺寸 ‘------------------------------------------------------------ ‘ 打开 {HKEY_LOCAL_MACHINE...} 下的 RegKey ‘------------------------------------------------------------ rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ‘ 打开注册表关键字 If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ‘ 处理错误... tmpVal = String$(1024, 0) ‘ 分配变量空间 KeyValSize = 1024 ‘ 标记变量尺寸 ‘------------------------------------------------------------ ‘ 检索注册表关键字的值... ‘------------------------------------------------------------ rc = RegQueryValueEx(hKey, SubKeyRef, 0, _ KeyValType, tmpVal, KeyValSize) ‘ 获得/创建关键字值 If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ‘ 处理错误 If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then ‘ Win95 外接程序空终结字符串... tmpVal = Left(tmpVal, KeyValSize - 1) ‘ Null 被找到,从字符串分离出来 Else ‘ WinNT 没有空终结字符串... tmpVal = Left(tmpVal, KeyValSize) ‘ Null 没有被找到, 分离字符串 End If ‘------------------------------------------------------------ ‘ 决定转换的关键字的值类型... ‘------------------------------------------------------------ Select Case KeyValType ‘ 搜索数据类型... Case REG_SZ ‘ 字符串注册关键字数据类型 KeyVal = tmpVal ‘ 复制字符串的值 Case REG_DWORD ‘ 四字节的注册表关键字数据类型 For i = Len(tmpVal) To 1 Step -1 ‘ 将每位进行转换 KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) ‘ 生成值字符。 By Char。 Next KeyVal = Format$("&h" + KeyVal) ‘ 转换四字节的字符为字符串 End Select GetKeyValue = True ‘ 返回成功 rc = RegCloseKey(hKey) ‘ 关闭注册表关键字 Exit Function ‘ 退出 GetKeyError: ‘ 错误发生后将其清除... KeyVal = "" ‘ 设置返回值到空字符串 GetKeyValue = False ‘ 返回失败 rc = RegCloseKey(hKey) ‘ 关闭注册表关键字End Function
Contents xvii Web Forms 133 Intellisense 134 Customizing the IDE 135 Customizing the Code Editor 135 Customizing Shortcut Keys 135 Customizing the Toolbars 136 Exercise 3.4 Adding a New Toolbar to the Existing Set 136 Exercise 3.5 Adding Commands to Toolbars 137 Customizing Built-In Commands 137 Exercise 3.6 Creating an Alias 138 Customizing the Start Page 139 Accessibility Options 141 Summary 142 Solutions Fast Track 142 Frequently Asked Questions 143 Chapter 4 Common Language Runtime 145 Introduction 146 Component Architecture 148 Managed Code versus Unmanaged Code 150 Interoperability with Managed Code 152 System Namespace 153 File I/O 155 Drawing 156 Printing 157 Common Type System 158 Type Casting 160 Garbage Collection 163 Object Allocation/Deallocation 164 Close/Dispose 165 Summary 166 Solutions Fast Track 167 Frequently Asked Questions 168 Developing & Deploying… Embrace Your Parameters VB.NET is insistent upon enclosing parameters of function calls within parentheses regardless of whether we are returning a value or whether we are using the Call statement. It makes the code much more readable and is a new standard for VB programmers that is consistent with the standard that nearly all other languages adopted long ago. 153_VBnet_TOC 8/16/01 1:12 PM Page xvii xviii Contents Chapter 5 .NET Programming Fundamentals 171 Introduction 172 Variables 173 Constants 175 Structures 176 Program Flow Control 178 If…Then…Else 178 Select Case 182 While Loops 184 For Loops 186 Arrays 187 Declaring an Array 188 Multidimensional Arrays 189 Dynamic Arrays 191 Functions 192 Object Oriented Programming 196 Inheritance 196 Polymorphism 197 Encapsulation 197 Classes 198 Adding Properties 198 Adding Methods 200 System.Object 201 Constructors 201 Overloading 202 Overriding 203 Shared Members 205 String Handling 206 Error Handling 210 Summary 213 Solutions Fast Track 214 Frequently Asked Questions 217 NOTE When porting Visual Basic applications to Visual Basic .NET, be careful of the lower bounds of arrays. If you are using a for loop to iterate through the array, and it is hard-coded to initialize the counter at 1, the first element will be skipped. Remember that all arrays start with the index of 0. 153_VBnet_TOC 8/16/01 1:12 PM Page xviii Contents xix Chapter 6 Advanced Programming Concepts 219 Introduction 220 Using Modules 221 Utilizing Namespaces 222 Creating Namespaces 222 Understanding the Imports Keyword 226 Implementing Interfaces 229 Delegates and Events 232 Simple Delegates 235 Multicast Delegates 236 Event Programming 236 Handles Keyword 236 Language Interoperability 237 File Operations 239 Directory Listing 239 Data Files 241 Text Files 243 Appending to Files 246 Collections 246 The Drawing Namespace 248 Images 253 Printing 256 Understanding Free Threading 262 SyncLock 263 Summary 265 Solutions Fast Track 265 Frequently Asked Questions 267 Chapter 7 Creating Windows Forms 269 Introduction 270 Application Model 270 Properties 271 Manipulating Windows Forms 275 Properties of Windows Forms 275 Methods of Windows Forms 276 Creating Windows Forms 287 What Are Collections? Collectionsare groups of like objects. Collections are similar to arrays, but they don’t have to be redimensioned. You can use the Addmethod to add objects to a collection. Collections take a little more code to create than arrays do, and sometimes accessing a collection can be a bit slower than an array, but they offer significant advantages because a collection is a group of objects whereby an array is a data type. 153_VBnet_TOC 8/16/01 1:12 PM Page xix xx Contents Displaying Modal Forms 288 Displaying Modeless Forms 289 Displaying Top-Most Forms 289 Changing the Borders of a Form 289 Resizing Forms 291 Setting Location of Forms 292 Form Events 294 Creating Multiple Document Interface Applications 297 Creating an MDI Parent Form 297 Creating MDI Child Forms 298 Exercise 7.1 Creating an MDI Child Form 298 Determining the Active MDI Child Form 299 Arranging MDI Child Forms 299 Adding Controls to Forms 300 Anchoring Controls on Forms 301 Docking Controls on Forms 303 Layering Objects on Forms 304 Positioning Controls on Forms 304 Dialog Boxes 305 Displaying Message Boxes 306 Common Dialog Boxes 306 The OpenFileDialog Control 306 The SaveFileDialog Control 309 The FontDialog Control 311 The ColorDialog Control 313 The PrintDialog Control 315 The PrintPreviewDialog Control 316 The PageSetupDialog Control 321 Creating Dialog Boxes 322 Creating and Working with Menus 323 Adding Menus to a Form 323 Exercise 7.2 Adding a Menu to a Form at Design Time 323 Creating Dialog Boxes 1.Create a form. 2.Set the BorderStyle property of the form to FixedDialog. 3.Set the ControlBox, MinimizeBox, and MaximizeBox properties of the form to False. 4.Customize the appearance of the form appropriately. 5.Customize event handlers in the Code window appropriately. 153_VBnet_TOC 8/16/01 1:12 PM Page xx Contents xxi Dynamically Creating Menus 326 Exercise 7.3 Adding a Menu to a Form at Design Time 326 Adding Status Bars to Forms 328 Adding Toolbars to Forms 330 Data Binding 332 Simple Data Binding 332 Complex Data Binding 333 Data Sources for Data Binding 333 Using the Data Form Wizard 334 Using the Windows Forms Class Viewer 338 Using the Windows Forms ActiveX Control Importer 338 Summary 340 Solutions Fast Track 340 Frequently Asked Questions 344 Chapter 8 Windows Forms Components and Controls 347 Introduction 348 Built-In Controls 348 Label Control 351 LinkLabel Control 354 TextBox Control 357 Button Control 361 CheckBox Control 364 RadioButton Control 365 RichTextBox Control 367 TreeView Control 369 ListBox Control 371 CheckedListBox Control 374 ListView Control 376 ComboBox Control 381 DomainUpDown Control 384 NumericUpDown Control 386 PictureBox Control 388 TrackBar Control 389 Adding Items to a Combo Box at Design-Time 1.Select the ComboBox control on the form. 2.If necessary, use the Viewmenu to open the Properties window. 3.In the Properties window, click the Itemsproperty, then click the ellipsis. 4.In String Collection Editor, type the first item, then press Enter. 5.Type the next items, pressing Enterafter each item. 6.Click OK. 153_VBnet_TOC 8/16/01 1:13 PM Page xxi xxii Contents DateTimePicker Control 391 Panel Control 394 GroupBox Control 396 TabControl Control 397 Creating Custom Windows Components 399 Exercise 8.1:Creating a Custom Windows Component 399 Creating Custom Windows Controls 403 Exercise 8.2:Creating a Custom Windows Control 404 Summary 407 Solutions Fast Track 407 Frequently Asked Questions 408 Chapter 9 Using ADO.NET 409 Introduction 410 Overview of XML 411 XML Documents 411 XSL 411 XDR 412 XPath 412 Understanding ADO.NET Architecture 412 Differences between ADO and ADO.NET 414 XML Support 414 ADO.NET Configuration 415 Remoting in ADO.NET 415 Maintaining State 415 Using the XML Schema Definition Tool 416 Connected Layer 417 DataProviders 418 Connection Strings 418 Exercise 9.1 Creating a Connection String 419 Command Objects 421 DataReader 425 DataSet 426 XML Documents XML documents are the heart of the XML standard. An XML document has at least one element that is delimited with one start tag and one end tag. XML documents are similar to HTML, except that the tags are made up by the author. 153_VBnet_TOC 8/16/01 1:13 PM Page xxii Contents xxiii Disconnected Layer 427 Using DataSet 428 Relational Schema 428 Collection of Tables 430 Data States 431 Populating with the DataSet Command 432 Populating with XML 433 Populating Programmatically 434 Using the SQL Server Data Provider 435 TDS 436 Exercise 9.2 Using TypedDataSet 437 Remoting 439 Data Controls 440 DataGrid 440 Exercise 9.3 Using TypedDataSet and DataRelation 441 DataList 446 Repeater 450 Summary 454 Solutions Fast Track 454 Frequently Asked Questions 457 Chapter 10 Developing Web Applications 459 Introduction 460 Web Forms 461 A Simple Web Form 462 Exercise 10.1 Creating a Simple Web Form 462 How Web Forms Differ from Windows Forms 464 Why Web Forms Are Better Than Classic ASP 465 Adding Controls to Web Forms 467 Exercise 10.2 Adding Web Controls to a Web Form 468 Code Behind 473 NOTE Web form controls not only detect browsers such as Internet Explorer and Netscape, but they also detect devices such as Palm Pilots and cell phones and generate appropriate HTML accordingly. 153_VBnet_TOC 8/16/01 1:13 PM Page xxiii xxiv Contents How Web Form Controls Differ from Windows Form Controls 476 ASP.NET Server Controls 476 Intrinsic Controls 476 Bound Controls 478 Exercise 10.3 Using the DataGrid Control 478 Exercise 10.4 Customizing DataGrid Control 482 Custom Controls 487 Validation Controls 488 Exercise 10.5 Using the Validation Controls 489 Creating Custom Web Form Controls 492 Exercise 10.6 A Simple Custom Control 493 Exercise 10.7 Creating a Composite Custom Control 497 Web Services 504 How Web Services Work 505 Developing Web Services 505 Exercise 10.8 Developing Web Services 507 Web Service Utilities 509 Service Description Language 509 Discovery 510 Proxy Class 510 Consuming Web Services from Web Forms 511 Exercise 10.9 Consuming Web Services from Web Forms 511 Using Windows Forms in Distributed Applications 513 Exercise 10.10 Consuming Web Services from Windows Forms 514 Exercise 10.11 Developing a Sample Application 516 Summary 519 Solutions Fast Track 519 Frequently Asked Questions 521 153_VBnet_TOC 8/16/01 1:13 PM Page xxiv Contents xxv Chapter 11 Optimizing, Debugging, and Testing 523 Introduction 524 Debugging Concepts 524 Debug Menu 528 Watches 529 Breakpoints 531 Exceptions Window 532 Command Window 534 Conditional Compilation 536 Trace 538 Assertions 540 Code Optimization 541 Finalization 542 Transitions 542 Parameter Passing Methods 542 Strings 543 Garbage Collection 544 Compiler Options 544 Optimization Options 544 Output File Options 544 .NET Assembly Options 545 Preprocessor Options 546 Miscellaneous Options 546 Testing Phases and Strategies 546 Unit Testing 547 Integration Testing 547 Beta Testing 547 Regression Testing 548 Stress Testing 548 Monitoring Performance 548 Summary 550 Solutions Fast Track 551 Frequently Asked Questions 552 What Are Watches? Watchesprovide us with a mechanism where we can interact with the actual data that is stored in our programs at runtime. They allow us to see the values of variables and the values of properties on objects. In addition to being able to view these values, you can also assign new values. 153_VBnet_TOC 8/16/01 1:13 PM Page xxv xxvi Contents Chapter 12 Security 553 Introduction 554 Security Concepts 555 Permissions 555 Principal 556 Authentication 557 Authorization 557 Security Policy 558 Type Safety 558 Code Access Security 558 .NET Code Access Security Model 559 Stack Walking 559 Code Identity 561 Code Groups 562 Declarative and Imperative Security 564 Requesting Permissions 565 Demanding Permissions 570 Overriding Security Checks 572 Custom Permissions 576 Role-Based Security 578 Principals 578 WindowsPrincipal 579 GenericPrincipal 580 Manipulating Identity 581 Role-Based Security Checks 583 Security Policies 585 Creating a New Permission Set 588 Modifying the Code Group Structure 593 Remoting Security 600 Cryptography 600 Security Tools 603 Summary 606 Solutions Fast Track 607 Frequently Asked Questions 611 Within the .NET Framework, Three Namespaces Involve Cryptography 1.System.Security .CryptographyThe most important one; resembles the CryptoAPI functionalities. 2.System.Security .Cryptography.X509 certificatesRelates only to the X509 v3 certificate used with Authenticode. 3.System.Security .Cryptography.XmlFor exclusive use within the .NET Framework security system. 153_VBnet_TOC 8/16/01 1:13 PM Page xxvi Contents xxvii Chapter 13 Application Deployment 615 Introduction 616 Packaging Code 617 Configuring the .NET Framework 622 Creating Configuration Files 622 Machine/Administrator Configuration Files 623 Application Configuration Files 625 Security Configuration Files 626 Deploying the Application 629 Common Language Runtime 629 Windows Installer 630 CAB Files 631 Internet Explorer 5.5 632 Resource Files 633 Deploying Controls 637 Summary 639 Solutions Fast Track 640 Frequently Asked Questions 642 Chapter 14 Upgrading Visual Basic Applications to .NET 647 Introduction 648 Considerations Before Upgrading 648 Early Binding of Variables 649 Avoiding Null Propagation 650 Using ADO 651 Using Date Data Type 652 Using Constants 652 Considering Architecture Before Migration 653 Intranet/Internet Applications 653 Internet Information Server (IIS) Applications 654 DHTML Applications 655 ActiveX Documents 655 Client/Server and Multi-Tier Applications 655 Single-Tier Applications 656 Data Access Applications 656 WARNING You should under no circumstance edit the Security.config and Enterprise.config files directly. It is very easy to compromise the integrity of these files. Always use the Code Access Security Policy utility (caspol.exe) or the .NET Configuration tool; these will guard the integrity of the files and will also make a backup copy of the last saved version. 153_VBnet_TOC 8/16/01 1:13 PM Page xxvii xxviii Contents Data Types 657 Variants 657 Integers 658 Dates 658 Boolean 659 Arrays 659 Fixed-Length Strings 660 Windows API Data Types 661 Converting VB Forms to Windows Forms 662 Control Anchoring 664 Keyword Changes 665 Goto 666 GoSub 666 Option Base 666 AND/OR 666 Lset 666 VarPtr 667 StrPtr 667 Def 667 Programming Differences 668 Method Implementation 668 Optional Parameters 668 Static Modifier 669 Return Statement 669 Procedure Calls 670 External Procedure Declaration 671 Passing Parameters 672 ParamArray 672 Overloading 674 References to Unmanaged Libraries 677 Metadata 679 Runtime Callable Wrapper 681 COM Callable Wrapper 682 Properties 684 Working with Property Procedures 684 Control Property Name Changes 685 Default Property 687 Avoiding Null Propagation Nullpropagation means that if Null is used in an expression, the resulting expression is always Null. In previous versions of Visual Basic, the Null value disseminated throughout the expression. 153_VBnet_TOC 8/16/01 1:13 PM Page xxviii Contents xxix Null Usage 690 Understanding Error Handling 690 Exercise 14.1:Using Error Handling 692 Data Access Changes in Visual Basic .NET 693 Dataset and Recordset 694 Application Interoperability 694 Cursor Location 695 Disconnected Access 695 Data Navigation 695 Lock Implementation 696 Upgrading Interfaces 696 Upgrading Interfaces from Visual Basic 6.0 699 Using the Upgrade Tool 703 Exercise 14.2 Using the Upgrade Wizard 703 Summary 708 Solutions Fast Track 709 Frequently Asked Questions 712 Index 713 Contents xiii From the Series Editor xxxi Chapter 1 New Features in Visual Basic .NET 1 Introduction 2 Examining the New IDE 3 Cosmetic Improvements 3 Development Accelerators 5 .NET Framework 6 A Very Brief and Simplified History 6 .NET Architecture 7 ASP.NET 7 Framework Classes 8 .NET Servers 8 Common Language Runtime 8 History 8 Convergence 9 Object-Oriented Language 10 Object-Oriented Concepts 10 Advantages of Object-Oriented Design 11 History of Object Orientation and VB 13 Namespaces 13 Web Applications 13 Web Applications Overview 13 Web Forms 14 Web Services 15 HyperText Transport Protocol 16 Simple Object Access Protocol 17 .NET Architecture .NET Framework ASP.NET Updated ASP Engine Web Forms Engine Framework Classes System.Math, System.Io, System.Data, Etc. Common Language Runtime Memory Management Common Type System Garbage Collection .NET .NET Servers 153_VBnet_TOC 8/16/01 1:12 PM Page xiii xiv Contents Security 17 Type Safety 18 Casting 18 Data Conversion 19 Bitwise Operations 20 New Compiler 20 Compiling an Executable 20 Architecture 21 File Management in Previous Versions of VB 21 File Management 22 Changes from Visual Basic 6.0 23 Variants 23 Variable Lower Bounds 23 Fixed Length Strings 23 NULL Propagation 23 Other Items Removed 24 Function Values 24 Short Circuits 25 Properties and Variables 25 Variable Lengths 25 Get and Set 26 Date Type 26 Default Properties 27 Summary 28 Solutions Fast Track 28 Frequently Asked Questions 31 Chapter 2 The Microsoft .NET Framework 33 Introduction 34 What Is the .NET Framework? 34 Introduction to the Common Language Runtime 35 Using .NET-Compliant Programming Languages 37 Creating Assemblies 39 Using the Manifest 42 Compiling Assemblies 45 Assembly Cache 45 Locating an Assembly 45 153_VBnet_TOC 8/16/01 1:12 PM Page xiv Contents xv Private Assembly Files 51 Shared Assembly Files 51 Understanding Metadata 51 The Benefits of Metadata 52 Identifying an Assembly with Metadata 53 Types 53 Defining Members 54 Using Contracts 54 Assembly Dependencies 55 Unmanaged Assembly Code 55 Reflection 56 Attributes 57 Ending DLL Hell 58 Side-by-Side Deployment 58 Versioning Support 59 Using System Services 60 Exception Handling 60 StackTrace 61 InnerException 61 Message 61 HelpLink 62 Garbage Collection 62 Console I/O 62 Microsoft Intermediate Language 63 The Just-In-Time Compiler 63 Using the Namespace System to Organize Classes 64 The Common Type System 65 Type Safety 68 Relying on Automatic Resource Management 68 The Managed Heap 69 Garbage Collection and the Managed Heap 71 Assigning Generations 77 Utilizing Weak References 77 Security Services 79 Framework Security 80 Granting Permissions 81 NOTE Visualization is still key! Die-hard VB programmers may find themselves having a hard time visualizing all the new concepts in VB.NET (and we all know that proper logic visualization plays a big role in what we do). Something that may help is to think about VB.NET as a completely flexible language that can accommodate Web, console, and desktop use. 153_VBnet_TOC 8/16/01 1:12 PM Page xv xvi Contents Gaining Representation through a Principal 82 Security Policy 83 Summary 85 Solutions Fast Track 85 Frequently Asked Questions 88 Chapter 3 Installing and Configuring VB.NET 91 Introduction 92 Editions 92 Installing Visual Studio .NET 93 Exercise 3.1:Installing Visual Studio .NET 94 Installing on Windows 2000 99 The New IDE 100 Integrated Development Environment Automation Model 100 Add-Ins 104 Exercise 3.2 Creating an Add-In Using the Add-In Wizard 105 Wizards 109 Macros 109 Home Page 110 Project Options 112 Toolbox 116 Child Windows 120 Window Types 122 Arranging Windows 123 Task List 123 Exercise 3.3 Setting Up a Custom Token 124 TaskList Views 124 Locating Code 126 Annotating Code 126 Solution Explorer 127 Properties Window 129 Form Layout Toolbar 130 Hide/Show Code Elements 132 Installing Visual Studio .NET IPhase 1: Installing Windows components IPhase 2: Installing Visual Studio .NET IPhase 3: Checking for service releases 153_VBnet_TOC 8/16/01 1:12 PM Page xvi

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧