Page 1 of 1

Unable to get exact width of TchartControl.

Posted: Thu Mar 12, 2009 1:06 pm
by 13052776
Hi,

I had put t chart control on a Dockable Form. with dockStyle Fill.

when I try to acess its width it returns. default width which i had set @ design time.

it doesn't returns the exact width of Control. after docking.

How evever it return exact Width in after draw and before draw event.

i am using this width for some calculations. can u please help me how can i get proper width.

Posted: Thu Mar 12, 2009 1:40 pm
by yeray
Hi Pradip,

This code seems to work fine for me here. Could you please try if it works as expected for you? Or could you please add the necessary changes to reproduce it?

Code: Select all

private void InitializeChart()
{
  chartController1.Chart = tChart1;
  tChart1.Aspect.View3D = false;

  before = tChart1.Width.ToString();

  tChart1.Dock = DockStyle.Fill;

  after = tChart1.Width.ToString();
  
  tChart1.Header.Text = "before: " + before + "   after: " + after;
}

Posted: Fri Mar 13, 2009 7:53 am
by 13052776
HI Yeray,

i tried your code but it didn't worked.
actually the Tchart is on a usercontrol and that usercontrol is used on dockable form.

Posted: Fri Mar 13, 2009 3:46 pm
by yeray
Hi Pradip,

I can't reproduce your problem. Please, could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Posted: Mon Mar 16, 2009 11:42 am
by 13052776
hi Yeray

here is the code

private void InitializeComponent()
{
this.tChart1 = new Steema.TeeChart.TChart();
this.SuspendLayout();
//
// tChart1
//
//
//
//
this.tChart1.Aspect.ZOffset = 0;
this.tChart1.Location = new System.Drawing.Point(0, 0);
this.tChart1.Name = "tChart1";
//this.tChart1.Size = new System.Drawing.Size(672, 346);

string before = tChart1.Width.ToString();
this.tChart1.Dock = System.Windows.Forms.DockStyle.Fill;
string after = tChart1.Width.ToString();
tChart1.Header.Text = "before: " + before + " after: " + after;

this.tChart1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(672, 346);
this.Controls.Add(this.tChart1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}

please let me know what is going wrong

Posted: Mon Mar 16, 2009 12:50 pm
by yeray
Hi Pradip,

Are you writing code directly to the Form1.Designer.cs?
To view the values before and after the changes, you should see them in runtime, so try the code to the Form1.cs.

Code: Select all

public Form1()
        {
            InitializeComponent();

            InitializeChart();
        }

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            string before = tChart1.Width.ToString();

            tChart1.Dock = DockStyle.Fill;

            string after = tChart1.Width.ToString();

            tChart1.Header.Text = "before: " + before + "   after: " + after; 
        }