home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l407 / 5.ddi / COLORPAL.FR_ / COLORPAL.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  10.9 KB  |  331 lines

  1. VERSION 2.00
  2. Begin Form ColorPalette 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "IconWorks Color Palette"
  6.    ClipControls    =   0   'False
  7.    FontBold        =   -1  'True
  8.    FontItalic      =   0   'False
  9.    FontName        =   "System"
  10.    FontSize        =   9.75
  11.    FontStrikethru  =   0   'False
  12.    FontUnderline   =   0   'False
  13.    Height          =   3495
  14.    HelpContextID   =   1906
  15.    Icon            =   COLORPAL.FRX:0000
  16.    Left            =   1530
  17.    LinkMode        =   1  'Source
  18.    LinkTopic       =   "Form1"
  19.    MaxButton       =   0   'False
  20.    MinButton       =   0   'False
  21.    ScaleHeight     =   3090
  22.    ScaleWidth      =   5670
  23.    Top             =   1590
  24.    Width           =   5790
  25.    Begin PictureBox Pic_ColorPalette 
  26.       BackColor       =   &H00FFFFFF&
  27.       ForeColor       =   &H00000000&
  28.       Height          =   1005
  29.       Left            =   60
  30.       ScaleHeight     =   975
  31.       ScaleWidth      =   5520
  32.       TabIndex        =   0
  33.       Top             =   60
  34.       Width           =   5550
  35.    End
  36.    Begin HScrollBar Scrl_RGB 
  37.       Height          =   300
  38.       Index           =   0
  39.       LargeChange     =   10
  40.       Left            =   750
  41.       Max             =   255
  42.       TabIndex        =   4
  43.       Top             =   1260
  44.       Width           =   2550
  45.    End
  46.    Begin TextBox Txt_RGB 
  47.       BackColor       =   &H00FFFFFF&
  48.       ForeColor       =   &H00000000&
  49.       Height          =   300
  50.       Index           =   0
  51.       Left            =   3330
  52.       TabIndex        =   7
  53.       Top             =   1260
  54.       Width           =   480
  55.    End
  56.    Begin PictureBox Pic_RGB 
  57.       Height          =   420
  58.       Index           =   0
  59.       Left            =   3840
  60.       ScaleHeight     =   390
  61.       ScaleWidth      =   555
  62.       TabIndex        =   15
  63.       Top             =   1260
  64.       Width           =   585
  65.    End
  66.    Begin PictureBox Pic_SelectedColor 
  67.       Height          =   630
  68.       Left            =   4455
  69.       ScaleHeight     =   600
  70.       ScaleWidth      =   1170
  71.       TabIndex        =   10
  72.       Top             =   1440
  73.       Width           =   1200
  74.    End
  75.    Begin PictureBox Pic_RGB 
  76.       Height          =   420
  77.       Index           =   1
  78.       Left            =   3840
  79.       ScaleHeight     =   390
  80.       ScaleWidth      =   555
  81.       TabIndex        =   16
  82.       Top             =   1680
  83.       Width           =   585
  84.    End
  85.    Begin HScrollBar Scrl_RGB 
  86.       Height          =   300
  87.       Index           =   1
  88.       LargeChange     =   10
  89.       Left            =   750
  90.       Max             =   255
  91.       TabIndex        =   5
  92.       Top             =   1740
  93.       Width           =   2550
  94.    End
  95.    Begin TextBox Txt_RGB 
  96.       BackColor       =   &H00FFFFFF&
  97.       ForeColor       =   &H00000000&
  98.       Height          =   300
  99.       Index           =   1
  100.       Left            =   3315
  101.       TabIndex        =   8
  102.       Top             =   1740
  103.       Width           =   480
  104.    End
  105.    Begin PictureBox Pic_RGB 
  106.       Height          =   420
  107.       Index           =   2
  108.       Left            =   3840
  109.       ScaleHeight     =   390
  110.       ScaleWidth      =   555
  111.       TabIndex        =   17
  112.       Top             =   2100
  113.       Width           =   585
  114.    End
  115.    Begin HScrollBar Scrl_RGB 
  116.       Height          =   300
  117.       Index           =   2
  118.       LargeChange     =   10
  119.       Left            =   750
  120.       Max             =   255
  121.       TabIndex        =   6
  122.       Top             =   2220
  123.       Width           =   2550
  124.    End
  125.    Begin TextBox Txt_RGB 
  126.       BackColor       =   &H00FFFFFF&
  127.       ForeColor       =   &H00000000&
  128.       Height          =   300
  129.       Index           =   2
  130.       Left            =   3330
  131.       TabIndex        =   9
  132.       Top             =   2220
  133.       Width           =   480
  134.    End
  135.    Begin PictureBox Pic_NearestSolidColor 
  136.       Height          =   630
  137.       Left            =   4455
  138.       ScaleHeight     =   600
  139.       ScaleWidth      =   1170
  140.       TabIndex        =   11
  141.       Top             =   2445
  142.       Width           =   1200
  143.    End
  144.    Begin CommandButton Cmd_OK 
  145.       Cancel          =   -1  'True
  146.       Caption         =   "&Done"
  147.       Height          =   360
  148.       Left            =   75
  149.       TabIndex        =   12
  150.       Top             =   2640
  151.       Width           =   1305
  152.    End
  153.    Begin CommandButton Cmd_Set 
  154.       Caption         =   "&Set"
  155.       Default         =   -1  'True
  156.       Height          =   360
  157.       Left            =   1560
  158.       TabIndex        =   13
  159.       Top             =   2640
  160.       Width           =   1305
  161.    End
  162.    Begin CommandButton Cmd_Reset 
  163.       Caption         =   "&Reset"
  164.       Height          =   360
  165.       Left            =   3045
  166.       TabIndex        =   14
  167.       Top             =   2640
  168.       Width           =   1305
  169.    End
  170.    Begin Label Lbl_RGBValues 
  171.       AutoSize        =   -1  'True
  172.       BackColor       =   &H00FFFFFF&
  173.       Caption         =   "RGB Values"
  174.       ForeColor       =   &H00000000&
  175.       Height          =   195
  176.       Left            =   3360
  177.       TabIndex        =   20
  178.       Top             =   1065
  179.       Width           =   1035
  180.    End
  181.    Begin Label Lbl_SelectedColor 
  182.       BackColor       =   &H00FFFFFF&
  183.       Caption         =   "Selected Color"
  184.       ForeColor       =   &H00000000&
  185.       Height          =   375
  186.       Left            =   4605
  187.       TabIndex        =   18
  188.       Top             =   1065
  189.       Width           =   975
  190.    End
  191.    Begin Label Lbl_Red 
  192.       BackColor       =   &H00FFFFFF&
  193.       Caption         =   "Red"
  194.       FontBold        =   -1  'True
  195.       FontItalic      =   0   'False
  196.       FontName        =   "System"
  197.       FontSize        =   9.75
  198.       FontStrikethru  =   0   'False
  199.       FontUnderline   =   0   'False
  200.       ForeColor       =   &H000000FF&
  201.       Height          =   300
  202.       Left            =   120
  203.       TabIndex        =   1
  204.       Top             =   1260
  205.       Width           =   600
  206.    End
  207.    Begin Label Lbl_Green 
  208.       BackColor       =   &H00FFFFFF&
  209.       Caption         =   "Green"
  210.       FontBold        =   -1  'True
  211.       FontItalic      =   0   'False
  212.       FontName        =   "System"
  213.       FontSize        =   9.75
  214.       FontStrikethru  =   0   'False
  215.       FontUnderline   =   0   'False
  216.       ForeColor       =   &H00008000&
  217.       Height          =   300
  218.       Left            =   120
  219.       TabIndex        =   2
  220.       Top             =   1740
  221.       Width           =   600
  222.    End
  223.    Begin Label Lbl_NearestSolidColor 
  224.       BackColor       =   &H00FFFFFF&
  225.       Caption         =   "Nearest Solid Color"
  226.       ForeColor       =   &H00000000&
  227.       Height          =   375
  228.       Left            =   4605
  229.       TabIndex        =   19
  230.       Top             =   2070
  231.       Width           =   975
  232.    End
  233.    Begin Label Lbl_Blue 
  234.       BackColor       =   &H00FFFFFF&
  235.       Caption         =   "Blue"
  236.       FontBold        =   -1  'True
  237.       FontItalic      =   0   'False
  238.       FontName        =   "System"
  239.       FontSize        =   9.75
  240.       FontStrikethru  =   0   'False
  241.       FontUnderline   =   0   'False
  242.       ForeColor       =   &H00FF0000&
  243.       Height          =   300
  244.       Left            =   120
  245.       TabIndex        =   3
  246.       Top             =   2220
  247.       Width           =   600
  248.    End
  249. DefInt A-Z
  250. Sub Cmd_OK_Click ()
  251.     Unload ColorPalette
  252. End Sub
  253. Sub Cmd_Reset_Click ()
  254.     Initialize_RGB_Scrollbars
  255. End Sub
  256. ' Places new color into the ColorPalette and Refreshes
  257. ' the color palettes so the new colors are displayed.
  258. Sub Cmd_Set_Click ()
  259.     ' Create the Long Integer RGB value from the RGB scrollbar values, and
  260.     ' place into Color array.
  261.     Colors(ColorIndex) = RGB(Scrl_RGB(0).Value, Scrl_RGB(1).Value, Scrl_RGB(2).Value)
  262.     ' Display new ColorPalette
  263.     Display_Color_Palette Pic_ColorPalette
  264.     Display_Color_Palette Editor.Pic_ColorPalette
  265. End Sub
  266. Sub Display_New_Color_And_Elements (FirstElement, LastElement)
  267.     Pic_SelectedColor.BackColor = RGB(Scrl_RGB(0).Value, Scrl_RGB(1).Value, Scrl_RGB(2).Value)
  268.     ' Since some of the drawing tools cannot use dithered colors,
  269.     ' the nearest Solid color to the actual color selected is also displayed.
  270.     Pic_NearestSolidColor.BackColor = GetNearestColor(Hdc, Pic_SelectedColor.BackColor)
  271.     For I = FirstElement To LastElement
  272.         Txt_RGB(I).Text = Format$(Scrl_RGB(I).Value)
  273.         Pic_RGB(I).BackColor = Scrl_RGB(I).Value * 2 ^ (I * 8)
  274.     Next I
  275. End Sub
  276. Sub Form_Load ()
  277.     ColorPaletteLoaded = True
  278.     Remove_Items_From_Sysmenu ColorPalette
  279. End Sub
  280. ' Extracts the Red, Green, and Blue elements from the
  281. ' selected ColorPalette color and assigns these values to the
  282. ' corresponding RGB Scrollbars.
  283. Sub Initialize_RGB_Scrollbars ()
  284.     Scrl_RGB(RED_ELEMENT).Value = Colors(ColorIndex) And &HFF&
  285.     Scrl_RGB(GREEN_ELEMENT).Value = (Colors(ColorIndex) \ 2 ^ 8) And &HFF&
  286.     Scrl_RGB(BLUE_ELEMENT).Value = (Colors(ColorIndex) \ 2 ^ 16) And &HFF&
  287.     ' Display the numerical and visual values for these Elements
  288.     ' along with the selected color and its nearest solid color.
  289.     Display_New_Color_And_Elements RED_ELEMENT, BLUE_ELEMENT
  290. End Sub
  291. Sub Pic_ColorPalette_GotFocus ()
  292.     ' Pic_ColorPalette has a tabindex of 0, thus it receives the focus
  293.     ' first when the ColorPalette form gains the focus, so Initialization
  294.     ' is done here.
  295.     Initialize_RGB_Scrollbars
  296. End Sub
  297. Sub Pic_ColorPalette_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  298.     ' Check if Mouse Coordinates are within the ColorPalette
  299.     If (X >= 0) And (X <= 16) And (Y >= 0) And (Y <= 3) Then
  300.         ' Set the Editor's current drawing color to selected color.
  301.         Update_Mouse_Colors Button, X, Y
  302.         ' Display selected color and elements of selected color
  303.         Initialize_RGB_Scrollbars
  304.     End If
  305. End Sub
  306. Sub Pic_ColorPalette_Paint ()
  307.     Display_Color_Palette Pic_ColorPalette
  308. End Sub
  309. Sub Scrl_RGB_Change (Index As Integer)
  310.     Display_New_Color_And_Elements Index, Index
  311. End Sub
  312. Sub Txt_RGB_Change (Index As Integer)
  313.     If Val(Txt_RGB(Index).Text) > 255 Then
  314.         ' A value outside the value RGB range was entered.  Beep
  315.         ' to signal the user, then reset value to previous value
  316.         Beep
  317.         Txt_RGB(Index).Text = Format$(Scrl_RGB(Index).Value)
  318.     Else
  319.         ' A valid RGB value was entered so reset corresponding RGB Scrollbar
  320.         Scrl_RGB(Index).Value = Val(Txt_RGB(Index).Text)
  321.     End If
  322.     Txt_RGB(Index).SelStart = Len(Txt_RGB(Index).Text)
  323. End Sub
  324. Sub Txt_RGB_KeyPress (Index As Integer, KeyAscii As Integer)
  325.     ' Do not allow any characters other than 0123456789 to be entered.
  326.     If ((KeyAscii < 48) Or (KeyAscii > 57)) And (KeyAscii <> 8) Then
  327.         KeyAscii = 0
  328.         Beep
  329.     End If
  330. End Sub
  331.