GoPalette Height Width

Hai All. I am new in GoDiagram, am using planogram. I want height and width of gaPallete controls such As Label,Textbox,etc…,. How i can proceed here. Give me suggession, Thanks in advance.

GoPalette has the same control over size and placement as any .NET control.

Ok. Each and every products varied by height,width. so i want discover the height and width of (label,note,balloon note,etc.), It have any property to find out.

oh… sorry. I see now.

GoPalette is just another GoView with a GoDocument and GoObjects. Just iterate the GoObjects in the document, and you’ll see the objects and can get their sizes.

foreach (GoObject obj in goPalette1.Document) {
  GoComment c = obj as GoComment;
  if (c != null) {
  // do something with the GoComment c
  }

// ... handle other types

  
}

Hope this will work. Thanks

Dea jake,

While i am using the above code in all time the object c return null values. so redirect me in correct path.

Well, it will be null unless the object is a GoComment… which is why I left the //… handle other types.

foreach (GoObject obj in goPalette1.Document) { GoComment c = obj as GoComment; if (c != null) { ... do something with the GoComment c ... } else { Item i = obj as Item; if (i != null) { ... you fill in the rest here, working on Item i ... } } }

Jake. Oh… sorry i made a mistake.

Now i will explain, i want set height and width to goPallete, based on which product have max hieght and widht among all products in the gopalette, by the time of gopalette loading. so, which event i use to handle and how?

You should be able to this in goView1_SessionStarted().

if I put these lines at the end of that event:

goPalette1.Height = 200;

goPalette1.Width = 200;

it works just fine.

No jake. Take a example gopalette contains label,title,note,etc., the balloon note have max height and width among all. So now i want to set the balloon note height and width to galette before it can be load. I dont prefer to set the property staticly.how and where i can proceed

Right. Do the foreach iteration (example above) and get the max width of the various objects in the doc. Then set the width of the GoPalette with that max.

Jake. Almost i got null value from the foreach iteration, give me some way to acheive this in better else give me code samples to work. Reply me urgently

Can you post the foreach code you’re trying?

private void goView1_SessionStarted(object sender, EventArgs e){
private void InitializeCatalog()
{
foreach (GoObject obj in goPalette1.Document)
{ GoComment c = obj as GoComment;
if (c != null) { } else { Item i = obj as Item; if (i != null) { } }}
}
}
}

Well, you aren’t trying to do the cast to each of the types represented in the palette. It’s null, for example, when you try to cast a GoText to GoComment.

In this case, you just want the Width of each top-level GoObject.... so I think this will get the max width of all the objects int he palette.
[code]
float maxwidth = 0;
foreach (GoObject obj in goPalette1.Document) {
GoObject o = obj as GoObject ;
if (o != null)
{
if (o.Width > maxwidth) maxwidth = o.Width;
}
}
[/code]
Jake, Now i got the result wht i am expecting. Thnk u