Is there any way to delete/hide the arrow of a combo box ? Any Api's?
I need a combo box with ordinary combo features (Style-0 Dropdown combo) without drop down arrow...I don't want to use MS/Forms.20 combobox, has the same feature...
Thanks
Is there any way to delete/hide the arrow of a combo box ? Any Api's?
I need a combo box with ordinary combo features (Style-0 Dropdown combo) without drop down arrow...I don't want to use MS/Forms.20 combobox, has the same feature...
Thanks
I don't know how if you can hide that button or not, if you can get the handle to that combo button then maybe using the ShowWindow API could hide it?
Since no one else has replied yet, One way might be to put the combox inside a picbox, use API to get the size of the combos Edit box and re-size the picbox which is what I tried below.... taking for granted the 3D borders of the control are a certain size...
Code:'note: paste a combobox inside a 3D picture box. Option Explicit Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Private Sub Form_Load() ' Optional - Add some test items to combo (note: user can still use mousewheel to change values) Combo1.AddItem "A" Combo1.AddItem "B" Combo1.AddItem "C" Combo1.AddItem "D" Dim cbo_rect As RECT Dim cbo_edit As Long ' set form and picbox to pixel mode (otherwise will need to convert size values to Form/PicBox scalemodes) Me.ScaleMode = vbPixels Picture1.ScaleMode = vbPixels ' offset combobox inside picbox to hide the 3D borders Combo1.Move -2, -2 ' get handle to combo "Edit" window cbo_edit = FindWindowEx(Combo1.hwnd, 0, "Edit", vbNullString) If cbo_edit = 0 Then MsgBox "combo box Edit window not found!" Else ' get size of combo edit box GetWindowRect cbo_edit, cbo_rect ' resize picbox to combo edit size (+ offset for borders?) Picture1.Width = (cbo_rect.Right - cbo_rect.Left) + 4 Picture1.Height = (cbo_rect.Bottom - cbo_rect.Top) + 4 End If End Sub
Last edited by Edgemeal; May 10th, 2011 at 05:43 PM.
Thanks man...Not the exact code i am looking for...but still the idea is very good...
Thanks again
I have no idea why you want to do this, but you will need code like what Edgemeal posted or you can create your own dropdown control.
Please use [Code]your code goes in here[/Code] tags when posting code.
When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.
Creating A Wizard In VB.NET
Paging A Recordset
What is wrong with using On Error Resume Next
Good Article: Language Enhancements In Visual Basic 2010
Upgrading VB6 Code To VB.NET
Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked
Hack,
I need it as input control overlayed on Flexgrid -
What about this code...?
vb Code:
Private Sub CutDropDbutton(Ctl As ComboBox) Dim rect As Long rect = CreateRectRgn(100 - Ctl.Width / Screen.TwipsPerPixelX, 0, Ctl.Width / Screen.TwipsPerPixelX - 18, Ctl.Height) SetWindowRgn Ctl.hwnd, rect, True DeleteObject rect End Sub
Last edited by WeeBee; Jun 15th, 2011 at 09:35 PM.
----------------------------------------------------------------------------------------------------------------------------------------------------
"Pasting somebody's Code or Link is easy; Spending some time and addressing the real issue & putting our own ideas and codes is difficult"
----------------------------------------------------------------------------------------------------------------------------------------------------
if u put the combo inside the picbox or frame so u can hide the arrow by reducing frame/picbox width.
Seenu
If this post is useful, pls don't forget to Rate this post.
Pls mark thread as resolved once ur problem solved.
ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms
Seenu...Thanks for your suggestion...
Edgemeal already given a solid example of doing the same...but what i am thinking is, i need to put 5 combo box, means i have to put 5 picture box for nothing...
Last edited by WeeBee; Jun 16th, 2011 at 12:17 AM.
----------------------------------------------------------------------------------------------------------------------------------------------------
"Pasting somebody's Code or Link is easy; Spending some time and addressing the real issue & putting our own ideas and codes is difficult"
----------------------------------------------------------------------------------------------------------------------------------------------------
I need a combo box with ordinary combo features (Style-0 Dropdown combo)
why dont u try style =1 simple combo? is that not fine for u? if yes any reason?
Seenu
If this post is useful, pls don't forget to Rate this post.
Pls mark thread as resolved once ur problem solved.
ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms
Actually my idea is to avoid unnecessary mouse downs on the grid and my goal is to fill the grid quickly with keyboard without mouse clicks:
At key down event of combo box: sendmessage will fire the combo dropdown
At key press event of combo box: the combo will highlight the matching text from the drop down list
Previously i used fm20 combo box and it is very good at it and got some extra capabilities than normal vb combo...fm20 has some issues with re-distribution that's why i stopped using it...
style 1 simple combo is a combination of textbox + listbox - I don't want this
----------------------------------------------------------------------------------------------------------------------------------------------------
"Pasting somebody's Code or Link is easy; Spending some time and addressing the real issue & putting our own ideas and codes is difficult"
----------------------------------------------------------------------------------------------------------------------------------------------------