home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / pagerocx / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-05-26  |  14.2 KB  |  475 lines

  1. VERSION 5.00
  2. Object = "{85A31727-F64B-11D2-886C-B123251DAC7D}#30.0#0"; "NPPalPager.ocx"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Test NPPalPager"
  5.    ClientHeight    =   5430
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   9300
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   5430
  11.    ScaleWidth      =   9300
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin PalPager.NPPalPager NPPalPager1 
  14.       Align           =   2  'Align Bottom
  15.       Height          =   615
  16.       Left            =   0
  17.       TabIndex        =   37
  18.       Top             =   4815
  19.       Width           =   9300
  20.       _ExtentX        =   16404
  21.       _ExtentY        =   1085
  22.       Valeur_RGB(0)   =   ""
  23.       Valeur_HEXA(0)  =   ""
  24.       Border_Style    =   3
  25.       MaxSelected     =   0
  26.       Color_Selected(0)=   0
  27.    End
  28.    Begin VB.CommandButton Command7 
  29.       Caption         =   "Open Palette avec erreur"
  30.       Height          =   255
  31.       Left            =   3480
  32.       TabIndex        =   36
  33.       Top             =   4560
  34.       Width           =   2055
  35.    End
  36.    Begin VB.CommandButton Command6 
  37.       Caption         =   "Save Palette"
  38.       Height          =   255
  39.       Left            =   1800
  40.       TabIndex        =   35
  41.       Top             =   4560
  42.       Width           =   1575
  43.    End
  44.    Begin VB.CommandButton Command5 
  45.       Caption         =   "Change Color"
  46.       Height          =   255
  47.       Left            =   120
  48.       TabIndex        =   34
  49.       Top             =   4560
  50.       Width           =   1575
  51.    End
  52.    Begin VB.CommandButton Command1 
  53.       Caption         =   "Fade Colors"
  54.       Height          =   375
  55.       Index           =   2
  56.       Left            =   3240
  57.       TabIndex        =   33
  58.       Top             =   2400
  59.       Width           =   1335
  60.    End
  61.    Begin VB.CommandButton Command1 
  62.       Caption         =   "Create Fade palette"
  63.       Height          =   375
  64.       Index           =   1
  65.       Left            =   1560
  66.       TabIndex        =   32
  67.       Top             =   2400
  68.       Width           =   1575
  69.    End
  70.    Begin VB.CommandButton Command4 
  71.       Caption         =   "Rechercher"
  72.       Height          =   375
  73.       Left            =   7320
  74.       TabIndex        =   22
  75.       Top             =   2400
  76.       Width           =   1935
  77.    End
  78.    Begin VB.Frame Frame2 
  79.       Caption         =   "Rechercher:"
  80.       Height          =   1935
  81.       Left            =   7320
  82.       TabIndex        =   15
  83.       Top             =   360
  84.       Width           =   1935
  85.       Begin VB.TextBox Text3 
  86.          Height          =   285
  87.          Index           =   2
  88.          Left            =   1200
  89.          TabIndex        =   21
  90.          Top             =   1440
  91.          Width           =   495
  92.       End
  93.       Begin VB.TextBox Text3 
  94.          Height          =   285
  95.          Index           =   1
  96.          Left            =   720
  97.          TabIndex        =   20
  98.          Top             =   1440
  99.          Width           =   495
  100.       End
  101.       Begin VB.TextBox Text3 
  102.          Height          =   285
  103.          Index           =   0
  104.          Left            =   240
  105.          TabIndex        =   18
  106.          Top             =   1440
  107.          Width           =   495
  108.       End
  109.       Begin VB.TextBox Text2 
  110.          Height          =   285
  111.          Left            =   240
  112.          TabIndex        =   16
  113.          Text            =   "&H000000"
  114.          Top             =   480
  115.          Width           =   1455
  116.       End
  117.       Begin VB.Label Label4 
  118.          Alignment       =   2  'Center
  119.          Caption         =   "OU"
  120.          BeginProperty Font 
  121.             Name            =   "MS Sans Serif"
  122.             Size            =   8.25
  123.             Charset         =   0
  124.             Weight          =   700
  125.             Underline       =   0   'False
  126.             Italic          =   0   'False
  127.             Strikethrough   =   0   'False
  128.          EndProperty
  129.          Height          =   255
  130.          Left            =   240
  131.          TabIndex        =   23
  132.          Top             =   900
  133.          Width           =   1455
  134.       End
  135.       Begin VB.Label Label3 
  136.          Caption         =   "Valeur RGB:"
  137.          Height          =   255
  138.          Index           =   1
  139.          Left            =   240
  140.          TabIndex        =   19
  141.          Top             =   1200
  142.          Width           =   1455
  143.       End
  144.       Begin VB.Label Label3 
  145.          Caption         =   "Valeur Hexa:"
  146.          Height          =   255
  147.          Index           =   0
  148.          Left            =   240
  149.          TabIndex        =   17
  150.          Top             =   240
  151.          Width           =   1455
  152.       End
  153.    End
  154.    Begin VB.Frame Frame1 
  155.       Caption         =   "Entr
  156. es de la palette active:"
  157.       Height          =   1575
  158.       Left            =   120
  159.       TabIndex        =   11
  160.       Top             =   2880
  161.       Width           =   9135
  162.       Begin VB.ListBox List5 
  163.          Height          =   1035
  164.          Index           =   2
  165.          Left            =   7080
  166.          TabIndex        =   26
  167.          Top             =   480
  168.          Width           =   735
  169.       End
  170.       Begin VB.ListBox List5 
  171.          Height          =   1035
  172.          Index           =   1
  173.          Left            =   6360
  174.          TabIndex        =   25
  175.          Top             =   480
  176.          Width           =   735
  177.       End
  178.       Begin VB.ListBox List5 
  179.          Height          =   1035
  180.          Index           =   0
  181.          Left            =   5640
  182.          TabIndex        =   24
  183.          Top             =   480
  184.          Width           =   735
  185.       End
  186.       Begin VB.ListBox List4 
  187.          Height          =   1035
  188.          Left            =   2880
  189.          TabIndex        =   14
  190.          Top             =   480
  191.          Width           =   2655
  192.       End
  193.       Begin VB.CommandButton Command3 
  194.          Caption         =   "GetEntries"
  195.          Height          =   975
  196.          Left            =   7920
  197.          TabIndex        =   13
  198.          Top             =   360
  199.          Width           =   1095
  200.       End
  201.       Begin VB.ListBox List3 
  202.          Height          =   1035
  203.          Left            =   120
  204.          TabIndex        =   12
  205.          Top             =   480
  206.          Width           =   2655
  207.       End
  208.       Begin VB.Label Label5 
  209.          Caption         =   "Blue:"
  210.          Height          =   255
  211.          Index           =   4
  212.          Left            =   7080
  213.          TabIndex        =   31
  214.          Top             =   240
  215.          Width           =   735
  216.       End
  217.       Begin VB.Label Label5 
  218.          Caption         =   "Green:"
  219.          Height          =   255
  220.          Index           =   3
  221.          Left            =   6360
  222.          TabIndex        =   30
  223.          Top             =   240
  224.          Width           =   735
  225.       End
  226.       Begin VB.Label Label5 
  227.          Caption         =   "Red:"
  228.          Height          =   255
  229.          Index           =   2
  230.          Left            =   5640
  231.          TabIndex        =   29
  232.          Top             =   240
  233.          Width           =   735
  234.       End
  235.       Begin VB.Label Label5 
  236.          Caption         =   "HEXA:"
  237.          Height          =   255
  238.          Index           =   1
  239.          Left            =   2880
  240.          TabIndex        =   28
  241.          Top             =   240
  242.          Width           =   2655
  243.       End
  244.       Begin VB.Label Label5 
  245.          Caption         =   "RGB:"
  246.          Height          =   255
  247.          Index           =   0
  248.          Left            =   120
  249.          TabIndex        =   27
  250.          Top             =   240
  251.          Width           =   2655
  252.       End
  253.    End
  254.    Begin VB.CommandButton Command2 
  255.       Caption         =   "GetInfo"
  256.       Height          =   375
  257.       Left            =   4680
  258.       TabIndex        =   10
  259.       Top             =   2400
  260.       Width           =   2535
  261.    End
  262.    Begin VB.TextBox Text1 
  263.       BeginProperty Font 
  264.          Name            =   "Courier New"
  265.          Size            =   9
  266.          Charset         =   0
  267.          Weight          =   400
  268.          Underline       =   0   'False
  269.          Italic          =   0   'False
  270.          Strikethrough   =   0   'False
  271.       EndProperty
  272.       Height          =   1935
  273.       Left            =   4680
  274.       MultiLine       =   -1  'True
  275.       ScrollBars      =   3  'Both
  276.       TabIndex        =   9
  277.       Top             =   360
  278.       Width           =   2535
  279.    End
  280.    Begin VB.ListBox List2 
  281.       Height          =   645
  282.       Index           =   2
  283.       Left            =   3240
  284.       TabIndex        =   5
  285.       Top             =   1680
  286.       Width           =   1335
  287.    End
  288.    Begin VB.ListBox List2 
  289.       Height          =   645
  290.       Index           =   1
  291.       Left            =   1680
  292.       TabIndex        =   4
  293.       Top             =   1680
  294.       Width           =   1335
  295.    End
  296.    Begin VB.ListBox List2 
  297.       Height          =   645
  298.       Index           =   0
  299.       Left            =   120
  300.       TabIndex        =   3
  301.       Top             =   1680
  302.       Width           =   1335
  303.    End
  304.    Begin VB.CommandButton Command1 
  305.       Caption         =   "Create palette"
  306.       Height          =   375
  307.       Index           =   0
  308.       Left            =   120
  309.       TabIndex        =   2
  310.       Top             =   2400
  311.       Width           =   1335
  312.    End
  313.    Begin VB.ListBox List1 
  314.       Height          =   1035
  315.       Left            =   120
  316.       TabIndex        =   0
  317.       Top             =   360
  318.       Width           =   4455
  319.    End
  320.    Begin VB.Label Label2 
  321.       Caption         =   "Bleu:"
  322.       Height          =   255
  323.       Index           =   2
  324.       Left            =   3240
  325.       TabIndex        =   8
  326.       Top             =   1440
  327.       Width           =   1335
  328.    End
  329.    Begin VB.Label Label2 
  330.       Caption         =   "Vert:"
  331.       Height          =   255
  332.       Index           =   1
  333.       Left            =   1680
  334.       TabIndex        =   7
  335.       Top             =   1440
  336.       Width           =   1335
  337.    End
  338.    Begin VB.Label Label2 
  339.       Caption         =   "Rouge:"
  340.       Height          =   255
  341.       Index           =   0
  342.       Left            =   120
  343.       TabIndex        =   6
  344.       Top             =   1440
  345.       Width           =   1335
  346.    End
  347.    Begin VB.Label Label1 
  348.       Caption         =   "Couleurs s
  349. lectionn
  350.       Height          =   255
  351.       Left            =   120
  352.       TabIndex        =   1
  353.       Top             =   120
  354.       Width           =   4455
  355.    End
  356. Attribute VB_Name = "Form1"
  357. Attribute VB_GlobalNameSpace = False
  358. Attribute VB_Creatable = False
  359. Attribute VB_PredeclaredId = True
  360. Attribute VB_Exposed = False
  361. Private Sub Command1_Click(Index As Integer)
  362. Dim Rouge(256) As Byte, Vert(256) As Byte, Bleu(256) As Byte
  363. Select Case Index
  364. Case 0
  365. If List1.ListCount < 1 Then Exit Sub
  366. For i = 0 To List1.ListCount - 1
  367. Rouge(i) = List2(0).List(i)
  368. Vert(i) = List2(1).List(i)
  369. Bleu(i) = List2(2).List(i)
  370. Next i
  371. NPPalPager1.CreatePal Rouge, Vert, Bleu, List1.ListCount
  372. Case 1
  373. NPPalPager1.CreateFadePalette RGB(255, 0, 0), RGB(255, 255, 0), 255
  374. Case 2
  375. If NPPalPager1.MaxSelected <> 2 Then
  376. MsgBox "Vous devez s
  377. lectionner 2 couleurs"
  378. NPPalPager1.Refresh
  379. Exit Sub
  380. NPPalPager1.FadeColors
  381. NPPalPager1.Refresh
  382. End If
  383. End Select
  384. End Sub
  385. Private Sub Command2_Click()
  386. Dim Infos As String
  387. Text1.Text = ""
  388. Infos = "Version: " & NPPalPager1.GetInfo([Pal Version]) & vbCrLf & _
  389. "Nombre d'entr
  390. es: " & NPPalPager1.GetInfo([Pal NumEntries]) & vbCrLf & _
  391. "Taille: " & NPPalPager1.GetInfo([Pal Size]) & "Ko" & vbCrLf & _
  392. "Type Flags: " & NPPalPager1.GetInfo([Pal Flags]) & vbCrLf & _
  393. "Handle palette: " & NPPalPager1.GetInfo(Handle)
  394. Text1.Text = Infos
  395. End Sub
  396. Private Sub Command3_Click()
  397. Dim NBEntries As Integer
  398. NBEntries = NPPalPager1.GetInfo([Pal NumEntries])
  399. List3.Clear
  400. List4.Clear
  401. For i = 0 To 2
  402. List5(i).Clear
  403. Next i
  404. For i = 0 To NBEntries - 1
  405. List3.AddItem NPPalPager1.GetEntries(i, RVB)
  406. List4.AddItem NPPalPager1.GetEntries(i, HEXA)
  407. List5(0).AddItem NPPalPager1.GetEntries(i, PRed)
  408. List5(1).AddItem NPPalPager1.GetEntries(i, PGreen)
  409. List5(2).AddItem NPPalPager1.GetEntries(i, PBlue)
  410. Next i
  411. End Sub
  412. Private Sub Command4_Click()
  413. If Text3(0).Text = "" Then
  414. NPPalPager1.SearchColor Text2.Text, HEXA
  415. NPPalPager1.SearchColor RGB(Text3(0).Text, Text3(1).Text, Text3(2).Text), RVB
  416. End If
  417. NPPalPager1_Click
  418. End Sub
  419. Private Sub Command5_Click()
  420. If NPPalPager1.MaxSelected <> 1 Then
  421. MsgBox "Vous devez s
  422. lectionner 1 couleur"
  423. NPPalPager1.Refresh
  424. Exit Sub
  425. NPPalPager1.ChangeColor RGB(255, 255, 255)
  426. End If
  427. End Sub
  428. Private Sub Command6_Click()
  429. NPPalPager1.SavePalette "C:\palette.pal", PalWin
  430. End Sub
  431. Private Sub Command7_Click()
  432. NPPalPager1.Palette = "c:\esd.pal"
  433. NPPalPager1.ErrMessage = "Erreur de lecture du fichier c:\esd.pal."
  434. NPPalPager1.ErrTitle = App.EXEName
  435. End Sub
  436. Private Sub Form_Load()
  437. If Right(App.Path, 1) <> "\" Then
  438. NPPalPager1.Palette = App.Path & "\" & "logo.pal"
  439. NPPalPager1.Palette = App.Path & "logo.pal"
  440. End If
  441. End Sub
  442. Private Sub NPPalPager1_Click()
  443. List1.Clear
  444. For i = 0 To 2
  445. List2(i).Clear
  446. Next i
  447. For i = 0 To NPPalPager1.MaxSelected - 1
  448. If NPPalPager1.Valeur_INDEX(i) < 100 Then
  449. List1.AddItem "Index: " & NPPalPager1.Valeur_INDEX(i) & Chr(9) & Chr(9) & "Hex: " & NPPalPager1.Valeur_HEXA(i) & Chr(9) & "Rgb: " & NPPalPager1.Valeur_RGB(i)
  450. List1.AddItem "Index: " & NPPalPager1.Valeur_INDEX(i) & Chr(9) & "Hex: " & NPPalPager1.Valeur_HEXA(i) & Chr(9) & "Rgb: " & NPPalPager1.Valeur_RGB(i)
  451. End If
  452. List2(0).AddItem NPPalPager1.Red(i)
  453. List2(1).AddItem NPPalPager1.Green(i)
  454. List2(2).AddItem NPPalPager1.Blue(i)
  455. Next i
  456. End Sub
  457. Private Sub Text2_Click()
  458. For i = 0 To 2
  459. Text3(i).Text = ""
  460. Next i
  461. Text2.SelStart = 0
  462. Text2.SelLength = Len(Text2.Text)
  463. End Sub
  464. Private Sub Text2_GotFocus()
  465. Text2_Click
  466. End Sub
  467. Private Sub Text3_Click(Index As Integer)
  468. Text2.Text = ""
  469. Text3(Index).SelStart = 0
  470. Text3(Index).SelLength = Len(Text3(Index).Text)
  471. End Sub
  472. Private Sub Text3_GotFocus(Index As Integer)
  473. Text3_Click (Index)
  474. End Sub
  475.