我是Flexbox的新手,想要对齐按钮,但我看不到如何使用Flexbox处理同一行中心对齐按钮和右对齐按钮的常见情况.
然而,我发现了一种方法,所用的相同的长度右对齐项目的无形左对齐项目和柔性justify-content带space-between,使集中在该行的中间项.
Flexbox有更直接的方式吗?
.flexcontainer {
display: flex;
justify-content: space-between;
width: 500px;
height: 200px;
}
.iteminvisible {
flex: 0 1 auto;
width: 100px;
height: 100px;
visibility: hidden;
}
.itemcenter {
flex: 0 1 auto;
width: 150px;
height: 100px;
.itemright {
flex: 0 1 auto;
width: 100px;
height: 100px;
}Run Code Online (Sandbox Code Playgroud)
<div class="flexcontainer">
<div class="iteminvisible">Other</div>
<div class="itemcenter">One</div>
<div class="itemright">Other</div>
</div>Run Code Online (Sandbox Code Playgroud)
使用Visual Studio 2013
我有一个应用程序可能最多使用大约20个窗口类,但不是所有窗口类同时使用.为了节省空间,我决定在开始另一批窗口类之前取消注册那些不再需要的东西,但是我无法使UnregisterClass函数工作.
我调用了取消注册WM_DESTROY和/或WM_NCDESTROY它总是返回错误消息1412'类仍然有打开窗口'.也许Unregister调用WM_DESTROY失败了,因为窗口还没有被销毁,但我没想到调用WM_NCDESTROY失败,因为在破坏窗口后发送了这条消息.
我可以让UnregisterClass工作的唯一方法是调用PostQuitMessage在任WM_DESTROY或WM_NCDESTROY.然后UnregisterClass将在整个应用程序退出之前的消息循环之后工作,但我想从应用程序内部启动另一批类,而不是必须全部启动它.
我正在提交一个显示问题的测试程序.它是Win32Project7,一个由Visual Studio 2013提供的程序,由我自己提供两个微小的补充 - 包装Messagebox(mbox)和一个调用unregister(tryunreg)的过程.
一个极端是注册20个窗口类,只是为了在需要时准备就绪,另一个是在HWND上使用单个窗口类和多路复用.对这些都不太热衷.
问题:
用Google搜索了这个.没有找到文档中尚未包含的任何内容,例如退出应用程序时取消注册是自动的.Stackoverflow有两个类似的帖子,但没有答案.
代码:
我把代码放在这样:
<pre>
program fragments
</pre>
Run Code Online (Sandbox Code Playgroud)
包含在html预标签之间,但帖子未发送.错误消息表示文本格式化为程序,但缩进不是4个空格.最初它不是,但我改变了它,但它仍然没有发送.从来没有在这个论坛上发过问题,所以我做错了.什么?
这是我不知道如何发送原始帖子的代码.迟到总比不到好.
// Win32Project7.cpp : Defines the entry point for the application.
#include "stdafx.h"
#include "Win32Project7.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst;
TCHAR szTitle[MAX_LOADSTRING];
TCHAR szWindowClass[MAX_LOADSTRING];
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT …Run Code Online (Sandbox Code Playgroud) 例如:
type PERSONCV is
record
name: String ( 1..4 );
age: Integer;
cvtext: String ( 1..2000 );
end record;
N: constant := 40000;
persons : array ( 1..N ) of PERSONCV;
function jobcandidate return Boolean is
iscandidate: Boolean := False;
begin
for p of persons loop -- what code is generated for this?
if p.age >= 18 then
iscandidate := true;
exit;
end if;
end loop;
return iscandidate;
end;
Run Code Online (Sandbox Code Playgroud)
在C/C++中,循环部分通常是:
PERSONCV * p; // address pointer
int k = 0; …Run Code Online (Sandbox Code Playgroud) 我试过这个:
<html>
<head>
<title>Left, Mid, Right action buttons</title>
<style>
.parent {
width: 600px;
background-color: yellow;
}
.itemleft {
display: flex;
justify-content: flex-start;
}
.itemcenter {
display: flex;
justify-content: center;
}
.itemright {
display: flex;
justify-content: flex-end;
}
.bs {
background-color: green;
color: white;
width: 70px;
}
</style>
</head>
<body>
<div class="parent">
<span class="itemleft">
<button class="bs">Edit</button>
<button class="bs">Delete</button>
</span>
<span class="itemcenter">
<button class="bs">OK</button>
<button class="bs">Cancel</button>
</span>
<span class="itemright">
<button class="bs">Help</button>
</span>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
结果在 Firefox 或 Chrome 中运行: