Kujo

Forum Replies Created

Viewing 3 posts - 41 through 43 (of 43 total)
  • Author
    Posts
  • in reply to: CheckBox Glyph in TsDBGrid #48103
    Kujo
    Participant
      'Support' wrote:

      Hello!

      A small demo with sources can help to help you more faster. 🙂

      I will make a test-application now with your code and I will write a result here soon.

      After several checks, the following code works for me even if I don't know if this is the right way (AC is a very powerful package but there are too many undocumented units and procedures/functions).

      Code:
      procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
      var
      GlyphSize : TSize;
      GlyphIndex : Integer;
      GlyphState : integer;
      TempBmp : TBitmap;
      Position : TPoint;

      begin
      if sSkinManager1.Active and (Length(sSkinManager1.ma) > 0) then begin
      GlyphIndex := sSkinManager1.ConstData.RadioButtonChecked;
      if GlyphIndex > -1 then begin
      GlyphState := 0; // 0, 1, 2
      GlyphSize.cx := WidthOf(sSkinManager1.ma[GlyphIndex].R) div sSkinManager1.ma[GlyphIndex].ImageCount;
      GlyphSize.cy := HeightOf(sSkinManager1.ma[GlyphIndex].R) div (sSkinManager1.ma[GlyphIndex].MaskType + 1);
      Position := Point(Rect.Left + (WidthOf(Rect) – GlyphSize.cx) div 2,
      Rect.Top + (HeightOf(Rect) – GlyphSize.cy) div 2);

      // Fill the bitmap with the same portion of the background where the Glyph will be placed
      TempBmp := CreateBmp32(GlyphSize.cx, GlyphSize.cy);
      BitBlt(TempBmp.Canvas.Handle, 0, 0, TempBmp.Width, TempBmp.Height,
      StringGrid1.Canvas.Handle, Position.X, Position.Y, SRCCOPY);

      DrawSkinGlyph(TempBmp, Point(0, 0), GlyphState, 1, sSkinManager1.ma[GlyphIndex], MakeCacheInfo(TempBmp));

      BitBlt(StringGrid1.Canvas.Handle, Position.x, Position.y,
      TempBmp.Width, TempBmp.Height, TempBmp.Canvas.Handle, 0, 0, SRCCOPY);

      FreeAndNil(TempBmp);
      end;
      end;
      end;

      There is a better method ?

      Best regards.

      in reply to: CheckBox Glyph in TsDBGrid #48079
      Kujo
      Participant
        'Kujo' wrote:

        Hello to all,

        I'm a new user and I have the same problem (not only related to grids) with all skins: sometimes the background is fuchsia, sometimes is white but it is never transparent.

        I also tried to use different code (see below) but the result is the same

        Code:
        var
        GlyphIndex: Integer;
        TempBmp: TBitmap;
        GlyphSize: TSize;

        begin
        GlyphIndex := sSkinManager1.GetMaskIndex(sSkinManager1.ConstData.IndexGLobalInfo, s_GLobalInfo, s_RadioButtonChecked);
        if GlyphIndex > -1 then
        begin
        GlyphSize.cx := WidthOf(sSkinManager1.ma[GlyphIndex].R) div sSkinManager1.ma[GlyphIndex].ImageCount;
        GlyphSize.cy := HeightOf(sSkinManager1.ma[GlyphIndex].R) div (sSkinManager1.ma[GlyphIndex].MaskType + 1);
        TempBmp := CreateBmp32(GlyphSize.cx, GlyphSize.cy);
        DrawSkinGlyph(TempBmp, Point(0, 0), 1, 1, sSkinManager1.ma[GlyphIndex], MakeCacheInfo(TempBmp));
        BitBlt(Self.Canvas.Handle, 50, 50, GlyphSize.cx, GlyphSize.cy, TempBmp.Canvas.Handle, 0, 0, SRCCOPY);
        FreeAndNil(TempBmp);
        end;
        end;

        Thanks for any help.

        Hello,

        no one can help here ?

        in reply to: CheckBox Glyph in TsDBGrid #48067
        Kujo
        Participant

          Hello to all,

          I'm a new user and I have the same problem (not only related to grids) with all skins: sometimes the background is fuchsia, sometimes is white but it is never transparent.

          I also tried to use different code (see below) but the result is the same

          Code:
          var
          GlyphIndex: Integer;
          TempBmp: TBitmap;
          GlyphSize: TSize;

          begin
          GlyphIndex := sSkinManager1.GetMaskIndex(sSkinManager1.ConstData.IndexGLobalInfo, s_GLobalInfo, s_RadioButtonChecked);
          if GlyphIndex > -1 then
          begin
          GlyphSize.cx := WidthOf(sSkinManager1.ma[GlyphIndex].R) div sSkinManager1.ma[GlyphIndex].ImageCount;
          GlyphSize.cy := HeightOf(sSkinManager1.ma[GlyphIndex].R) div (sSkinManager1.ma[GlyphIndex].MaskType + 1);
          TempBmp := CreateBmp32(GlyphSize.cx, GlyphSize.cy);
          DrawSkinGlyph(TempBmp, Point(0, 0), 1, 1, sSkinManager1.ma[GlyphIndex], MakeCacheInfo(TempBmp));
          BitBlt(Self.Canvas.Handle, 50, 50, GlyphSize.cx, GlyphSize.cy, TempBmp.Canvas.Handle, 0, 0, SRCCOPY);
          FreeAndNil(TempBmp);
          end;
          end;

          Thanks for any help.

        Viewing 3 posts - 41 through 43 (of 43 total)