博文

用VB编写Flash图像浏览器(2006-08-05 19:41:00)

摘要:  用VB编写Flash图像浏览器 作者 alpha 于 2005年08月18日 21:18:26 (898 次阅读) 该作者发布的其他新闻 在网络上有许多Flash编写的动画,可惜的是只能在线观看,若下载下来则必须安装Flash 才能观看。可是Flash 对于只想观看动画来说未必太大了吧,那么有没有可能自己制作一个Flash图像浏览器?当然可以,请跟我来。



  首先需要安装Flash控件Swflash.ocx。 您可以通过“控制面板”—“添加/删除程序”进行安装。选择“Windows 安装程序”页,在“多媒体”中选择“详细资料”,将“Macromedia Shockwave Flash”前的复选项选中,将Windows 98光盘放入光驱,点击“确定”即可将控件安装注册。

  让我们再来看看控件Swflash.ocx的基本属性:

属性 取值及说明 Loop True:允许循环播放

False:不允许循环播放 Menu True:允许显示右键快捷菜单
False:不允许显示右键快捷菜单 Movie 所要播放的动画文件的路径和文件名 Playing True:播放
False:停止 Quality 0:低分辨率( 即Quality2:Low)

1:高分辨率( 即Quality2:High)

2:自动降低分辨率 ( 即Quality2:AutoLow)

3:自动升高分辨率( 即Quality2:AutoHigh) Quality2 见上,和Quality变化一致 ScaleMode 0:全部显示(即Scale:Showall)

1:无边界(即Scale:NoBorder)

2:自动适应控件大小(即Scale:ExactFit) Scale 见上,和ScaleMode变化一致编程:

  1.打开VB,新建工程,在“控件”工具箱空白处单击右键,在快捷菜单中选择“添加控件”,在控件列表中选中“Shockware flash”复选框,按“确定”即可将Swflash.ocx控件添加到“控......

阅读全文(3126) | 评论:2

GUI+英文教程2(2006-07-13 21:21:00)

摘要:Points, Sizes and Rectangles A fundamental concept for any graphics system is the way that positions or sizes are represented. GDI+ uses specialist objects that enable you to specify a point in two dimensional space, a size or a complete rectangle having both location and size. Points Coordinates in GDI+ are represented by the Point or PointF structures. These both contain an X and Y member that hold the coordinates for the two axes of the drawing surface. Point structures store the values as integers and PointF structures store them as floating point values. Remember that GDI+ uses floating point values internally so the values in the Point structure will be interpreted by the drawing system as a float or a single for the purpose of creating the graphics. Some drawing methods, such as DrawLine, are overloaded to accept either X,Y coordinate values or two Point or PointF structures as parameters. The following listing shows two line drawing directives that are functio......

阅读全文(2981) | 评论:0

GUI+英文教程(2006-07-13 21:20:00)

摘要:The Graphics Object All drawing in GDI+ takes place upon the Graphics object and there are several contexts in which you'll find one. During a Paint cycle the Graphics object will be provided in a PaintEventArgs object that is handed to your code in the OnPaint and OnPaintBackground methods of a Windows Forms control. This same event argument is passed to handlers that service the Paint event raised by the OnPaint methods. When printing, the PrintPageEventArgs provided in a PrintPage event will contain a Graphics object for the printer and you can obtain a Graphics object for certain types of image so that you can paint directly on an image in memory as if it were the screen. Obtaining the Graphics object. When you're writing programs that place graphics on screen the graphics object will be handed to you wrapped up in a PaintEventArgs object. There are two ways in which your code can get hold of the Graphics object. You can override the protected OnPaint or OnPaintBac......

阅读全文(3054) | 评论:0

加密和解密(vb.net)(2006-06-25 07:39:00)

摘要:  Encryption and Decryption
Submitted By: Yasir Attiq Butt, eWorx International
Posted On: 3/11/2005

Overall Rating: 1 (1 ratings, 1 comments)
Description:
Before I found a small code piece to easily secure data in .Net; I've always felt a little disturbed when sending my query strings and information like user names, passwords etc. to other pages in ASP.Net without Encrypting/Decrypting my UserName/Passwords in databases. The code is written below.
Simple copy and paste it to any class in Visual basic project form and start using it. Sub DoEncryptionDecryption     dim objHash as new Hashing     dim strEncryptedText as string=““      strEncryptedText = objHash.encrypt(“TextToEncrypt“)      Messagebox.show(strEncryptedText)      dim strDecryptedText as string      strDecryptedText = objHash.Decrypt (strEncryptedText)  &......

阅读全文(3318) | 评论:0

如何突破滚动条最大值是32767的限制(vb6)(2006-06-25 07:20:00)

摘要:Hi:

I'm using VB6 and am trying to compensate for the scrollbar max of 32767.  Here's what I'm trying to do.  I have a picture control within a picture control.  Let's call the outside picture control picContainer and the picture control within it picChild.  It's set up so that at design time if I move picContainer, picChild also moves.  My form is being used to view images and picChild is what contains the images.  When an image is loaded, picChild is resized to the size of the picture.  When picChild is larger than picContainer, picContainer contains a vertical scrollbar so that I can move picChild up and down to see the image (I'm just worrying about the vertical right now, forget about the horizontal).  I set my scrollbar (called fsb, for flat scroll bar) settings as follows:

fsb.Max = picChild.Height - picContainer.Height
fsb.SmallChange = Abs(fsb1.Max \ 16) + 1
fsb.LargeChange = Abs(fsb1.Max \ 4) + 1  

The pr......

阅读全文(6013) | 评论:0

在有Clipboard的应用程序间移动数据(2006-06-21 20:36:00)

摘要:VB.NET中的Clipboard对象(在System.Windows.Forms命名空间里)允许你在一个应用程序或几个应用程序之间存储和检索数据。使用Clipboard对象非常简单,就像下面这样:

拷贝数据
Clipboard.SetDataObject(TextBox1.Text)

粘贴数据
TextBox2.Text = Clipboard.GetDataObject().GetData(DataFormats.Text, _ False)


这段代码对于简单的文本数据非常有效;然而,要想在应用程序之间复制和粘贴或者是进行其他的操作,你需要提供多种的数据格式。你给数据提供的可用格式越多,其他应用程序就越有可能使用这个数据。

通过创建一个DataObject,你可以根据你的需要把数据以多种格式存储。你还可以用GetDataPresent方法来检查某个格式是否被支持。

下面的代码介绍了如何用DataObject来存储RTF数据和文本数据。同时,这段代码还说明了如何用GetDataPresent来查看所有支持的格式。

Dim ClipboardData As New DataObject()

ClipboardData.SetData(DataFormats.Rtf, RichTextBox1.Rtf)

ClipboardData.SetData(DataFormats.Text, RichTextBox1.Text)

Clipboard.SetDataObject(ClipboardData)

If Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) Then
    TextBox2.Text = Clipboard.GetDataObject().GetData(DataFormats.Text)
End If

If Clipboard.GetDataObject().GetDataPresent(DataFormats.Rtf) Then
  &n......

阅读全文(2620) | 评论:0

VB.NET开发扫描客户端服务工具(2006-06-21 20:33:00)

摘要:在大中型企业信息系统中,对客户端PC的管理,往往是容易出现问题的环节。因此,很多大公司引入了各种分布式的管理系统,例如防病毒方面的Norton AntiVirus,BlackICE防火墙,微软的 SMS (System Management Server),等等,这些系统都会在客户端安装相应的客户端软件,一般都是以服务的形式出现,但是由于种种原因,这些服务会停止运行或者该客户机根本没有安装这些客户端服务,这样管理系统就会出现疏漏,有可能造成问题,如因无法防御病毒而成为病毒源,无法为该客户端发布软件,无法管理客户PC等等。在此,我们提供一个方案,可以定时按照IP地址扫描网络,报告出特定的服务的状态。

  这个方案使用了Microsoft.NET技术,同时也用到了.NET Framework中的ADO.NET ,WMI management,XML。其核心是一个由VB.NET写的程序以及它的两个配置文件,配置文件为XML格式,该程序按IP扫描网络,得到每个系统的服务 的状态,如果IP地址没有对应系统,则忽略该IP,针对没有安装服务或服务停止的系统我们在另一个线程中运行NBTSTAT命令,得到其机器名,用户名,MAC地址域等信息,以便我们找到机器解决问题。其次为了保存扫描的结果,我们需要一个很小的数据库MS-Access或MS-SQL server都可以,本文使用SQL2000 。最后为了呈现出扫描的结果,以便我们采取行动,这里我们使用网页的形式把数据库中的结果展现出来。

  1. VB.NET程序

  该程序使用两个XML格式的配置文件,当程序启动时会读入这些配置。其中一个文件定义了需要扫描的网段,包括排除在外的地址段。另一个文件定义了连接数据库的信息,以及数据表的定义。这两个文件的内容如下:

<IPLIST>

<IP LANID="192.168.100." ><EXP L=”1” H=”30”/></IP>

<IP LANID="192.168.101." />

<IP LANID="192.168.102." />

<IP LANID="192.168.103." />

<IP LANID="192.168.104." ><EXP L=”1......

阅读全文(2785) | 评论:0

用新VB.NET 枚举提高效率(2006-06-21 20:28:00)

摘要:当你还使用For…Each循环或者是For 1 To Count 循环处理集合的时候,VB .NET中加入了一种新的技术,IEnumerator界面。

IEnumerator界面支持两种方法和一种特性。MoveNext方法能在集合中一次移动一条记录。Reset方法能使枚举器复位到集合的起始。Current特性能从集合返回当前记录。

下面的程序显示了这三种计算集合的可能的办法。

Dim testCollection As New Collection()
Dim collectionItem As String
Dim loopCounter As Integer
Dim enumCollection As Ienumerator

With testCollection
.Add("1")
.Add("2")
.Add("3")
End With

For Each collectionItem In testCollection
Console.Out.WriteLine(collectionItem)
Next

For loopCounter = 1 To testCollection.Count
Console.Out.WriteLine(testCollection.Item(loopCounter))
Next

enumCollection = testCollection.GetEnumerator()

Do While enumCollection.MoveNext
Console.Out.WriteLine(enumCollection.Current)
Loop

IEnumerator带给你For…Each技术所能提供的计数功能,另外还有使循环复位和从起始位置开始的新加功能。本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( ProgramFan.Com )
......

阅读全文(2397) | 评论:0

在Visual Basic .NET中文件读写I/O选项(2006-06-21 20:21:00)

摘要:有经验的 Visual Basic 开发人员最初可能会认为,Visual Basic .NET 中的变化使本来已经熟悉的领域变得陌生而难以驾驭。其实,过去开发的成果仍然可以使用。例如,Visual Basic 运行时文件 I/O 方法就是大家比较熟悉的。同样,以前曾涉猎过 FileSystemObject 对象的开发人员也可以继续在这一领域畅游。尽管公共语言运行时领域可能让人感到陌生并且到处都是以对象为中心的“怪物”,但同时,它提供的功能却极具诱惑力,例如 FileSystemWatcher 或 FileIOPermissions 类中的新功能。

  事实上,唯一让 Visual Basic .NET 开发人员望而却步的是如何从这三种方法中进行选择。对许多应用程序而言,对文件和目录进行操作是最重要的,但是 Visual Basic .NET 所提供的灵活方法可能会使人感到困惑,并且会提出下列问题:Visual Basic .NET 提供什么样的文件访问?何时使用 FileSystemObject 对象?使用公共语言运行时中的方法有哪些好处?是否需要专门使用一种方法?如何选择方法?

  Visual Basic .NET 中的文件方法

  让我们先看看 Microsoft.VisualBasic 命名空间,这可以为那些被全新的 .NET 领域吓坏的开发人员带来一些安慰和信心。命名空间包含许多熟悉的函数和方法。除了部分名称有少许改动外,大部分名称仍保持不变,如 Dir、Input、Print、Seek、Write 等等。

  在选择运行时函数时,主要应考虑写入文件或从文件中收集的信息的类型。Visual Basic .NET 为三种类型的文件提供了访问方法,每种方法适用于一种特定的数据类型:二进制、顺序和随机。

  二进制访问,允许您以任意方式存储和访问数据,这种方法对于变长字段尤为有用。

  随机访问,允许您以记录的方式存储和访问信息,这种方法假定记录是等长的。顺序访问,允许您在文本文件中读取和写入字符串。

  这些不同类型的文件访问所使用的函数发生了一些变化。最显著的变化是用 FilePut/FilePutObject 和 FileGet/FileGetObject 函......

阅读全文(4244) | 评论:1

Visual Basic.Net中的字符串处理(2006-06-21 20:15:00)

摘要:Visual Basic.Net中的字符串处理
作者:马金虎出处:天极网责任编辑: 方舟 [ 2004-08-25 15:08 ] 字符串处理是程序设计是最常见的操作,一般来说,掌握对字符串的处理也是开始学习一种新语言来的基础  
  字符串处理是程序设计是最常见的操作,一般来说,掌握对字符串的处理也是开始学习一种新语言来的基础,对后续的深入学习是非常重要的,这也是为什么把对字符串处理放在本系列讲座最前面的原因。由于字符串处理所涉及的内容比较多,下面就选择Visual Basic .Net在处理字符串时的一些常见的、典型的问题加以介绍。
  一.用String关键字、String类和StringBuilder类创建字符串:

  Visual Basic .Net保留了很多早期Visual Basic的关键字、运算符和函数。但一般来说这些关键字、运算符和函数在.Net框架提供的.Net FrameWork SDK中又能够找到可以替代的类、方法等。在Visual Basic .Net创建一个字符串可有三种方式,具体如下:
  1. 使用关键字String来定义字符串变量,String关键字在早期的Visual Basic中也存在。具体的操作如下:

Dim sStr1 As String '定义String变量
sStr1 = " Hello World " '初始化此变量
  2. 使用String类来创建字符串,String类位于命名空间System中,具体如下:

Dim sStr1 As System.String
SStr1 = " Hello World "
  3. 使用StringBuilder类来创建字符串,StringBuilder类位于命名空间System.Text,具体如下:

Dim sStr1 As System.Text.StringBuilder
sStr1 = New System.Text.StringBuilder ( "Hello World" )
  下面就来看看上述三种Visual Basic .Net中创建字符串的方法的......

阅读全文(3310) | 评论:0