home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / Multiple_D2178123292010.psc / Settings.frm < prev   
Text File  |  2009-06-05  |  13KB  |  378 lines

  1. VERSION 5.00
  2. Begin VB.Form Settings 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Settings"
  6.    ClientHeight    =   2640
  7.    ClientLeft      =   2760
  8.    ClientTop       =   3750
  9.    ClientWidth     =   5805
  10.    Icon            =   "Settings.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   176
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   387
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.PictureBox Bkgnd 
  19.       Appearance      =   0  'Flat
  20.       AutoRedraw      =   -1  'True
  21.       BackColor       =   &H80000005&
  22.       BorderStyle     =   0  'None
  23.       ForeColor       =   &H80000008&
  24.       Height          =   1680
  25.       Left            =   1740
  26.       ScaleHeight     =   112
  27.       ScaleMode       =   3  'Pixel
  28.       ScaleWidth      =   152
  29.       TabIndex        =   10
  30.       Top             =   340
  31.       Width           =   2285
  32.       Begin VB.Label Label2 
  33.          Alignment       =   2  'Center
  34.          Appearance      =   0  'Flat
  35.          BackColor       =   &H80000005&
  36.          BackStyle       =   0  'Transparent
  37.          Caption         =   "SAMPLE"
  38.          ForeColor       =   &H80000008&
  39.          Height          =   225
  40.          Left            =   735
  41.          TabIndex        =   11
  42.          Top             =   735
  43.          Width           =   960
  44.       End
  45.    End
  46.    Begin VB.OptionButton Option1 
  47.       BackColor       =   &H00FFFFFF&
  48.       Caption         =   "Tiled"
  49.       Height          =   225
  50.       Index           =   2
  51.       Left            =   210
  52.       TabIndex        =   9
  53.       Top             =   1260
  54.       Width           =   1170
  55.    End
  56.    Begin VB.PictureBox PicSize 
  57.       Appearance      =   0  'Flat
  58.       AutoSize        =   -1  'True
  59.       BackColor       =   &H80000005&
  60.       BorderStyle     =   0  'None
  61.       ForeColor       =   &H80000008&
  62.       Height          =   720
  63.       Left            =   315
  64.       ScaleHeight     =   48
  65.       ScaleMode       =   3  'Pixel
  66.       ScaleWidth      =   48
  67.       TabIndex        =   8
  68.       Top             =   2940
  69.       Visible         =   0   'False
  70.       Width           =   720
  71.    End
  72.    Begin VB.CommandButton ACKbuttons 
  73.       Caption         =   "Apply"
  74.       Height          =   435
  75.       Index           =   3
  76.       Left            =   4410
  77.       TabIndex        =   7
  78.       Top             =   2100
  79.       Width           =   1275
  80.    End
  81.    Begin VB.OptionButton Option1 
  82.       BackColor       =   &H00FFFFFF&
  83.       Caption         =   "Centered"
  84.       Height          =   225
  85.       Index           =   1
  86.       Left            =   210
  87.       TabIndex        =   6
  88.       Top             =   945
  89.       Width           =   1170
  90.    End
  91.    Begin VB.OptionButton Option1 
  92.       BackColor       =   &H00FFFFFF&
  93.       Caption         =   "Stretched"
  94.       Height          =   225
  95.       Index           =   0
  96.       Left            =   210
  97.       TabIndex        =   5
  98.       Top             =   630
  99.       Value           =   -1  'True
  100.       Width           =   1170
  101.    End
  102.    Begin VB.CommandButton Fcolor 
  103.       Caption         =   "Font Color"
  104.       Height          =   435
  105.       Left            =   105
  106.       TabIndex        =   4
  107.       ToolTipText     =   "Font Color"
  108.       Top             =   2100
  109.       Width           =   1275
  110.    End
  111.    Begin VB.CommandButton BGcolor 
  112.       Caption         =   "Back Color"
  113.       Height          =   435
  114.       Left            =   105
  115.       TabIndex        =   3
  116.       ToolTipText     =   "Background Color"
  117.       Top             =   1575
  118.       Width           =   1275
  119.    End
  120.    Begin VB.CommandButton BGImage 
  121.       Caption         =   "Back Image"
  122.       Height          =   435
  123.       Left            =   105
  124.       TabIndex        =   2
  125.       ToolTipText     =   "Background Image"
  126.       Top             =   105
  127.       Width           =   1275
  128.    End
  129.    Begin VB.CommandButton ACKbuttons 
  130.       Caption         =   "Cancel"
  131.       Height          =   435
  132.       Index           =   1
  133.       Left            =   4410
  134.       TabIndex        =   1
  135.       Top             =   1050
  136.       Width           =   1275
  137.    End
  138.    Begin VB.CommandButton ACKbuttons 
  139.       Caption         =   "OK"
  140.       Height          =   435
  141.       Index           =   0
  142.       Left            =   4410
  143.       TabIndex        =   0
  144.       Top             =   105
  145.       Width           =   1275
  146.    End
  147.    Begin VB.Image Monitor 
  148.       Height          =   2400
  149.       Left            =   1575
  150.       Picture         =   "Settings.frx":0ECA
  151.       Stretch         =   -1  'True
  152.       Top             =   105
  153.       Width           =   2655
  154.    End
  155. End
  156. Attribute VB_Name = "Settings"
  157. Attribute VB_GlobalNameSpace = False
  158. Attribute VB_Creatable = False
  159. Attribute VB_PredeclaredId = True
  160. Attribute VB_Exposed = False
  161.  
  162. Option Explicit
  163. Private INI As New INIclass
  164. Dim SelectedFileName As String
  165. Dim SelectedBackgroundColor As Long
  166. Dim SelectedFontColor As Long
  167. Dim SelectedImageMode As Byte
  168. '----------------------------
  169. Dim DefaultFileName As String
  170. Dim DefaultBackgroundColor As Long
  171. Dim DefaultFontColor As Long
  172. Dim DefaultImageMode As Byte
  173. '----------------------------
  174. Dim multX As Single, multY As Single
  175. Private Sub ACKbuttons_Click(Index As Integer)
  176. Dim I As Integer
  177. VDT.Vform.Cls
  178. Select Case Index
  179.     Case 0  'OK
  180.         INI.Path = UserPath & MySystem
  181.         INI.Section = VDT.DesktopList.Text
  182.         INI.Key = "BGimage"
  183.         INI.Value = SelectedFileName
  184.         INI.Key = "BGcolor"
  185.         INI.Value = SelectedBackgroundColor
  186.         INI.Key = "Fcolor"
  187.         INI.Value = SelectedFontColor
  188.         INI.Key = "Smode"
  189.         INI.Value = SelectedImageMode
  190.         VDT.FormSettings.Tag = SelectedImageMode
  191.         VDT.Vform.Tag = SelectedFileName
  192.         '--------------------------------------------
  193.         VDT.Vform.BackColor = SelectedBackgroundColor
  194.         If SelectedFileName <> "" Then ProcessFormImage SelectedImageMode, SelectedFileName
  195.         For I = 1 To VDT.IconCaption.UBound
  196.             VDT.IconCaption(I).ForeColor = SelectedFontColor
  197.             VDT.Outline(I).BorderColor = SelectedFontColor
  198.         Next I
  199.         VDT.Iselect.BorderColor = SelectedFontColor
  200.         VDT.Title.ForeColor = SelectedFontColor
  201.         Unload Me
  202.     Case 1  'Cancel
  203.         VDT.Vform.BackColor = DefaultBackgroundColor
  204.         If DefaultFileName <> "" Then ProcessFormImage DefaultImageMode, DefaultFileName
  205.         For I = 1 To VDT.IconCaption.UBound
  206.             VDT.IconCaption(I).ForeColor = DefaultFontColor
  207.             VDT.Outline(I).BorderColor = DefaultFontColor
  208.         Next I
  209.         VDT.Iselect.BorderColor = DefaultFontColor
  210.         Unload Me
  211.     Case 3  'Apply
  212.         VDT.Vform.BackColor = SelectedBackgroundColor
  213.         If SelectedFileName <> "" Then ProcessFormImage SelectedImageMode, SelectedFileName
  214.         For I = 1 To VDT.IconCaption.UBound
  215.             VDT.IconCaption(I).ForeColor = SelectedFontColor
  216.             VDT.Outline(I).BorderColor = SelectedFontColor
  217.         Next I
  218.         VDT.Iselect.BorderColor = SelectedFontColor
  219. End Select
  220.  
  221. End Sub
  222.  
  223. Private Sub BGImage_Click()
  224. Dim sOpen As SelectedFile
  225. On Error GoTo OPNerr
  226.  
  227. FileDialog.sFilter = "All Image Types( *.bmp; *.jpg; *.gif )" & Chr$(0) & "*.BMP;*.JPG;*.GIF"
  228. FileDialog.flags = OFN_FILEMUSTEXIST
  229. FileDialog.sDlgTitle = "Wallpaper"
  230. FileDialog.sInitDir = "C:\Windows"
  231. sOpen = ShowOpen(Me.hwnd)
  232. If sOpen.bCanceled Then GoTo OPNerr
  233. If Err.Number <> 32755 Then
  234.     SelectedFileName = sOpen.sLastDirectory & sOpen.sFiles(1)
  235.     If SelectedFileName <> "" Then ProcessLocalImage SelectedFileName
  236. End If
  237. OPNerr:
  238. End Sub
  239.  
  240. Private Sub BGcolor_Click()
  241. Dim sColor As SelectedColor
  242. On Error GoTo OPNerr
  243.  
  244. sColor = ShowColor(Me.hwnd)
  245. If sColor.bCanceled Then GoTo OPNerr
  246. SelectedBackgroundColor = sColor.oSelectedColor
  247. Bkgnd.BackColor = sColor.oSelectedColor
  248. If SelectedFileName <> "" Then ProcessLocalImage SelectedFileName
  249. OPNerr:
  250. End Sub
  251.  
  252. Private Sub Fcolor_Click()
  253. Dim sColor As SelectedColor
  254. On Error GoTo OPNerr
  255.  
  256. sColor = ShowColor(Me.hwnd)
  257. If sColor.bCanceled Then GoTo OPNerr
  258. SelectedFontColor = sColor.oSelectedColor
  259. Label2.ForeColor = sColor.oSelectedColor
  260. OPNerr:
  261. End Sub
  262.  
  263. Private Sub Form_Load()
  264. DefaultBackgroundColor = VDT.Vform.BackColor
  265. DefaultFontColor = VDT.IconCaption(1).ForeColor
  266. DefaultFileName = VDT.Vform.Tag
  267. '--------------------------------
  268. SelectedBackgroundColor = VDT.Vform.BackColor
  269. SelectedFontColor = VDT.IconCaption(1).ForeColor
  270. SelectedFileName = VDT.Vform.Tag
  271. '--------------------------------
  272. Bkgnd.BackColor = DefaultBackgroundColor
  273. Label2.ForeColor = DefaultFontColor
  274. '--------------------------------
  275. SelectedImageMode = Val(VDT.FormSettings.Tag)
  276. DefaultImageMode = Val(VDT.FormSettings.Tag)
  277. Option1(DefaultImageMode).Value = True
  278. '--------------------------------
  279. If SelectedFileName <> "" Then ProcessLocalImage SelectedFileName
  280. End Sub
  281. Private Sub ProcessLocalImage(mFile)
  282. On Error GoTo BGerr
  283. Dim IMGW As Integer, IMGH As Single
  284. Dim multX As Single, multY As Single
  285. Dim X As Integer, Y As Integer
  286. Dim I As Integer, J As Integer
  287.  
  288. Bkgnd.Cls: PicSize.Cls
  289. PicSize.Picture = LoadPicture(mFile)
  290. IMGW = PicSize.Width * (Bkgnd.Width / VDT.Vform.Width)
  291. IMGH = PicSize.Height * (Bkgnd.Height / VDT.Vform.Height)
  292. Select Case SelectedImageMode
  293.     Case 0    'Stretched
  294.         multX = Bkgnd.Width / IMGW
  295.         multY = Bkgnd.Height / IMGH
  296.         Bkgnd.PaintPicture PicSize.Image, 0, 0, IMGW * multX, IMGH * multY, 0, 0, PicSize.Width, PicSize.Height
  297.     Case 1    'Centered
  298.         multX = Bkgnd.Width / IMGW
  299.         multY = Bkgnd.Height / IMGH
  300.         If multX > 1 And multY > 1 Then
  301.             multX = 1: multY = 1
  302.         Else
  303.             If multX > multY Then multX = multY Else multY = multX
  304.         End If
  305.         
  306.         X = Bkgnd.Width / 2 - IMGW / 2 * multX
  307.         Y = Bkgnd.Height / 2 - IMGH / 2 * multY
  308.         Bkgnd.PaintPicture PicSize.Image, X, Y, IMGW * multX, IMGH * multY, 0, 0, PicSize.Width, PicSize.Height
  309.     Case 2    'Tiled
  310.         X = Bkgnd.Width / IMGW
  311.         Y = Bkgnd.Height / IMGH
  312.         For J = 0 To Y * IMGH Step IMGH
  313.             For I = 0 To X * IMGW Step IMGW
  314.                Bkgnd.PaintPicture PicSize.Image, I, J, IMGW, IMGH, 0, 0, PicSize.Width, PicSize.Height
  315.             Next I
  316.         Next J
  317. End Select
  318. Exit Sub
  319. BGerr:
  320. MsgBox "Unable to Locate Background Image file:" & vbCrLf & vbCrLf _
  321. & SelectedFileName, vbExclamation, "File Not Found"
  322. End Sub
  323.  
  324. Private Sub Bkgnd_Click()
  325. RemoveBackgroundImage
  326. End Sub
  327.  
  328. Private Sub Bkgnd_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  329. DetectBackgroundImage Bkgnd
  330. End Sub
  331.  
  332. Private Sub Label2_Click()
  333. RemoveBackgroundImage
  334. End Sub
  335.  
  336. Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  337. DetectBackgroundImage Label2
  338. End Sub
  339.  
  340. Private Sub Option1_Click(Index As Integer)
  341. SelectedImageMode = Index
  342. If SelectedFileName <> "" Then ProcessLocalImage SelectedFileName
  343. End Sub
  344. Private Sub ProcessFormImage(Smode As Byte, mFile As String)
  345. On Error GoTo BGerr
  346. Dim multX As Single, multY As Single
  347. Dim X As Integer, Y As Integer
  348. Dim I As Integer, J As Integer
  349.  
  350. PicSize.Picture = LoadPicture(mFile)
  351. Select Case Smode
  352.     Case 0    'Stretched
  353.         multX = VDT.Vform.Width / PicSize.Width
  354.         multY = VDT.Vform.Height / PicSize.Height
  355.         VDT.Vform.PaintPicture PicSize.Image, 0, 0, PicSize.Width * multX, PicSize.Height * multY, 0, 0, PicSize.Width, PicSize.Height
  356.     Case 1    'Centered
  357.         multX = VDT.Vform.Width / PicSize.Width
  358.         multY = VDT.Vform.Height / PicSize.Height
  359.         If multX > 1 And multY > 1 Then
  360.             multX = 1: multY = 1
  361.         Else
  362.             If multX > multY Then multX = multY Else multY = multX
  363.         End If
  364.         
  365.         X = VDT.Vform.Width / 2 - PicSize.Width eight / PicSize.Height
  366.  w;l     tegerltX
  367.         End If
  368.         
  369.         X = VDT.Vform.WSr(Smode As Bytede
  370.     Casease Smode
  371.   =sease Smode
  372.   =gnd.lo
  373.   =g4Pwt----------------------------------------------------------------------------------Picture(mFi   N8i-------------Picture(mFi   N8i------tX------d.PaintPictunht"   I----------Picture(mFi   N8i------tX--Vform.BackColor
  374. DefaulDT.eG0hen multX = multY Else multY = muliiS---Picture(mFi   Nture(slectedF muliiS---PfaulDT.eG0hen multXs      epel2Gerr:
  375. MsgBox "Unable to Locate Backgrounable to Locate Back Locat vbCrLf & vbCro Locate 
  376.  mFile Asle Asocate Back Locat vbCrLf & vbCro Locate 
  377.  mmmmmmmmmmmmmmmmmmmmmmmmmmmm vbCrred
  378.   Date Sub Label2_Cli\Date   If m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&m2T&