搜索框 样式效果如下图
右侧按钮需要关联一个ImageList,以指定按钮的图片。
复制如下代码到Delphi IDE的窗体上粘贴即可看到按钮 (学习大师原创代码,请勿转载)
object edtSearchInput: TscGPEdit
Left = 376
Top = 18
Width = 397
Height = 45
AutoSize = False
Options.NormalColor = clWhite
Options.HotColor = clWindow
Options.FocusedColor = clWindow
Options.DisabledColor = clWindow
Options.NormalColorAlpha = 255
Options.HotColorAlpha = 255
Options.FocusedColorAlpha = 255
Options.DisabledColorAlpha = 150
Options.FrameNormalColor = clWindow
Options.FrameHotColor = clWindow
Options.FrameFocusedColor = clWindow
Options.FrameDisabledColor = clBlack
Options.FrameWidth = 1
Options.FrameNormalColorAlpha = 100
Options.FrameHotColorAlpha = 255
Options.FrameFocusedColorAlpha = 255
Options.FrameDisabledColorAlpha = 50
Options.FontNormalColor = clBlack
Options.FontHotColor = clBlack
Options.FontFocusedColor = clBlack
Options.FontDisabledColor = clBlack
Options.ShapeFillGradientAngle = 90
Options.ShapeCornerRadius = 20
Options.ShapeStyle = scgpessRoundedRect
Options.ScaleFrameWidth = False
Options.StyleColors = True
ContentMarginLeft = 25
ContentMarginRight = 5
ContentMarginTop = 11
ContentMarginBottom = 13
PromptText = #25628#32034#22995#21517#8230
PromptTextColor = 13421772
Transparent = True
LeftButton.Kind = scgpebCustom
LeftButton.Enabled = True
LeftButton.Visible = False
LeftButton.ImageIndex = -1
LeftButton.ImageHotIndex = -1
LeftButton.ImagePressedIndex = -1
LeftButton.RepeatClick = False
LeftButton.RepeatClickInterval = 200
LeftButton.ShowHint = False
LeftButton.GlyphColor = clWindowText
LeftButton.GlyphColorAlpha = 180
LeftButton.GlyphColorHotAlpha = 240
LeftButton.GlyphColorPressedAlpha = 150
LeftButton.GlyphThickness = 2
RightButton.Kind = scgpebCustom
RightButton.Enabled = True
RightButton.Visible = True
RightButton.ImageIndex = 0
RightButton.ImageHotIndex = 1
RightButton.ImagePressedIndex = 1
RightButton.RepeatClick = False
RightButton.RepeatClickInterval = 200
RightButton.ShowHint = False
RightButton.GlyphColor = clWindowText
RightButton.GlyphColorAlpha = 180
RightButton.GlyphColorHotAlpha = 240
RightButton.GlyphColorPressedAlpha = 150
RightButton.GlyphThickness = 3
ButtonImages = dm.img36
Text = ''
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = #24494#36719#38597#40657
Font.Style = []
Font.Quality = fqClearTypeNatural
ParentFont = False
TabOrder = 2
OnRightButtonClick = edtSearchInputRightButtonClick
OnKeyPress = edtSearchInputKeyPress
end
|