Closed trparky closed 3 weeks ago
Hi Parky o/' yeah that has a reason: The DarkMode applied to those controls, and several others like ListView, TreeView, etc. is made thru implementation of Win32 APIs not by direct Color applying, The code you saw is to 'polish' the controls, because sometimes they have missing parts or stuff, Microsoft did not intended the controls to be themed, so we gotta have to be 'creative'. Some controls like the TabControl does required A LOT of creative thought, hehe. Still many thanks for your contribution, its appreciated. Regards.
Yeah, but in my experience, the theming without my changes don't apply properly.
oh, noone had reported a bug like that, could you please share an screenshot of the issue so i can replicate ?
Before my changes... After my changes...
Notice the subtle color difference. The background of the textbox is gray, it should be white when in standard mode. Also look at the button, again... the color isn't right.
i see now. ok could you please re-submit the PR and i'll just aprove it
I see... Would you please also post the screenshots for the dark mode, to check if there is any difference too?
And then there's how the datagrid doesn't get themed properly. Case in point... With my fixes... it's not perfect but it's getting there.
Is it really the older DataGrid? I use only DataGridView's and those seem always OK, at least in the dark mode.
maybe it has something to do with the odd rows coloring the Example Form, has a Datagrid with all default properties, and it works just fine
Older datagrid? I didn't know there was a new one. I'm just using the one that the .NET Framework came with.
This is snippets of the pertinent code for my DataGrid.
Me.Logs.AllowUserToAddRows = False
Me.Logs.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Logs.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight
Me.Logs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.Logs.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.ColTime, Me.colServerTime, Me.colLogType, Me.ColIPAddress, Me.ColHostname, Me.ColRemoteProcess, Me.ColLog, Me.ColAlerts})
Me.Logs.ContextMenuStrip = Me.LogsMenu
Me.Logs.Location = New System.Drawing.Point(12, 52)
Me.Logs.Name = "Logs"
Me.Logs.ReadOnly = True
Me.Logs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.Logs.Size = New System.Drawing.Size(1151, 369)
Me.Logs.TabIndex = 18
Public Function MakeDataGridRow(serverTimeStamp As Date, dateObject As Date, strTime As String, strSourceAddress As String, strHostname As String, strRemoteProcess As String, strLog As String, strLogType As String, boolAlerted As Boolean, strRawLogText As String, strAlertText As String, ByRef dataGrid As DataGridView) As MyDataGridViewRow
Using MyDataGridViewRow As New MyDataGridViewRow
With MyDataGridViewRow
.CreateCells(dataGrid)
.Cells(ColumnIndex_ComputedTime).Value = strTime
.Cells(ColumnIndex_ComputedTime).Style.Alignment = DataGridViewContentAlignment.MiddleCenter
.Cells(ColumnIndex_LogType).Value = If(String.IsNullOrWhiteSpace(strLogType), "", strLogType)
.Cells(ColumnIndex_IPAddress).Value = strSourceAddress
.Cells(ColumnIndex_RemoteProcess).Value = If(String.IsNullOrWhiteSpace(strRemoteProcess), "", strRemoteProcess)
.Cells(ColumnIndex_Hostname).Value = If(String.IsNullOrWhiteSpace(strHostname), "", strHostname)
.Cells(ColumnIndex_ServerTime).Value = ToIso8601Format(serverTimeStamp)
.Cells(ColumnIndex_LogText).Value = strLog
.Cells(ColumnIndex_Alerted).Value = If(boolAlerted, "Yes", "No")
.Cells(ColumnIndex_Alerted).Style.Alignment = DataGridViewContentAlignment.MiddleCenter
.Cells(ColumnIndex_Alerted).Style.WrapMode = DataGridViewTriState.True
.DateObject = dateObject
.BoolAlerted = boolAlerted
.ServerDate = serverTimeStamp
.RawLogData = strRawLogText
.AlertText = strAlertText
.MinimumHeight = GetMinimumHeight(strLog, ParentForm.Logs.DefaultCellStyle.Font, ParentForm.ColLog.Width)
If My.Settings.font IsNot Nothing Then
.Cells(ColumnIndex_ComputedTime).Style.Font = My.Settings.font
.Cells(ColumnIndex_LogType).Style.Font = My.Settings.font
.Cells(ColumnIndex_IPAddress).Style.Font = My.Settings.font
.Cells(ColumnIndex_RemoteProcess).Style.Font = My.Settings.font
.Cells(ColumnIndex_Hostname).Style.Font = My.Settings.font
.Cells(ColumnIndex_LogText).Style.Font = My.Settings.font
.Cells(ColumnIndex_Alerted).Style.Font = My.Settings.font
.Cells(ColumnIndex_ServerTime).Style.Font = My.Settings.font
End If
End With
Return MyDataGridViewRow
End Using
End Function
Logs.Rows.Add(SyslogParser.MakeDataGridRow(serverTimeStamp:=Now,
dateObject:=Now,
strTime:=Nothing,
strSourceAddress:=Nothing,
strHostname:="Local",
strRemoteProcess:=Nothing,
strLog:="Loading data and populating data grid... Please Wait.",
strLogType:="Informational, Local",
boolAlerted:=False,
strRawLogText:=Nothing,
strAlertText:=Nothing,
dataGrid:=Logs)
)
I meant the very old DataGrid as opposed to the newer DataGridView. I am not sure which one you use. You mentioned DataGrid multiple times but your code snippet refers, for example, DataGridViewRow... So it is confusing for me
DataGrid, DataGridView, same thing to me.
System.Windows.Forms.DataGridView
I found that the code wasn't applying colors to buttons, textboxes, and datagridrows properly so I fixed it.