我遇到了问题。如何从状态调用控制器,而控制器放在另一个名为控制器的文件夹上(如下图所示)?
还有另一种方法可以在以下状态添加控制器:
const uint WM_NCHITTEST = 0x0084, WM_MOUSEMOVE = 0x0200,
HTLEFT = 10, HTRIGHT = 11, HTBOTTOMRIGHT = 17,
HTBOTTOM = 15, HTBOTTOMLEFT = 16, HTTOP = 12,
HTTOPLEFT = 13, HTTOPRIGHT = 14;
Size formSize;
Point screenPoint;
Point clientPoint;
Dictionary<uint, Rectangle> boxes;
const int RHS = 10; // RESIZE_HANDLE_SIZE
bool handled;
protected override void WndProc(ref Message m)
{
if (this.WindowState == FormWindowState.Maximized)
{
base.WndProc(ref m);
return;
}
handled = false;
if (m.Msg == WM_NCHITTEST || m.Msg == WM_MOUSEMOVE)
{
formSize = this.Size;
screenPoint = new Point(m.LParam.ToInt32());
clientPoint = this.PointToClient(screenPoint);
boxes = new Dictionary<uint, Rectangle>() {
{HTBOTTOMLEFT, new Rectangle(0, formSize.Height - RHS, RHS, RHS)},
{HTBOTTOM, new Rectangle(RHS, formSize.Height - RHS, formSize.Width - 2*RHS, RHS)},
{HTBOTTOMRIGHT, new Rectangle(formSize.Width - RHS, formSize.Height - RHS, RHS, RHS)},
{HTRIGHT, new Rectangle(formSize.Width - RHS, RHS, RHS, formSize.Height - 2*RHS)},
{HTTOPRIGHT, new Rectangle(formSize.Width - RHS, 0, RHS, RHS) },
{HTTOP, new Rectangle(RHS, 0, formSize.Width - 2*RHS, RHS) },
{HTTOPLEFT, new Rectangle(0, 0, RHS, RHS) },
{HTLEFT, new Rectangle(0, RHS, RHS, formSize.Height - 2*RHS) }
};
foreach (var hitBox in boxes)
{
if (hitBox.Value.Contains(clientPoint))
{
m.Result = (IntPtr)hitBox.Key;
handled = true;
break;
}
}
}
if (!handled)
base.WndProc(ref m);
}
protected override void OnPaint(PaintEventArgs e)
{
if (this.WindowState != FormWindowState.Maximized)
{
ControlPaint.DrawSizeGrip(e.Graphics, this.BackColor,
this.ClientSize.Width - 16, this.ClientSize.Height - 16, 16, 16);
}
base.OnPaint(e);
}
但我希望减少状态代码,并希望将控制器放到另一个文件夹中,我可以将它们从不同的位置集成。
这是一张清晰理解的图片:
答案 0 :(得分:0)
只要在页面中包含controllers/articles.js
,就可以更改状态配置以使用注册的控制器名称:
url:"/whatever",
templateUrl:'whatever/init',
controller :'articles'