Hola.
Consulta, en un combobox duro y puro (no xbrowse) puedo darle un margen entre cada linea mas grande dle que tiene por defecto?
gracias.
espacio entre lineas en COMBOBox
- goosfancito
- Posts: 1955
- Joined: Fri Oct 07, 2005 7:08 pm
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: espacio entre lineas en COMBOBox
Code: Select all | Expand
@ r,c COMBOBOX .............. ITEMHEIGHT <nHeight>
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- goosfancito
- Posts: 1955
- Joined: Fri Oct 07, 2005 7:08 pm
Re: espacio entre lineas en COMBOBox
y ya que estamos para el listbox?nageswaragunupudi wrote:Code: Select all | Expand
@ r,c COMBOBOX .............. ITEMHEIGHT <nHeight>
Grazie Mille
Re: espacio entre lineas en COMBOBox
as i can say you need enable Ownerdraw
Code: Select all | Expand
oCombo_left := TComboBox() :new( 0, 0,, acItem, 90, 300, oMain,,,, BFcolor, BGcolor, .T., oFontDefault,,,, .F., acBitmaps )
oCombo_left:nDropWidth( 200 )
oCombo_left:nItemHeight( 32 )
oCombo_left:nSelectionHeight( 32 )
oCombo_left:Select( DriveNumber( cStartLeft ) )
oCombo_left:bCloseUp := { || Change2Drive( oCombo_left:GetSelText(), 1 ) }
oCombo_left:lIncSearch := .T.
// use Codeblock to call Method
oCombo_left:bOwnerDraw := { | a, b, c, d | oExpl_Left:DoMyComBo( a, b, c, d, @acItem, @acType, @acBitmaps, oCombo_left ) }
Code: Select all | Expand
METHOD DoMyComBo()
LOCAL WinDir := GETENV( "Windir" )
LOCAL cPara := ""
LOCAL cAlign := nOr( DT_LEFT, DT_NOPREFIX )
LOCAL nIcoHandle := 0
LOCAL nSize := 32
LOCAL ii, nCount, xPara
LOCAL oSelf
LOCAL nIdCtl
LOCAL oStruc
LOCAL nPointer
LOCAL acItem, acType, cItemText, oObj
LOCAL CtlType
LOCAL CtlID
LOCAL itemID
LOCAL itemAction
LOCAL itemState
LOCAL hwndItem
LOCAL hDC
LOCAL aRect
LOCAL nLeft
LOCAL nTop
LOCAL nRight
LOCAL nBottom
LOCAL itemData
LOCAL cDLL
LOCAL hModule
LOCAL nResID
LOCAL aBitmaps, hBitMap, acBitmaps
LOCAL OldAt := - 1
LOCAL BrushHiBack := CreateSolidBrush( BFcolor )
LOCAL BrushSysColor := CreateSolidBrush( BGcolor )
LOCAL aGrad := { ;
{ .5, BFcolor, BGcolor }, ;
{ .6, BGcolor, BFcolor }, ;
{ .1, BFcolor, BGcolor }, ;
}
nCount := PCOUNT()
FOR ii := 1 TO nCount
xPara := PValue( ii )
DO CASE
CASE ii = 1
oSelf := xPara
CASE ii = 2
nIdCtl := xPara
CASE ii = 3
oStruc := xPara
CASE ii = 4
nPointer := xPara
CASE ii = 5
acItem := xPara
CASE ii = 6
acType := xPara
CASE ii = 7
acBitmaps := xPara
CASE ii = 8
oObj := xPara
IF !EMPTY( oObj )
IF VALTYPE( oObj ) = "O"
OldAt := oObj:nAt
ENDIF
ENDIF
ENDCASE
NEXT
CtlType := oStruc:CtlType
CtlID := oStruc:CtlID
itemID := oStruc:itemID
itemAction := oStruc:itemAction
itemState := oStruc:itemState
hwndItem := oStruc:hwndItem
hDC := oStruc:hDC
aRect := oStruc:aRect
itemData := oStruc:itemData
nTop := aRect[ 1 ]
nLeft := aRect[ 2 ]
nBottom := aRect[ 3 ]
nRight := aRect[ 4 ]
IF CtlType = ODT_COMBOBOX .OR. CtlType = ODT_LISTBOX // .AND. CtlID =
SetBkMode( hDC, 1 ) // TRANSPARENT =1 OPAQUE =2
DO CASE
CASE itemAction = ODA_SELECT
FillRect( hDC, aRect, BrushSysColor )
SetTextColor( hDC, BFcolor )
CASE itemAction = ODA_DRAWENTIRE
IF OldAt = itemID + 1 .AND. oObj:IsOpen()
OldAt = - 1
IF BGColor = 256 * 256 * 256 - 1 // 16777215
// Msginfo("white")
FillRect( hDC, aRect, COLOR_MENUHILIGHT + 1 )
SetTextColor( hDC, GetSysColor( COLOR_MENU ) )
ELSE
GradientFill( hDC, aRect[ 1 ], aRect[ 2 ], aRect[ 3 ] - 1, aRect[ 4 ], aGrad, .t. )
SetTextColor( hDC, BFcolor )
ENDIF
ELSE
FillRect( hDC, aRect, BrushSysColor )
SetTextColor( hDC, BFcolor )
ENDIF
CASE itemAction = ODA_FOCUS
IF BGColor = 256 * 256 * 256 - 1 // 16777215
FillRect( hDC, aRect, COLOR_MENUHILIGHT + 1 )
SetTextColor( hDC, GetSysColor( COLOR_MENU ) )
ELSE
GradientFill( hDC, aRect[ 1 ], aRect[ 2 ], aRect[ 3 ] - 1, aRect[ 4 ], aGrad, .t. )
SetTextColor( hDC, BFcolor )
ENDIF
ENDCASE
// use System Icon from DLL
IF lUse_IconEx = .T.
cDLL := WinDir + "\System32\imageres.dll"
DO CASE
CASE acType[ itemID + 1 ] = DRIVE_UNKNOWN
nResID := 75
CASE acType[ itemID + 1 ] = DRIVE_NO_ROOT_DIR
nResID := 32
CASE acType[ itemID + 1 ] = DRIVE_REMOVABLE
IF SUBSTR( acItem[ itemID + 1 ], 1, 1 ) $ "AB"
nResID := 23
ELSE
cDLL := WinDir + "\System32\DDORes.dll"
nResID := 2389
ENDIF
CASE acType[ itemID + 1 ] = DRIVE_FIXED
IF SUBSTR( acItem[ itemID + 1 ], 1, 2 ) = "C:"
nResID := 36
ELSE
nResID := 32
ENDIF
CASE acType[ itemID + 1 ] = DRIVE_REMOTE
nResID := 33
CASE acType[ itemID + 1 ] = DRIVE_CDROM
nResID := 30
CASE acType[ itemID + 1 ] = DRIVE_RAMDISK
nResID := 34
ENDCASE
hModule := GetModuleHandle( cDLL )
IF hModule == 0
hModule := LoadLibrary( cDLL )
ENDIF
nIcoHandle := LOADIMAGERESICON( hModule, nResID, 32 )
DrawIconEx( hDC, ;
nTop - 4, ;
nLeft, ;
nIcoHandle, ;
nSize, ;
nSize, ;
0, ; // _In_ UINT istepIfAniCur,
0, ; // _In_opt_ HBRUSH hbrFlickerFreeDraw,
nOr( DI_NORMAL ) ) // _In_ UINT diFlags
DestroyIcon( nIcoHandle )
FreeLibrary( hModule )
ELSE // use Resource
aBitmaps := FW_ReadImage( nil, acBitmaps[ itemID + 1 ], { nSize - 2, nSize - 2 }, .F. )
hBitMap := aBitmaps[ 1 ]
DrawBitmap( hDC, hBitMap, nTop + 3, nLeft, nSize - 3, nSize - 6 )
PalBmpFree( aBitmaps )
DeleteObject( hBitMap )
ENDIF
nLeft += 32 + 4
cItemText := acItem[ itemID + 1 ]
DrawText( hDC, ;
cItemText, ;
{ nTop + 4, nLeft, nBottom, nRight }, ;
cAlign )
ENDIF
DeleteObject( BrushHiBack )
DeleteObject( BrushSysColor )
RETURN .T.
greeting,
Jimmy
Jimmy
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: espacio entre lineas en COMBOBox
You asked for combox, I answered for combobox.goosfancito wrote:y ya que estamos para el listbox?nageswaragunupudi wrote:Code: Select all | Expand
@ r,c COMBOBOX .............. ITEMHEIGHT <nHeight>
Grazie Mille
Do you want for listbox?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- goosfancito
- Posts: 1955
- Joined: Fri Oct 07, 2005 7:08 pm
Re: espacio entre lineas en COMBOBox and ListBox
yes, in listbox too. gracias.