units(coordinate or points) in System.Drawing and System.Windows.Shapes is different?
hi, may know whether units(coordinate or points) in system.drawing , system.windows.shapes different? if yes how make them same? problem rises when use 1 canvas , 1 inkcanvas. canvas contains static rectangle drawn using these codes:
rectangle.setvalue(canvas.topproperty, 10d);
rectangle.width = 65d;
rectangle.height = 50;
rectangle.stroke = new solidcolorbrush(colors.black);
then, in oncanvasmousedown code, did checking if system.drawing.rectangle same points contains the mouseclick points. if yes, can drag system.drawing.rectangle icon inkcanvas , rectangle appear rectangle shape stroke.
private system.drawing.rectangle icon_rectangle = new system.drawing.rectangle(80, 10, 70, 50);
void oncanvasmousedown(object sender,mousebuttoneventargs e)
{
base.onmouseleftbuttondown(e);
point current_pos = e.getposition(this);
draggingicon = true;
system.window.shapes.rectangle square = new rectangle();
rectangle.setvalue(canvas.leftproperty, 80d);rectangle.setvalue(canvas.topproperty, 10d);
rectangle.width = 65d;
rectangle.height = 50;
rectangle.stroke = new solidcolorbrush(colors.black);
then, in oncanvasmousedown code, did checking if system.drawing.rectangle same points contains the mouseclick points. if yes, can drag system.drawing.rectangle icon inkcanvas , rectangle appear rectangle shape stroke.
private system.drawing.rectangle icon_rectangle = new system.drawing.rectangle(80, 10, 70, 50);
void oncanvasmousedown(object sender,mousebuttoneventargs e)
{
base.onmouseleftbuttondown(e);
point current_pos = e.getposition(this);
draggingicon = true;
if (icon_rectangle.contains((int)current_pos.x, (int)current_pos.y))
{........
}
}
however, although click in canvas area outside of icon_rectangle, seems able detect when should not. please help.
thanks in advance
}
however, although click in canvas area outside of icon_rectangle, seems able detect when should not. please help.
thanks in advance
hi nyc9,
the system.drawing.rectangle class designed used in winforms applications. should not using it in wpf application. instead should use system.windows.rect.
for future reference, best forum for general wpf questions unrelated notebook/tabletpc/umpc development one:
http://forums.microsoft.com/msdn/showforum.aspx?forumid=119
thanks,
stefan wick
microsoft - windows experience
Windows Desktop Development > Windows Desktop Development for Ink, Touch, and Tablet PC
Comments
Post a Comment