0

I have a scheduler control. The appointment and statuses are mapped with a SQL database. I would like to know how I have to store the brushes for each status.

According to https://supportcenter.devexpress.com/ticket/details/t1110967/appointment-status-brush-mapping-for-brushtype-brush this is possible. Only I can't figure out how. For the coloring of the status it's quite simple, but I would like to have a brush for each status.

Bjorn Meijer
  • 21
  • 1
  • 5

1 Answers1

0

I figured it out with the following code. I made a table with the following columns:

  • statusId (type is integer)
  • Description (type is text)
  • BrushType (type is text)
  • ForeColor (type is text)
  • BackColor (type is text)

I created a dataset and populated the above columns into the dataset. After that I declared the fore- and backcolor for the brushes as Color. For the simplicity I only used a HatchBrush for this example, so I didn't need the Brushtype from the dataset.

Than I iterated trough each row of the dataset with the appointment statusses and set the right brush for each status.

    Dim ForeColor as Color
    Dim BackColor as Color
    Dim statuses = New BindingList(Of StatusClass)
    Dim appointmentStatus = New StatusClass()
    For each row as DataRow in DataSetAppointmentStatus.AppointmentStatus
        ForeColor = Color.FromName(row("ForeColor").ToString())
        BackColor = Color.FromName(row("BackColor").ToString())
        appointmentStatus.StatusId = CInt(row("statusId").ToString())
        appointmentStatus.Brush = New HatchBrush(HatchStyle.WideUpwardDiagonal, ForeColor, BackColor)'.Red
        appointmentStatus.DisplayName = row("StatusDescription").ToString()
        appointmentStatus.MenuCaption = row("StatusDescription").ToString()
        statuses.Add(appointmentStatus)

        SchedulerDataStorage1.Statuses.Mappings.Id = "StatusId"
        SchedulerDataStorage1.Statuses.Mappings.Brush = "Brush"
        SchedulerDataStorage1.Statuses.Mappings.DisplayName = "DisplayName"
        SchedulerDataStorage1.Statuses.Mappings.MenuCaption = "MenuCaption"
        
        SchedulerDataStorage1.Statuses.DataSource = statuses
    Next
Bjorn Meijer
  • 21
  • 1
  • 5
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 13 '23 at 02:45