- This topic has 6 replies, 3 voices, and was last updated 15 years, 3 months ago by Support.
-
AuthorPosts
-
July 9, 2009 at 1:05 pm #33103OldGrumpyParticipant
Hi there,
when skins are active, a button is sometimes noticeably larger than “normal”. And depending on the text on the button, I need to resize some buttons. So I need a way to determine how much space the caption requires to size the button accordingly, and I need to know the total size of the button to make the buttons fit nicely. I can retrieve the required space for the caption via DrawTextW API, but how can I get the total dimension of the button?
July 10, 2009 at 8:30 am #39869SupportKeymasterAlphaSkins do not changes a sizes of such controls like buttons or edits. Could you show a little demo? )
July 10, 2009 at 11:07 am #39889OldGrumpyParticipantAlphaSkins do not changes a sizes of such controls like buttons or edits. Could you show a little demo? )Some skins have thicker borders on buttons and other controls, so that buttons with only small gaps between them look like stuffed together. I'll try to make a demo to illustrate it. Furthermore, some skins (e.g. “Cold”) make the buttons look slightly trapezoidal. Basically, I am looking for a feature that tells me “this button will accept a text of x pixels width without wrap-around”. Or are these values exactly the same as for unskinned buttons? My tests with the “Cold” skin seemed to show that there are slight differences.
July 14, 2009 at 5:14 am #39916SupportKeymasterSize of button and position of content are same as in standard mode.
Maybe some visual illusion exists when skinned borders is drawn.August 4, 2009 at 12:35 pm #40161OldGrumpyParticipantYes, all borders are drawn inside the button rect. That leads me to a slightly changed question: Can I somehow determine the “client rect” of a skinned button? I mean the area that remains free for text. In some skins I have the effect that the button text reaches into the border area and that looks ugly. If I could determine the border width, I could adjust the button size accordingly to make the text fit nicely.
August 4, 2009 at 6:17 pm #40162NeonParticipantYou may tamper with sGraphUtils functions. For example, function CutText has saved me a lot of time when I tried to ellipse caption of TsTabSheet.
August 17, 2009 at 12:23 pm #40227SupportKeymasterThe SkinManager component have four functions :
CODEfunction MaskWidthTop(MaskIndex : integer) : integer;
function MaskWidthLeft(MaskIndex : integer) : integer;
function MaskWidthBottom(MaskIndex : integer) : integer;
function MaskWidthRight(MaskIndex : integer) : integer;
These functions returns a width of top, left, bottom and right borders of controls. MaskIndex may be found in AlphaControl(YourButton).SkinData.BorderIndex
So, you can use code like this :CODEwith sSkinManager1
do BtnClientRect := Rect(
MaskWidthLeft(sBtn1.Skindata.BorderIndex),
MaskWidthTop(sBtn1.Skindata.BorderIndex),
sBtn1.Width – MaskWidthRight(sBtn1.Skindata.BorderIndex),
sBtn1.Height – MaskWidthBottom(sBtn1.Skindata.BorderIndex)
);
I hope this info can help you.
If problem will not be solved please write me again. -
AuthorPosts
- You must be logged in to reply to this topic.