任务:使InlineUIContainer的文本内容与外部文本内联
InlineUIContainer内容的标准行为是底边与外部文本内联.
可以使用RenderTransform移动InlineUIContainer的内容,但必须为每种字体类型和大小选择Y的值 - 这不是一种完美的方式.
<RichTextBox>
<FlowDocument>
<Paragraph>
LLL
<InlineUIContainer>
<Border Background="LightGoldenrodYellow">
<TextBlock Text="LLL"/>
</Border>
</InlineUIContainer>
LLL
</Paragraph>
<Paragraph>
LLL
<InlineUIContainer>
<Border Background="LightGoldenrodYellow">
<Border.RenderTransform>
<TranslateTransform Y="5" />
</Border.RenderTransform>
<TextBlock Text="LLL"/>
</Border>
</InlineUIContainer>
LLL
</Paragraph>
</FlowDocument>
</RichTextBox>
Run Code Online (Sandbox Code Playgroud)

如何将InlineUIContainer内容中的文本与RichTextBox中的外部文本对齐,而不管字体类型和大小如何?
说我们有这样一张桌子:
declare @periods table (
s date,
e date,
t tinyint
);
Run Code Online (Sandbox Code Playgroud)
日期间隔没有按开始日期排序的间隙
insert into @periods values
('2013-01-01' , '2013-01-02', 3),
('2013-01-02' , '2013-01-04', 1),
('2013-01-04' , '2013-01-05', 1),
('2013-01-05' , '2013-01-06', 2),
('2013-01-06' , '2013-01-07', 2),
('2013-01-07' , '2013-01-08', 2),
('2013-01-08' , '2013-01-09', 1);
Run Code Online (Sandbox Code Playgroud)
所有日期间隔都有不同的类型(t).
需要组合相同类型的日期间隔,它们不会被其他类型的间隔(按开始日期排序的所有间隔)打破.
所以结果表应如下所示:
s | e | t
------------|------------|-----
2013-01-01 | 2013-01-02 | 3
2013-01-02 | 2013-01-05 | 1
2013-01-05 | 2013-01-08 | 2
2013-01-08 | 2013-01-09 | 1
Run Code Online (Sandbox Code Playgroud)
任何想法如何没有光标吗?
我有一个有效的解决方案:
declare @periods table ( …Run Code Online (Sandbox Code Playgroud) 我想解决的问题是根据构建配置构建不同的脚本.
假设我们有两个SQL Server实例:
当LocalDB使用本地表替换这些视图时,企业版具有链接服务器的视图.
这些链接服务器视图和本地表具有相同的名称和字段集.因此默认情况下它们不包含在构建中(Build Action = None).相反,它们包含在项目文件的BeforeBuild Target中.
<Target Name="BeforeBuild">
<ItemGroup Condition=" '$(Configuration)' == 'LocalDb'">
<Build Include="Local_Tables\*.sql" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' != 'LocalDb' ">
<Build Include="Linked_Server_Views\*.sql" />
</ItemGroup>
</Target>
Run Code Online (Sandbox Code Playgroud)
但问题是Visual Studio缓存数据库模型,如果我们首先为LocalDb构建项目,然后尝试构建企业配置项目 - Visual Studio输出错误:
错误:SQL71508:模型已经有一个具有相同名称的元素
如果要关闭并打开解决方案或卸载项目和重新加载项目,Visual Studio将重新创建dbmdl文件,并且正在构建企业配置而不会出现错误.
所以我的假设是,如果我刷新dbmdl缓存,我将得到平滑的构建,没有错误.
当您打开或在Visual Studio 2012重装SQL Server数据库的项目,它将创建一个具有扩展名的文件dbmdl,这是作为描述的反序列化和缓存数据库模型在这里.
在dbmdl文件重新创建的那一刻,Visual Studio输出以下内容:
Deserializing the project state for project 'MyProject.sqlproj'...
Detecting file changes for project 'MyProject.sqlproj'...
Deserialization has been completed for project 'MyProject.sqlproj'.
Run Code Online (Sandbox Code Playgroud)
如何在没有项目重新加载且不更改项目xml文件的情况下强制Visual Studio刷新dbmdl缓存?
有没有办法刷新dbmdl缓存,将命令放入项目xml文件的BeforeBuild或AfterBuild目标?
或者问题的整个方法是错误的,还有另一种方法可以根据构建配置构建不同的脚本?
msbuild database-project msbuild-target visual-studio-2012 sql-server-data-tools
在 Angular 6+ httpClient 中,可以将请求配置为获取完整响应。
可观察到的响应可以通过管道传输到map和catchError运算符中。
执行何时通过map运算符以及何时执行catchError?
它取决于响应状态代码吗?
例如,如果response.status === 200然后转到map,否则转到catchError?
如果不仅状态 200 转到map,那么还有哪些?
会进入哪些状态catchError?
getData(): Observable<[]> {
return this.http.get(this.apiUrl, {observe: 'response'}).pipe(
map((response: HttpResponse<any>) => {
return response.status === 200;
}),
catchError((errorResponse: HttpErrorResponse) =>
// which value may be logged here?
console.log(errorResponse.status);
of(false);
));
}
Run Code Online (Sandbox Code Playgroud) .NET 标准库功能可能因运行它的 .NET 平台而异:
如何查看 .NET Standard 库当前运行所在的 .NET 平台?
例如:
// System.AppContext.TargetFrameworkName
// returns ".NETFramework,Version=v4.6.1" for .NET Framework
// and
// returns null for .NET Core.
if (IsNullOrWhiteSpace(System.AppContext.TargetFrameworkName))
// the platform is .NET Core or at least not .NET Framework
else
// the platform is .NET Framework
Run Code Online (Sandbox Code Playgroud)
这是回答问题的可靠方法(至少对于 .NET Framework 和 .NET Core)吗?
我有一百张 JPG 图像,想将它们合并为一个大 JPG。为了实现这一点,我使用以下代码:
using (var combinedBitmap = new Bitmap(combinedWidth, combinedHeights)) {
combinedBitmap.SetResolution(96, 96);
using (var g = Graphics.FromImage(combinedBitmap))
{
g.Clear(Color.White);
foreach (var imagePiece in imagePieces)
{
var imagePath = Path.Combine(slideFolderPath, imagePiece.FileName);
using (var image = Image.FromFile(imagePath))
{
var x = columnXs[imagePiece.Column];
var y = rowYs[imagePiece.Row];
g.DrawImage(image, new Point(x, y));
}
}
}
combinedBitmap.Save(combinedImagePath, ImageFormat.Jpeg);
}
Run Code Online (Sandbox Code Playgroud)
一切都很好,直到尺寸(combinedWidth,combinedHeights)超过窗帘阈值,就像这里所说的 /sf/answers/2042313381/
尺寸为 23170 x 23170 像素的合并 JPG 文件大约为 50MB — 不会太大而无法占用内存。
但是位图不能用更大的维度创建——只是因为错误的参数异常而中断。
有没有其他方法可以使用 C# 将 JPG 图像块合并到一个尺寸大于 23170 x …