From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

create tank in form c#

Hi all

 

I create a Tank control  in my Window Form but de Fill Area donsn't  reflect the Value of de Tank, Can Any body Helpme please ?

 

 

 

private void Form1_Load(object sender, EventArgs e)
{
NationalInstruments.UI.WindowsForms.Tank bat1 = new NationalInstruments.UI.WindowsForms.Tank();
((System.ComponentModel.ISupportInitialize)(bat1)).BeginInit();
bat1.Name = "bat1";
bat1.Location = new System.Drawing.Point(100, 200);
bat1.Size = new System.Drawing.Size(100, 200);
bat1.ScaleVisible = true;
bat1.Visible = true;

bat1.Range = new Range(0, 20);
bat1.FillColor = Color.Red;
bat1.Value = 30;

bat1.TankStyle = TankStyle.Raised;
bat1.FillMode = NumericFillMode.ToMinimum;
bat1.FillBaseValue = 0;
bat1.FillStyle = FillStyle.Solid;
this.Controls.Add(bat1);
this.Refresh();

 


tank.png
}

0 Kudos
Message 1 of 6
(6,294 Views)

Your range is 0 to 20, but your value is 30.

0 Kudos
Message 2 of 6
(6,292 Views)

It donsn't matter the value, it does not change, I've tried value=5, value=8, etc.. but it never chenge

0 Kudos
Message 3 of 6
(6,289 Views)

I am not sure why you are using

((System.ComponentModel.ISupportInitialize)(bat1)).BeginInit();

 but when I comment it out, I see a tank that is filled with red.

 

I am using Measurement Studio 2010 with C# 2010 Express.

 

 

0 Kudos
Message 4 of 6
(6,265 Views)

I took this line from a example, I commented out this line worked,  thanks very much.

 

0 Kudos
Message 5 of 6
(6,255 Views)

There are several examples installed by default.

You should view them to see how to use Measurement Studio properly.

 

 

0 Kudos
Message 6 of 6
(6,251 Views)