*examples: Scribble: fixed issue with scrollbar

git-svn-id: svn://ultimatepp.org/upp/trunk@3719 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-07-31 12:28:02 +00:00
parent a4ef4118d7
commit 2594fc3006
2 changed files with 9 additions and 12 deletions

View file

@ -53,8 +53,9 @@ void Scribble::Paint(Draw& w)
w.DrawRect(p1.x, p1.y, 1, 1, Black);
}
w.End();
w.DrawRect(imagesize.cx - pos.x, 0, sz.cx - imagesize.cx - pos.x, sz.cy, SLtGray);
w.DrawRect(0, imagesize.cy - pos.y, imagesize.cx - pos.x, sz.cy - imagesize.cy - pos.y, SLtGray);
w.DrawRect(imagesize.cx - pos.x, 0, sz.cx - pos.x, sz.cy, SLtGray);
w.DrawRect(0, imagesize.cy - pos.y, imagesize.cx - pos.x, sz.cy - pos.y, SLtGray);
w.DrawRect(-pos.x, -pos.y + imagesize.cy, imagesize.cx, 1, SBlack);
w.DrawRect(-pos.x + imagesize.cx, -pos.y, 1, imagesize.cy, SBlack);
}
@ -62,14 +63,14 @@ void Scribble::Paint(Draw& w)
void Scribble::MouseMove(Point p, dword keyflags)
{
if(HasCapture()) {
image.Top().Add() = p;
image.Top().Add() = scroll + p;
Refresh();
}
}
void Scribble::LeftDown(Point p, dword keyflags)
{
image.Add().Add() = p;
image.Add().Add() = scroll + p;
SetCapture();
Refresh();
}

View file

@ -1,13 +1,9 @@
#ifdef LAYOUTFILE
LAYOUT(SizeLayout, 132, 88)
ITEM(Label, dv___0, SetLabel("Width").LeftPosZ(8, 52).TopPosZ(8, 19))
ITEM(Label, dv___0, SetLabel(t_("Width")).LeftPosZ(8, 52).TopPosZ(8, 19))
ITEM(EditIntSpin, cx, LeftPosZ(68, 55).TopPosZ(8, 19))
ITEM(Label, dv___2, SetLabel("Height").LeftPosZ(8, 52).TopPosZ(28, 19))
ITEM(Label, dv___2, SetLabel(t_("Height")).LeftPosZ(8, 52).TopPosZ(28, 19))
ITEM(EditIntSpin, cy, LeftPosZ(68, 55).TopPosZ(28, 19))
ITEM(Button, ok, SetLabel("OK").LeftPosZ(8, 56).TopPosZ(56, 24))
ITEM(Button, cancel, SetLabel("Cancel").LeftPosZ(68, 56).TopPosZ(56, 24))
ITEM(Button, ok, SetLabel(t_("OK")).LeftPosZ(8, 56).TopPosZ(56, 24))
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(68, 56).TopPosZ(56, 24))
END_LAYOUT
#endif