home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch14 / oledd / oleobjects.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-02-16  |  4.2 KB  |  128 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form Form1 
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   7230
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   10545
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   7230
  12.    ScaleWidth      =   10545
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton Command3 
  15.       Caption         =   "List All Objects"
  16.       Height          =   405
  17.       Left            =   150
  18.       TabIndex        =   5
  19.       Top             =   6090
  20.       Width           =   2265
  21.    End
  22.    Begin VB.CommandButton Command2 
  23.       Caption         =   "Load Text File"
  24.       Height          =   465
  25.       Left            =   5580
  26.       TabIndex        =   4
  27.       Top             =   6075
  28.       Width           =   2370
  29.    End
  30.    Begin VB.TextBox Text1 
  31.       Height          =   2115
  32.       Left            =   5535
  33.       MultiLine       =   -1  'True
  34.       OLEDragMode     =   1  'Automatic
  35.       ScrollBars      =   2  'Vertical
  36.       TabIndex        =   3
  37.       Text            =   "OLEObjects.frx":0000
  38.       Top             =   3825
  39.       Width           =   4815
  40.    End
  41.    Begin MSComDlg.CommonDialog CommonDialog1 
  42.       Left            =   8025
  43.       Top             =   3195
  44.       _ExtentX        =   847
  45.       _ExtentY        =   847
  46.       _Version        =   393216
  47.    End
  48.    Begin VB.CommandButton Command1 
  49.       Caption         =   "Load Image"
  50.       Height          =   465
  51.       Left            =   5535
  52.       TabIndex        =   2
  53.       Top             =   3240
  54.       Width           =   2370
  55.    End
  56.    Begin VB.PictureBox Picture1 
  57.       Height          =   2940
  58.       Left            =   5535
  59.       OLEDragMode     =   1  'Automatic
  60.       ScaleHeight     =   2880
  61.       ScaleWidth      =   4800
  62.       TabIndex        =   1
  63.       Top             =   165
  64.       Width           =   4860
  65.    End
  66.    Begin RichTextLib.RichTextBox RichTextBox1 
  67.       Height          =   5820
  68.       Left            =   120
  69.       TabIndex        =   0
  70.       Top             =   150
  71.       Width           =   5235
  72.       _ExtentX        =   9234
  73.       _ExtentY        =   10266
  74.       _Version        =   393216
  75.       Enabled         =   -1  'True
  76.       ScrollBars      =   2
  77.       RightMargin     =   8e6
  78.       TextRTF         =   $"OLEObjects.frx":0006
  79.    End
  80. Attribute VB_Name = "Form1"
  81. Attribute VB_GlobalNameSpace = False
  82. Attribute VB_Creatable = False
  83. Attribute VB_PredeclaredId = True
  84. Attribute VB_Exposed = False
  85. Dim PWidth As Long, PHeight As Long
  86. Private Sub Command1_Click()
  87. CommonDialog1.Filter = "Images|*.bmp;*.gif;*.tif"
  88. CommonDialog1.InitDir = App.Path
  89. CommonDialog1.FileName = ""
  90. CommonDialog1.ShowOpen
  91. If CommonDialog1.FileName = "" Then Exit Sub
  92. Picture1.Picture = LoadPicture(CommonDialog1.FileName)
  93. Form1.Palette = LoadPicture(CommonDialog1.FileName)
  94. ResizePBox
  95. End Sub
  96. Private Sub Command2_Click()
  97. CommonDialog1.Filter = "Text Files|*.txt|All Files|*.*"
  98. CommonDialog1.InitDir = App.Path
  99. CommonDialog1.FileName = ""
  100. CommonDialog1.ShowOpen
  101. If CommonDialog1.FileName = "" Then Exit Sub
  102. FNum = FreeFile
  103. Open CommonDialog1.FileName For Input As #FNum
  104. Input #FNum, allTxt
  105. Close FNum
  106. Text1.Text = allTxt
  107. End Sub
  108. Private Sub Command3_Click()
  109. For i = 0 To RichTextBox1.OLEObjects.Count
  110.     Debug.Print RichTextBox1.OLEObjects.Item(i).Class
  111.     Debug.Print RichTextBox1.OLEObjects.Item(i).DisplayType
  112.     RichTextBox1.OLEObjects.Item(i).FetchVerbs
  113.     Debug.Print RichTextBox1.OLEObjects.Item(i).ObjectVerbs
  114. End Sub
  115. Private Sub Form_Load()
  116.     PWidth = Picture1.Width
  117.     PHeight = Picture1.Height
  118. End Sub
  119. Sub ResizePBox()
  120. Dim imgWidth As Long, imgHeight As Long
  121.     Picture1.Enabled = False
  122.     imgWidth = Round(ScaleX(Picture1.Picture.Width, vbHimetric, vbTwips))
  123.     imgHeight = Round(ScaleY(Picture1.Picture.Height, vbHimetric, vbTwips))
  124.     If imgWidth < PWidth Then Picture1.Width = imgWidth
  125.     If imgHeight < PHeight Then Picture1.Height = imgHeight
  126.     Picture1.Enabled = True
  127. End Sub
  128.