You must write a control by yourself in VB,but you don't need to do like this in Delphi.

解决方案 »

  1.   

    在UserControl中加入类型为OLE_COLOR的属性,例如:Public TestColor As OLE_COLOR
      

  2.   

    可以用API函数ChooseColor()来实现.
    函数声明如下:
    Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As ChooseColor) As LongType ChooseColor
         lStructSize As Long
         hwndOwner As Long
         hInstance As Long
         rgbResult As Long
         lpCustColors As String
         flags As Long
         lCustData As Long
         lpfnHook As Long
         lpTemplateName As String
    End Type调用语句段:Dim cc As ChooseColor
    cc.lStructSize = Len(cc)
    cc.hwndOwner = Me.hWnd
    cc.hInstance = App.hInstance
    cc.flags = 0
    cc.lpCustColors = String$(16 * 4, 0)
    rtn = ChooseColor(cc)
    If rtn >= 1 Then
       Colourpreview.BackColor = cc.rgbResult
       Colour.Text = "Custom Colour is: " & cc.rgbResult
    Else
       Colour.Text = "Cancel Was Pressed"
    End If
      

  3.   

    unl的说法是最好的,在定义属性时,你这样定义:Dim m_YourColor As OLE_COLOR
    Public Property Get YourColor() As OLE_COLOR    YourColor = m_YourColor
    End PropertyPublic Property Let YourColor(ByVal New_YourColor OLE_COLOR)
        m_YourColor = New_YourColor
        PropertyChanged "YourColor"
    End Property
    你就可以获得色彩属性框了
      

  4.   

    呵呵,你们要的东西在我的主页上
    http://thousandvb.yeah.net
    我的原作,QQColorSelector
    愿意的话看一看界面,这里<a href="http://qianqian.363.net/qqsoft/colorview.htm" target="_blank">看一下什么样子</a>
      

  5.   

    可能是我没有说清楚:
    我需要的不是设计的时候弹出OLE_COLOR窗口,而是在使用的时候用户可以调出,通过可
    视化的情况选择颜色。就如同qianqian的控件一样,很不错,我很想知道编写要领是什么,可否赐教?