Unfortunately I'm not using GanttView and do not have the time in the schedule to switch to it. I'm using an UltraChart with the type set to ChartType.GanttChart. I need to make style changes to the GanttItems in the chart that appear to be possible because I see them in GanttView. I'm assume GanttView is some sort of MVC pattern class combining GanttItems, a chart of GanttChart type and a grid.
I've figured out how to change a particular GanttItem's color by accessing the PE property. However how do I change the style of a particular GanttItem in the GanttChart? I'd like to distinguish the GanttItem from other items. Here's an example image of the GanttView with GanttItems with the style I want to use:
http://ko.infragistics.com/community/blogs/taz_abdeali/archive/2010/03/22/windows-forms-2010-1-launched.aspx
and
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/Win_Whats_New_New_WinGanttView_Control.html
Rather than make a separate post, since my next question is related, how do I change the highlight color of a GanttItem when I mouse over it? I don't see a field in the PaintElement corresponding to the item's style.
Thanks!
Craig
You are correct, it must be other settings of the GanttChart that is preventing this. Excellent observation.
I changed the fill color to Pink and added the handler to my program and all GanttItems were drawn in pink--the mouse is not even in the chart. I tweaked some of my chart settings (in the chart wizard) to match your example code and still all items were drawn in pink.
Is there another way to do this? Is there an API call to set the highlight color or a setting on the GanttItem PaintElement (PE property) ?
I appreciate your efforts on this Georgi. This small presentation details are import.
Georgi,
GanttItem is an Infragistics class representing one bar in a UltraChart of type GanttChart. See
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.UltraWinChart.v11.2~Infragistics.UltraChart.Data.GanttItem.html
Quite right, it does appear to work for you. But when I used your code, it colored all GantItems red (see your code above). I'll examine this further and get back to you.
Hello Craig,
Could you please explain what do you mean with " GanttItems ". If you implement the mentioned code into my sample, I think that you will acheive desired behavior. There are different approaches to solve this task. You could use the mentioned event or method, or if you want to could use your own custum Primitives
csmith0651 said:The approach above changes the of all GanttItems in the chart
Let me know if you have any further questions.
Regards
For those reading, if you want to change the color of a particular GanttItem you do not need to use this event. You can merely set the PE for the specific GanttItem:
GanttItem task = scheduleSeries.Items.Add(name);
....
task.PE = new PaintElement(Color.Red);
This allows you to set a specific color for each GanttItem in the chart.
Close but not exactly what I wanted. If you go back to my question you'll see I need to change the *highlight* color when I mouse over any GanttItem. The approach above changes the of all GanttItems in the chart. There is the virtual Highlight method of the Primitive class:
Highlight(SceneGraph scene, Color outlineColor, Color fillColor)
However this just implements the effect of highlighting--the drawing of a similarly shaped object over the primitive but with the highlight properties from the PE. I only want to trigger this on mouseover. Looking at the events associated with a chart, MouseEnter seems appropriate, there doesn't seem to be a way to restrict it particular items within the GanttChart -- e.g. the GanttItems.
Any further ideas are appreciated.
but they are not accessible to do protection levels. What public APIs are available to change the mouse over highlight color for a particular GanttItem? Or, if we continue to use this approach, is there a value in ChartDrawItemEventArgs that indicates that this event fired due to the user moving the mouse over the primitive?