Unable to get exact width of TchartControl.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Pradip
Newbie
Newbie
Posts: 14
Joined: Tue Mar 10, 2009 12:00 am
Contact:

Unable to get exact width of TchartControl.

Post by Pradip » Thu Mar 12, 2009 1:06 pm

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.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu Mar 12, 2009 1:40 pm

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;
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Pradip
Newbie
Newbie
Posts: 14
Joined: Tue Mar 10, 2009 12:00 am
Contact:

Post by Pradip » Fri Mar 13, 2009 7:53 am

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.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Fri Mar 13, 2009 3:46 pm

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Pradip
Newbie
Newbie
Posts: 14
Joined: Tue Mar 10, 2009 12:00 am
Contact:

Post by Pradip » Mon Mar 16, 2009 11:42 am

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

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Mar 16, 2009 12:50 pm

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; 
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply