Refresh the view
Moderators: SDS, support, admin
Refresh the view
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
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
Re: Refresh the view
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)
Sergey.
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();
}
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Refresh the view
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.
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.
Re: Refresh the view
Hello!
It is necessary to use:
before creating a block and adding it.
Sergey.
It is necessary to use:
Code: Select all
this.cadImage.UseDoubleBuffering = false;
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support