Jump to content

~ Hide ListView Border?! (SOLVED)


EKY32
 Share

Recommended Posts

Is it available to hide a GuiCtrlCreateListView Borders?

Posted Image

I hope so :(

Thank you.

Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Link to comment
Share on other sites

Look this example:

; My example Gui


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListviewConstants.au3>
#include <GuiListView.au3>
Global Const $COLOR_GUI = 0x494E49
Global Const $COLOR_TEXT = 0xE6ECE0

$GUI = GUICreate('test', 300, 500, -1, -1)
GUISetBkColor($COLOR_GUI)

; ======================= ListView 1
; everything works, except:
; how can I remove the border (or change it's color)

$listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 280, 200, $LVS_NOCOLUMNHEADER)
GUICtrlSetBkColor(-1, $COLOR_GUI)
GUICtrlSetColor(-1, $COLOR_TEXT)
$item1 = GUICtrlCreateListViewItem("test|col22|col23", $listview)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
_GUICtrlListView_SetColumnWidth($listview, 0, 90)
_GUICtrlListView_SetColumnWidth($listview, 1, 90)

; ======================= ListView 2
; You needed to add a few styles <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$hListView = _GUICtrlListView_Create($GUI, "", 10, 220, 280, 200, BitOr($LVS_REPORT,$LVS_NOCOLUMNHEADER))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetBkColor($hListView, $COLOR_GUI)
_GUICtrlListView_SetTextBkColor($hListView, $COLOR_GUI)
_GUICtrlListView_SetTextColor($hListView, $COLOR_TEXT)

_GUICtrlListView_AddColumn($hListView, "Col 1", 90)
_GUICtrlListView_AddColumn($hListView, "Col 2", 90)
_GUICtrlListView_AddColumn($hListView, "Col 3", 90)

_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

GUISetState(@SW_SHOW)

While 1
$eMSG = GUIGetMsg()
Switch $eMSG
Case -3
Exit
EndSwitch
WEnd
Link to comment
Share on other sites

Only need put away part of code.

I put some comments read it.

; My example Gui



#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListviewConstants.au3>
#include <GuiListView.au3>Global Const $COLOR_GUI = 0x494E49
Global Const $COLOR_TEXT = 0xE6ECE0

$GUI = GUICreate('test', 300, 500, -1, -1)
;GUISetBkColor($COLOR_GUI)

; ======================= ListView 1
; everything works, except:
; how can I remove the border (or change it's color)

$listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 280, 200, $LVS_NOCOLUMNHEADER)
GUICtrlSetBkColor(-1, $COLOR_GUI)
GUICtrlSetColor(-1, $COLOR_TEXT)
$item1 = GUICtrlCreateListViewItem("test|col22|col23", $listview)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
_GUICtrlListView_SetColumnWidth($listview, 0, 90)
_GUICtrlListView_SetColumnWidth($listview, 1, 90)

; ======================= ListView 2
; You needed to add a few styles <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<



$hListView = _GUICtrlListView_Create($GUI, "", 10, 220, 280, 200, BitOr($LVS_REPORT,$LVS_NOCOLUMNHEADER)) ; If you want to show the colunms header put away "$LVS_NOCOLUMNHEADER"
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)

;>>>>>>> Only put away this part.
;_GUICtrlListView_SetBkColor($hListView, $COLOR_GUI)
;_GUICtrlListView_SetTextBkColor($hListView, $COLOR_GUI)
;_GUICtrlListView_SetTextColor($hListView, $COLOR_TEXT)

_GUICtrlListView_AddColumn($hListView, "Col 1", 90)
_GUICtrlListView_AddColumn($hListView, "Col 2", 90)
_GUICtrlListView_AddColumn($hListView, "Col 3", 90)

_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

GUISetState(@SW_SHOW)

While 1
$eMSG = GUIGetMsg()
Switch $eMSG
Case -3
Exit
EndSwitch
WEnd

Regards

Link to comment
Share on other sites

Actually all you need to do is take WS_EX_STATICEDGE out of the extended styles, so this works:

GUICreate("Test", 400, 400)

$listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 280, 200, -1, 0)
GUICtrlCreateListViewItem("test|col22|col23", $listview)
GUICtrlCreateListViewItem("item1|col12|col13", $listview)
GUICtrlCreateListViewItem("item3|col32|col33", $listview)

GUISetState()

While GUIGetMsg() <> -3
    Sleep(10)
WEnd

Edit: Can I also recommend you get hold of a program called ControlSpy made by microsoft. Incredibly useful for playing around with control styles and messages.

Edited by Mat
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...