Forum Replies Created
-
AuthorPosts
-
SzakiLaciParticipant
Found a workaround for this:
SzakiLaciParticipant[SOLVED]
This is working perfectly fine π
Code:type
THackVirtList = class(TsVirtualImageList);
…
procedure TFrm_myForm.VSTAfterItemPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; ItemRect: TRect);
var
D: PNodeData; // pointer data for VirtualStringTree node, where you store image-indexes (D.PicIndex) and other data…
H: THackVirtList;
begin
if (csDestroying in Sender.ComponentState) then Exit;
D := VST.GetNodeData(Node);
if not Assigned(D) then Exit;if (D.WhatKind = fcsPictureNeeded) then begin
H := THackVirtList(myVirt_Image_List);
H.DoDraw(D.PicIndex, TargetCanvas, Cellrect.Left + 4, CellRect.Top + 4, 0);
// you may do here other Canvas draw-effects too
end
end;… but the new problem is >> if not the VirtualTree is drawing and calculting the image placement >> it won't shift the text to the right place, but starting from the left.
So it's painting text UNDER the image. π‘
Edit3: Solution for text alignment problem:
Code:procedure …BeforeCellPaint(…
if Column = 0 then
ContentRect.Left := 200;SzakiLaciParticipant[attachment=9363:MenuSizeDemoExe.jpg]
SzakiLaciParticipantCreated a DEMO for you:
[attachment=9362:MenuSize.zip]
It seems if I turn CustomFonts Off and On again >> font size is changing! But space for it does not. π
SzakiLaciParticipant'Support' wrote:I have sent a changed file for test by PM
– downloaded,
– uninstalled the whole component pack,
– installed (rebuilded fully!)
but it didn't made any difference! π
Also tried to add:
Code:sSkinProvider1.RepaintMenu();http://www.alphaskins.com/afaq.php#T2
If I set MenuSupport.CustomFont > False;
it is loosing the design-time setting too! (And reverting to default size=8; style=[];
… while during runtime step-by-step debugging reports the opposite!
Code:sSkinManager1.MenuSupport.Font.Size := 20;
sSkinManager1.MenuSupport.Font.Style := [fsBold, fsItalic];SzakiLaciParticipantI've found a “ready to use” method:
Code:TsVirtualImageList.DoDraw(Index: Integer; Canvas: TCanvas; X, Y: Integer; …);Why isn't that good? It seems to me it can:
– search for already cached bitmap
– handle Style
etc…
Basically I just need a “Hacked” class of it, because it's protected … but otherwise is it OK to use?
SzakiLaciParticipant'Support' wrote:function GetBitmap32(Index: Integer; Image: TBitmap; GlyphHeight: integer = 0): Boolean; // Copy an image to existing bitmap
function CreateBitmap32(Index: Integer): TBitmap;
Thanks for the quick answer! π
So basically there is no “direct” function for this (yet?),
the only way is to create a temporary bitmap >> draw it to Canvas from there >> destroy the bitmap?
This seems to me a waste of CPU resources, doing the same work twice. Isn't it?
TargetCanvas.Handle is a HDC. Isn't it possible to do something like you do while painting to a sBitBtn?
(Actually I was trying to decypher what is happening at sVclUtils.PaintControls … )
My guess is that the magic happens at line: 2971
Code:BitBlt(DC, Left + Offset.X, Top + Offset.Y, Width, Height, MemDC, Left, Top, SRCCOPY);but I'm not sure, and can not figure out: where you get the source HDC from?
________________________________
I've spent 6 hours so far with:
– reading all the FAQ
– reading all Tricks from this topics
– searching through troubleshooting topics
– analyzing your code.
I remember a few years ago somebody asked this once already but could not find that topic any more.
SzakiLaciParticipant'chemirikmohamed' wrote:Wello world, For debugging how to avoid entering procedures alphacontrols functions. Deboger just the procedures and functions that we program are mandatory to pass in the own procedures of alphacontrols. Thank you.
I always put +1 line (compiler debugging directive) into then sDefs.inc file:
Code:{$D-}…
and rebuild my project. (Project >> Build … )
Whenever you want to allow debugging again >> simply change it to D+:
Code:{ —- Definitions by Serge V. Goncharov —- }
{$D+}
{$DEFINE ACDPIAWARE} // Comment this line if support of DPI-aware mode is notSerge: you may put this trick to FAQ too.
SzakiLaciParticipant'Support' wrote:You can use the acgpDrawLine procedure which is declared in the acgpUtils unit:
Code:procedure acgpDrawLine (DC: hdc; X1, Y1, X2, Y2: Single; Color: TColor; PenWidth: Single = 1);This procedure paints antialiased lines.
Hi,
Is there any version of this that is drawing this line with alpha-channel blended? [TColor >> TsColor]
I would like to draw a big RED diagonal line on “deleted” ikons with white “shadow”.
Or is it faster if I pre-create this image and simply “overdraw” the original (=merge it) every time?
(If yes >> how?)
SzakiLaciParticipant'Support' wrote:Technically, size of font may be changed easily, but items looks very strange if size of item is still small, but font is huge. That's what I meant.
I can send you the changed unit and you can test it, if you wish.
Dear Serge, π
I don't know what you mean by “size of the item”, but I know 3 things:
– customers are calling and complaining to me about “why did I changed the fonts of the menu so small”. π
– it worked fine before (at ca. 2 year older AC version)
– if something “looks strange”, that's an opinion, but if nobody can read a text on a FullHD monitor,
because this component is overriding my setting if I turn it ON:
That IS a PROBLEM.
So, until there is no better alternative to replace the TMainMenu > it would be nice, it would WORK as it did before.
(By painting with a size we set, overlaying the window border/title.)
Here is a 3th proof, that it looked perfectly fine in 2015:
[attachment=9360:skin_bor.png]
… and, as I've stated before >> it looks great too, if I turn OFF the skin. (See prev. picture.)
SzakiLaciParticipant– Yes, it seems to be the same issue. :a1:
– It appears, VirtualTree does not supports properly 8-bit alpha channels at all.
– But how can it be, that there was no such problems with version with AC v14.19 ?
– Can you recommend a line of code that circumvents the problem?
(I'm thinking about: overriding VTV's paint procedure by calling YOURS!)
Code:procedure TBaseVirtualTree.PaintImage(var PaintInfo: TVTPaintInfo; ImageInfoIndex: TVTImageInfoIndex; DoOverlay: Boolean);
begin
… ? >> calling AlphaSkin's TsVirtualImageList's draw method
Exit;or… instead of modifying the source of it > I could disallow the component to draw the images, and use OnAfterItemPaint:
Code:procedure TForm1.VSTAfterItemPaint(Sender: TBaseVirtualTree; TargetCanvas: TCanvas; Node: PVirtualNode; ItemRect: TRect);
begin
// ???
end;(It would be a “nice” method, but would make step-by-step code debugging nearly impossible. )
SzakiLaciParticipant'Support' wrote:… But size of font in the main menu line can't be big, because size of menu items is controlled by Windows system and can't be scaled, unfortunately.
I have no idea how to change sizes of these items, because it's handled by API.
As you can see on the 2th picture, yes, it CAN be changed, if non-skinned, both design at runtime!
And YES, it can be changed if skinned at DESIGN time!
Here is the proof: (size=8>>20 + fsBold)
[attachment=9359:Size20_Bold_designTime.jpg]
Only the 4th case is not working currently: skinned + runtime.
So it CAN BE DONE! There is only a BUG that prevents to change it during runtime, while skinned.
Yes, the size of the menu-height is the only thing that can NOT be changed, but that's ok.
If you can make the font draw on top of the upper window-frame over it, that's perfectly fine.
(on the picture the first menu word: MUVELETEK should appear as MΕ°VELETEK)
At old versions it has worked this way. That means you must have changed something, that broke it.
SzakiLaciParticipantPrepared a demo to test with:
[attachment=9345:CheckBoxScale.zip]
As you can see > the problem occures only if:
– [fsBold]
– Skinned=false;
– AutoSize=true;
So the version 14.26 is better, but still not fully OK.
– are you maybe using round() at calculating the needed space but div/trunc() at wordwrap ?
– or maybe not setting style during pre-calc? ( [fsBold] … takes more space ! )
[attachment=9344:sCheckBox_too_long_autoSize2.jpg]
SzakiLaciParticipantThis is a duplicate topic of the other
Same problem still exists after 6 years (at v14.26) .
LΓ‘szlΓ³
PS: why did you delete those pictures from your server?
SzakiLaciParticipant'Support' wrote:Autosizing of checkboxes will be improved in the nearest release.
I've just realized this old topic of mine decribes the WordWrap problem much better: Link
Also created a Demo app to test with.
You may CLOSE this topic.
SzakiLaciParticipant'Support' wrote:This issue was solved in the v14.26, please check it.
Upgraded to latest vesrion, as you've recommended. (v14.26)
But it did NOT help.
[attachment=9341:SkinnedMainMenu_minimalFontChange.png]
On this picture the default size=8 Font has been set at runtime to:
Code:Size:=20;
Style:=[Bold,Italic];
ScaleBy(180,100); // 180%As you can see it is painting with ca. size=9 , non-bold, non-italic
(Non-skinned still works nicely.)
Also tried to set “CustomFont := True” at design time >> no effect
Basically: whatever I do at runtime, it does not have ANY effect on the font set at design time.
SzakiLaciParticipantPS: it would be great, if topics could be marked as “solved”.
Or at least edit the title to … [solved]
?
SzakiLaciParticipant'Support' wrote:Try this code after a virtualimagelist size changing:
Code:sMenuPicsVirtList.Loaded;Cool !!! Thank you VERY VERY much π
It has worked perfecly fine. (Never would have guest it on my own…)
:a3:
SzakiLaciParticipant'Support' wrote:Hello!
Could you make a demo, please? I'm trying to make something similar but without success..
Thanks for the quick reply!
What do you mean by “without success”?
– is it not increasing the font?
– or increasing fine and can not reproduce the problem?
(creating proper demo takes lots of time, but I will make one, if no other possiblity…)
Working still under Delphi7.
SzakiLaciParticipant'Support' wrote:Hello
You tried the 'Add' method already? Mask parameter may be empty there.
Alpha channel of bitmap will not be lost.
No, I haven't tried it π … because I knew this would happen if I try to compile:
Code:[Error] Konstansok.pas(3670): Incompatible types: 'TBitmap' and 'TBitmap32'PS: Thanks for the quick responce.
-
AuthorPosts