Need help in SelectExt method.
Moderators: SDS, support, admin
Need help in SelectExt method.
<font face="Trebuchet MS">Good day. I trying to select an entity in my MouseMove() method, unfortunately, I found that, sometime, the SelectExt return null, even though there is line or entity under the mouse's cursor. Below are the sample.dxf, and the source code to reproduce the problem i faced.
Steps to reproduce:
[1] Run the code, and you will see the application show up.
[2] Try to move your mouse cursor, and you will found it work, by seeing the application's caption text showing "Entity selected".
[3] Scroll the horizontal scrollbar to the rightmost, and scroll the vertical scrollbar down right to the bottom.
[4] You might still find it work, when you move your cursor hover the line.
[5] Now, try to scroll your vertical scrollbar to the up-most.
[6] You should find that now the it select nothing when your mouse hover the line, and the caption text showing "Entity Not found!" .</font id="Trebuchet MS">
I would be glad if anyone could help me on this. Thanks in all advance.
DXF file (sample.dxf) to download : http://www.mediafire.com/?0ysepdtmt00
Steps to reproduce:
[1] Run the code, and you will see the application show up.
[2] Try to move your mouse cursor, and you will found it work, by seeing the application's caption text showing "Entity selected".
[3] Scroll the horizontal scrollbar to the rightmost, and scroll the vertical scrollbar down right to the bottom.
[4] You might still find it work, when you move your cursor hover the line.
[5] Now, try to scroll your vertical scrollbar to the up-most.
[6] You should find that now the it select nothing when your mouse hover the line, and the caption text showing "Entity Not found!" .</font id="Trebuchet MS">
I would be glad if anyone could help me on this. Thanks in all advance.
DXF file (sample.dxf) to download : http://www.mediafire.com/?0ysepdtmt00
Code: Select all
using System;
using System.Drawing;
using System.Windows.Forms;
using CADImport;
using CADImport.FaceModule;
namespace SelectEntity
{
public class Form1 : Form
{
private CADImage cadDrawing;
private PictureBox pictureBox = new PictureBox();
public Form1()
{
CADImportFace.EntityPropertyGrid = new PropertyGrid();
<font color="green">// Set the windows size, and allow scrollbar.</font id="green">
this.AutoScroll = true;
this.Size = new Size(200, 200);
<font color="green">// Create a picture box to draw the CAD Drawing.</font id="green">
pictureBox.Size = new Size(400, 400);
pictureBox.Paint += new PaintEventHandler(pictureBox_Paint);
pictureBox.MouseMove += new MouseEventHandler(pictureBox_MouseMove);
this.Controls.Add(pictureBox);
<font color="green"> // Load the CAD Drawing.</font id="green">
cadDrawing = new CADImage();
cadDrawing.LoadFromFile("sample.dxf");
cadDrawing.SelectionMode = SelectionEntityMode.Enabled;
cadDrawing.UseDoubleBuffering = false;
}
private void pictureBox_MouseMove(object sender, MouseEventArgs e)
{
<font color="green">// Display the result in application's caption text.</font id="green">
if (cadDrawing.SelectExt(e.X, e.Y, true) != null)
this.Text = "Entity Selected";
else
this.Text = "Entity Not found!";
}
private void pictureBox_Paint(object sender, PaintEventArgs e)
{
cadDrawing.Draw(e.Graphics, new RectangleF(0, 0, 400, 400));
}
}
}
Hello!
Would you please send us to support@cadsofttools.com the whole demo with CADImport.dll that is used?
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Would you please send us to support@cadsofttools.com the whole demo with CADImport.dll that is used?
Sergey.
Please post questions to the forum or write to support@cadsofttools.com