Palette Size property seems to add a border buffer

JamesMaeding
Advisor
Advisor

Palette Size property seems to add a border buffer

JamesMaeding
Advisor
Advisor

If I do something like this:

mypalette.Size = new System.Drawing.Size(506, 100);

 

the next time I check mypalette.Size, its is 512,106.

Its adding 6 to the height and width.

 

Its not a problem, as I just account for this once known, but what is that 6 number coming from?

There is no margin or property of the palette I could see that made sense.

I basically do not want to hardcode numbers, but grab them at runtime in case other machines do not have 6.

 

thanks


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Reply
605 Views
8 Replies
Replies (8)

Balaji_Ram
Alumni
Alumni

Hi James,

 

Wish you a happy new year.

 

Sorry for the delay in getting back to you. We have just got back to office after the holidays.

 

Even if the MinimumSize of a paletteset is set using code, there is a limit on how much the paletteset can really be minimized.

 

For example, in a sample code that i tried, I had set the minimumsize to 100, 100

 

Now, if I set the Size of the paletteset to 100,100 and then check the PaletteSet size, it turns out to be 158, 106.

 

If the size of the paletteset is set to 159, 107, the size is retained without any change to it.

 

AutoCAD requires a minimum size to display the title bar buttons regardless of what we set as minimumsize.

 

In your code, does the 6 get added to all sizes of the palette set ?

 

Regards,

Balaji

 

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes

JamesMaeding
Advisor
Advisor

You are misunderstanding me, my question is how to predict that buffer number.

It seems to be 6 on my system, and must be some kind of palette property that may or may not be variable.

 

The guys that know object arx could likely say exactly where its specified, if I can get their attention.

Its not a big deal though, as I am guessing its not easy to change if it is variable, so assuming 6 is not to dangerous.

Now if that number was 42, we might be onto something!!! (HGTTG...)

 

Questions like this often reveal how green I am at windows programming, even though I am likely about as good as most people that went to school for engineering not CS.  Its tricky to get a college trained programmer that knows what to program, but easier to get an engineer that sees the gaps in tools so knows what should be written.  So you get chumps like me that cannot figure out where a window buffer is coming from 🙂


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes

owenwengerd
Advisor
Advisor

You didn't answer Balaji's question so we can't be sure, but it looks to me like you're the one misunderstanding him.

--
Owen Wengerd
ManuSoft
0 Likes

JamesMaeding
Advisor
Advisor

Hey there Owen, good to see you are lurking a bit here!

Balagi, You seem to be talking about an absolute minimum size, as if I want the palette to be a little rectangle.

Your point is useful, as I had never thought about that, but its not related to my question about a "border buffer" as in the title.

 

to answer his question - yes, 6 was always added to the size I told the palette to be.

I only tried on sizes above that minimum size he ran into.

 

This all came up because I have a button to make the palette go to some simple mode by getting smaller, then it goes back to full mode by same button.

You cannot set size to 200,200, and then check if size is 200x200, you have to check if its 206x206.

Once you know that, its easy, but will the 6 number always hold? Its rather magical....


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes

owenwengerd
Advisor
Advisor

What is the reported size if you set it to 206, 206? And if you set it to 400, 400?

 

Note that this is a diagnostic exercise, not an attempt to solve your problem. I think that is why you are confused by Balaji's post.

--
Owen Wengerd
ManuSoft
0 Likes

JamesMaeding
Advisor
Advisor

as I recall, it added 6 no matter what the specific size was I was telling it to be.

I am restructuring my prog for the moment so cannot re-test for a day or so though.

 

This buffer its adding is actually not surprising to me at all, since the palette is a container for the usercontrol.

I just do not know what object the palette derives from down deep.

I'll test more in a bit.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes

JamesMaeding
Advisor
Advisor

I see what is going on now.

First, the width behaves what I would call "properly.

You can set minwidth to 500, and width to 500 and it works. It does not add 6.

 

The height is different. If you set minheight to 200, and then set height to 200, you get 206.

This only happens at the minheight number.

If you set height to say 400, it stick, no 6 added.

 

The solution I have found is to set the minsize of the paletteset to your desired min height - 6.

Then the code setting it to desired min height does not "bump" into the minimum.

 

My title bar is on left, so very odd this only happens on height.

I think I see where Balagi was going, but the words "Even if the MinimumSize of a paletteset is set using code, there is a limit on how much the paletteset can really be minimized." sounded like some built-in minimum.

 

I'm not hitting that 158, 100 number he seemed to. I can set my minimums very low so am not sure if that plays into the mix at some level.

Luckily, I do not plan on making palettes super small.

 

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes

owenwengerd
Advisor
Advisor

There are some oddities with the border, but I can't give you a definitive answer about why you're getting those results. You also have to beware of floating vs. docked differences. Given the pitiful documentation you really have to just test and carefully confirm your assumptions, then do what it takes to make it work.

--
Owen Wengerd
ManuSoft
0 Likes