DevXpress Grid progress bar issue

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #34732
    Maklom
    Participant

    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!

    #46431
    Maklom
    Participant

    I 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?

    #46438
    Support
    Keymaster

    Hello

    Unfortunately it's not possible at moment, I haven't a big experience in using of DevEx components.

    #46466
    Maklom
    Participant

    Is 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?

    #46467
    Support
    Keymaster

    Hello

    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

    #46468
    Maklom
    Participant

    How do you use them exactly? Can you provide an example?

    #46469
    Support
    Keymaster

    These 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…

    #48291
    carlosig03
    Participant

    Here'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.

    #48296
    carlosig03
    Participant

    well,

    may be wath you want is this (look at the last column of attached sample)

    It's WORKING

    #48298
    Maklom
    Participant

    That last image is exactly what I want! Thanks!

    The zipped attachments don't appear to be valid however, can you post them again please?

    #48307
    Maklom
    Participant

    Could you attach another code example that produced the attached image?

    The zip files will not open when downloaded.

    Thanks.

    #48309
    carlosig03
    Participant

    I've downloaded the file and is opening..

    Could you try again please.

    #48311
    Hamilton
    Participant

    It 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.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.