- This topic has 12 replies, 4 voices, and was last updated 12 years, 6 months ago by Hamilton.
-
AuthorPosts
-
August 16, 2011 at 4:09 am #34732MaklomParticipant
Hi there,
I was wondering if it is possible to control the hueoffset of progress bars within a DevXpress Grid.
What I am trying to achieve is progress results for a bunch of records that display as red or green depending on their value:
– Red = Negative Value
– Green = Positive Value
I have drawing events for the property editor event for the grid column that changes the colour of the progress bar edit according to the value being negative or positive. Unskinned the colours are fine but skinned the event is overriden and all records regardless of value are drawn the same colour.
I am using the nautilus skin with a HUE of 295 (Green).
Any help would be much appreciated!
August 18, 2011 at 1:21 pm #46431MaklomParticipantI really like the API and controls and am considering buying it but I need to know if there is a workaround to my problem first.
Any help at all would be great?
August 19, 2011 at 6:34 am #46438SupportKeymasterHello
Unfortunately it's not possible at moment, I haven't a big experience in using of DevEx components.
August 20, 2011 at 3:04 am #46466MaklomParticipantIs there any method or code example you could suggest to control the hueoffset or general colour for a control or canvas without affecting the rest of the application?
August 20, 2011 at 6:56 am #46467SupportKeymasterHello
You can change HUE or Saturation of color using these functions :
function ChangeHue(Delta : integer; Color : TColor) : TColor;
function ChangeSaturation(Color : TColor; Delta : integer) : TColor;
These functions are declared in the sGraphUtils.pas
August 20, 2011 at 7:09 am #46468MaklomParticipantHow do you use them exactly? Can you provide an example?
August 20, 2011 at 7:16 am #46469SupportKeymasterThese functions are for receiving of custom Color with changed HUE or Saturation.
Received color you can use in custom controls or elements where it's possible…
April 20, 2012 at 2:29 pm #48291carlosig03ParticipantHere's a simple solution:
a) Into aclfPainter.pas replace the procedure DrawProgressBarChunk
procedure TcxACLookAndFeelPainter.DrawProgressBarChunk(ACanvas: TcxCanvas; ARect: TRect; AVertical: Boolean);
var
i : integer;
TmpBmp, BGBmp : TBitmap;
begin
if Skinned then begin
if AVertical then
i := DefaultManager.GetSkinIndex(s_ProgressV)
else
i := DefaultManager.GetSkinIndex(s_ProgressH);
if DefaultManager.IsValidSkinIndex(i) then
begin
TmpBmp := CreateBmp32(WidthOf(ARect), HeightOf(ARect));
BGBmp := CreateBmp32(WidthOf(ARect), HeightOf(ARect));
BitBlt(BgBmp.Canvas.Handle, 0, 0, TmpBmp.Width, TmpBmp.Height, ACanvas.Handle, ARect.Left, ARect.Top, SRCCOPY);
PaintItem(i, s_Button, MakeCacheInfo(BgBmp), True, 0, Rect(0, 0, TmpBmp.Width, TmpBmp.Height), Point(0, 0), TmpBmp, DefaultManager);
if DefaultManager.Tag>0 then
sGraphUtils.ChangeBmpHUE(TmpBmp, DefaultManager.Tag);
BitBlt(ACanvas.Handle, ARect.Left, ARect.Top, TmpBmp.Width, TmpBmp.Height, TmpBmp.Canvas.Handle, 0, 0, SRCCOPY);
DefaultManager.Tag:=0;
FreeAndNil(TmpBmp);
FreeAndNil(BgBmp);
end;
end else inherited
// Old Flat style //
// if Skinned then ACanvas.FillRect(ARect, MixColors(DefaultManager.GetActiveEditFontColor, DefaultManager.GetActiveEditColor, 0.5)) else inherited;
end;
😎 The column you want an diferent color, ondraw set tag of skinmanager with Hue value
procedure TForm1.cxGrid1TableView1Column1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
begin
DataModule2.sSkinManager1.Tag := 250;
end;
and that's it.
Hope this help you.
April 20, 2012 at 4:34 pm #48296carlosig03Participantwell,
may be wath you want is this (look at the last column of attached sample)
It's WORKING
April 21, 2012 at 4:11 am #48298MaklomParticipantThat last image is exactly what I want! Thanks!
The zipped attachments don't appear to be valid however, can you post them again please?
April 26, 2012 at 3:54 am #48307MaklomParticipantCould you attach another code example that produced the attached image?
The zip files will not open when downloaded.
Thanks.
April 27, 2012 at 2:29 pm #48309carlosig03ParticipantI've downloaded the file and is opening..
Could you try again please.
May 1, 2012 at 3:57 am #48311HamiltonParticipantIt appears the attachment is a 7-zip (7z) file rather than a zip but has the wrong extension. If you google 7-zip you'll find the free program that will allow you to extract the project.
-
AuthorPosts
- You must be logged in to reply to this topic.