-
April 23rd, 2017, 09:16 AM
#1
[RESOLVED] Image on listview column header instead of text
Hello.
I'm creating a program, and I occured a problem.
At my progress I'm trying to create ListView control using Visual C++ in Visual Studio 2017 and acquire a result similar to this:
How could I insert bmp image at the column header using visual C++?
I was trying to use ImageList, but it doesn't work or maybe i did something wrong.
Could you please help me at this thing?
Greetings, Genotypek.
-
April 23rd, 2017, 09:22 AM
#2
Re: Image on listview column header instead of text
I want to notice, that this screenshot is taken also project of my program, but it's writed in AutoIT3 language.
(I don't really know how to edit my previous post, could you tell me how to do it? Am I stupid or something?)
-
April 23rd, 2017, 10:08 AM
#3
Re: Image on listview column header instead of text
Originally Posted by Genotypek
I want to notice, that this screenshot is taken also project of my program, but it's writed in AutoIT3 language.
(I don't really know how to edit my previous post, could you tell me how to do it? Am I stupid or something?)
No. Editing of posts is only allowed after several posts have been made.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 23rd, 2017, 10:17 AM
#4
Re: Image on listview column header instead of text
Originally Posted by Genotypek
How could I insert bmp image at the column header using visual C++?
I was trying to use ImageList, but it doesn't work or maybe i did something wrong.
You may want to show your code so we could better see/understand what and why you did wrong.
Victor Nijegorodov
-
April 23rd, 2017, 01:05 PM
#5
Re: Image on listview column header instead of text
I found a solution by myself.
Code:
this->GUI_ListView_Ruch = ( gcnew System::Windows::Forms::ListView() );
this->GUI_ListView_Ruch_Typ = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_Interwal = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_DataWyslania = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_DataDotarcia = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_ZWioski = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_XCelu = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_YCelu = ( gcnew System::Windows::Forms::ColumnHeader() );
this->GUI_ListView_Ruch_Piki = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_spear.jpg" ) );
this->GUI_ListView_Ruch_Miecze = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_sword.jpg" ) );
this->GUI_ListView_Ruch_Topory = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_axe.jpg" ) );
this->GUI_ListView_Ruch_Luki = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_archer.jpg" ) );
this->GUI_ListView_Ruch_Zwiadowcy = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_spy.jpg" ) );
this->GUI_ListView_Ruch_LK = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_light.jpg" ) );
this->GUI_ListView_Ruch_LNK = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_marcher.jpg" ) );
this->GUI_ListView_Ruch_CK = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_heavy.jpg" ) );
this->GUI_ListView_Ruch_Tarany = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_ram.jpg" ) );
this->GUI_ListView_Ruch_Katapulty = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_catapult.jpg" ) );
this->GUI_ListView_Ruch_Rycerz = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_knight.jpg" ) );
this->GUI_ListView_Ruch_Szlachcice = ( gcnew System::Windows::Forms::ColumnHeader( L"unit_snob.jpg" ) );
And now I created ListView with jpgs in header.
But anyway, thanks for help.
Greetings, Genotypek.
-
April 23rd, 2017, 01:11 PM
#6
Re: Image on listview column header instead of text
Congrats!
However, the code you've posted has nothing to do with the native VC++. It looks like the manage one...
Victor Nijegorodov
-
April 23rd, 2017, 01:52 PM
#7
Re: Image on listview column header instead of text
[moved from the Visual C++ forum]
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|