Refresh the view

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
mike32m
Posts: 13
Joined: 17 Jun 2008, 16:06

Refresh the view

Post by mike32m » 17 Jul 2008, 21:25

I have done some operation by software (insert entities,blocks, ..). At the end i need a refresh to get the new Entities on the view (cadPictureBox).
I try:
this.cadPictureBox1.Invalidate();

But there is no results, nothing is changend on view.
If i change the checkboxes from the treenodes, the view is actualized correctly. I don't know where my mistake.
Or must the new entities first be painted ? ... if so, then please show me the way to do this.

Thanks a lot for helping and have a nice day ...
Mike

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Refresh the view

Post by support » 18 Jul 2008, 10:00

Hello Mike,

Here goes code example of adding an arc. It is based on Viewer demo:
private void btnAddArc_Click(object sender, System.EventArgs e)

Code: Select all

{
	if(this.cadImage == null) 
	{
		this.cadImage = new CADImage();
		this.cadImage.InitialNewImage();
		this.cadImage.UseDoubleBuffering = false;
	}            			
	this.cadImage.UseDoubleBuffering = false;

	CADArc vArc = new CADArc();

	vArc.Color = Color.Azure;
	vArc.StartAngle = 0;
	vArc.EndAngle = 180;
	vArc.Radius = 100;
			
	vArc.Loaded(this.cadImage.Converter);
	this.cadImage.Converter.OnCreate(vArc);
	this.cadImage.CurrentLayout.Entities.Add(vArc);
			
	this.cadPictBox.Invalidate();	
}
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

mike32m
Posts: 13
Joined: 17 Jun 2008, 16:06

Re: Refresh the view

Post by mike32m » 18 Jul 2008, 18:19

It sounds simple, but it isn't so. I load an DXF-file to an CADimage, I get over all layout and search for the Entities. Then i create a block for all founded entities, ...:
private void LoadDXF() {

CADImage dxfCADImage;
...
CADBlock block = new CADBlock();
block.Name = "myBlock";
foreach (CADEntity ce in dxfCADImage.Converter.Entities.AllValues) {
block.AddEntity(ce);
}

myCadImage.Converter.Blocks.Add(block);
myCadImage.Converter.OnCreate(block);
myCadImage.Converter.Loads(block);

CADInsert insert = new CADInsert();
insert.Block = block;
insert.Point = new DPoint(0,0,0);
myCadImage.Converter.Entities.Add(insert);
myCadImage.Converter.OnCreate(insert);
myCadImage.Converter.Loads(insert);

this.cadPictureBox.Invalidate();
}

This Code produced the correkt Treenode, but the new Block in not automaticly showing. First I click on TreeNode-Block or Entitiy than pictureBox refreshed.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Refresh the view

Post by support » 22 Jul 2008, 11:32

Hello!

It is necessary to use:

Code: Select all

this.cadImage.UseDoubleBuffering = false;
before creating a block and adding it.

Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

mike32m
Posts: 13
Joined: 17 Jun 2008, 16:06

Re: Refresh the view

Post by mike32m » 01 Aug 2008, 09:28

Thank, that was the problem.

Post Reply