我可以定位.NET的(表格)消息框或通用对话框?对话框、表格、消息、NET

2023-09-04 02:41:02 作者:曾想、死心塌地的爱迩

我试图让父窗体,而不是中央屏幕的行为中心。 传入父窗体似乎只控制窗口的所有权。 这些类是密封的,所以我不看我怎么可以做任何WinProc把戏。 重写的类不是一个有吸引力的选择。 任何其他的想法?

I am trying to get center of parent form, not center of screen behavior. Passing in the parent form seems to only control the ownership of the window. These classes are sealed, so I do not see how I can do any WinProc tricks. Rewriting the classes is not an appealing option. Any other ideas?

推荐答案

正如HTH以上解释的,也有丑陋的方式去做。 下面是一个简单的类,将包裹对话框并居中在父应用程序/表格。

As HTH explained above, there are ugly ways to do it. Here is a simple class that will wrap the dialog box and center it in the parent application/Form.

这需要丑陋的方式和他们换到的东西稍微更简单。

It takes the ugly ways and wraps them to something slightly more simple.

虽然我还没有实现这样或真正钻研的来源,这是一个良好的开端。 $ C $的CProject CenterDialog

While I haven't implemented this or really delved into the source, it's a good place to start. CodeProject CenterDialog

希望这有助于。

 
精彩推荐
图片推荐