I don't laugh at anyone's code, but I will try to give simple pointers because you have no programming experience. That is to be expected. Most people with programming experience in Windows ask questions in developer forums. This forum is for anyone who uses PS and WinForms.
You can use PS as a batch language. PS was designed to do that to support basic user needs. WinForms is very technical but learning PS to a deeper level will always help with Forms.
Time and experience and reading the docs and books on PowerShell will get you moving along quite efficiently.
Good luck. You have a long and fun journey ahead of you.
Also, you might want to search for articles on forms design. That can save you a lot of wasted time and reduce the amount of code you write.
Checkedlistbox change color when item checked
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 20
- Last visit: Thu Mar 09, 2023 4:36 am
- Has voted: 1 time
Re: Checkedlistbox change color when item checked
do i integrate your code like that ?
Code: Select all
$checkedlistboxGroupsoption_SelectedIndexChanged={
#TODO: Place custom script here
$checkedlistboxGroupsoption_DrawItem = [System.Windows.Forms.DrawItemEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.DrawItemEventArgs]
$b = New-Object System.Drawing.SolidBrush($checkedlistboxGroupsoption.Items[$_.Index].Color)
$p = New-Object System.Drawing.PointF($_.Bounds.X, $_.Bounds.Y)
$text = $checkedlistboxGroupsoption.Items[$_.Index].Text
$_.Graphics.DrawString($text, $_.Font, $b, $p)
}
}
Re: Checkedlistbox change color when item checked
You cannot just arbitrarily copy and insert code without understanding the events and how WinForms work. You really need to learn PowerShell and WinForms.
No. What you are doing won't work. The form I posted will give you an idea, but you will have to try to understand why it is written the way it is. For that you have to understand "events" and how Windows dispatches events and how the code interacts with the event. Every event has certain things available that other events don't have.
No. What you are doing won't work. The form I posted will give you an idea, but you will have to try to understand why it is written the way it is. For that you have to understand "events" and how Windows dispatches events and how the code interacts with the event. Every event has certain things available that other events don't have.