Forum > Graphics

[SOLVED] SVG thumbnails

<< < (3/4) > >>

domasz:
Here's a demo with TListBox

Pe3s:
Thank you for your help :)

alaa123456789:

--- Quote from: domasz on December 11, 2023, 04:20:23 pm ---Here's a demo with TListBox

--- End quote ---
thanks for the example,what the reason that the right side of the listitem become black when we scrolldown


regards

domasz:
You can paint the whole area before drawing:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;  ARect: TRect; State: TOwnerDrawState);var bgra: TBGRABitmap;begin  bgra := ListBox1.Items.Objects[Index] as TBGRABitmap;   ListBox1.Canvas.Brush.Color := clWhite;  ListBox1.Canvas.Brush.Style:= bsSolid;  ListBox1.Canvas.FillRect(ARect);   bgra.Draw(ListBox1.Canvas, ARect.Left, ARect.Top);   ListBox1.Canvas.TextOut(ARect.Left, ARect.Top, ListBox1.Items[Index]);end;

Pe3s:
Hello, I have one more question - is it possible to make the selection also select the background under the thumbnail?


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState);var bgra: TBGRABitmap;begin  bgra := ListBox1.Items.Objects[Index] as TBGRABitmap;  if odSelected in State then  begin    ListBox1.Canvas.Brush.Color:= clRed;  end;  ListBox1.Canvas.FillRect(ARect);  bgra.Draw(ListBox1.Canvas, ARect.Left, ARect.Top);  ListBox1.Canvas.TextOut(ARect.Left + 120, ARect.Top + 44, ListBox1.Items[Index]);end;  

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version