Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/140.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在GDI+;中删除行的某一部分;_C++_Windows_Gdi+ - Fatal编程技术网

C++ 在GDI+;中删除行的某一部分;

C++ 在GDI+;中删除行的某一部分;,c++,windows,gdi+,C++,Windows,Gdi+,我有一条类似于箭头的线。我在这条线上画了一个文本。现在我想删除这条线中与文本重叠的部分 我目前的代码是: SolidBrush *brush1=new SolidBrush(Color::Color(0,167,255)); StringFormat format; format.SetAlignment(StringAlignmentCenter); format.SetLineAlignment(StringAlignmentCenter); graph->DrawLine(my

我有一条类似于箭头的线。我在这条线上画了一个文本。现在我想删除这条线中与文本重叠的部分

我目前的代码是:

SolidBrush *brush1=new SolidBrush(Color::Color(0,167,255));
StringFormat format; 
format.SetAlignment(StringAlignmentCenter); 
format.SetLineAlignment(StringAlignmentCenter); 
graph->DrawLine(myPen,point2,point1); 
graph->DrawString(strdata,wcslen(strdata),&font,point2,&format,brush1);
我也试过了

AdjustableArrowCap *cap1 = new AdjustableArrowCap(5, 5, true);
Pen *myPen1 = new Pen(Color::Color(0,255,255), width);

myPen->SetCustomEndCap(cap1);
GraphicsPath path;
path.AddLine(point1,point2);
Font font(&FontFamily(L"arial"), 21);
Brush *brush=new SolidBrush(Color::Color(0,255,255,255));

SolidBrush solidBrush(Color(255, 255, 0, 0));

StringFormat format;
format.SetAlignment(StringAlignmentCenter);
format.SetLineAlignment(StringAlignmentCenter);
RectF rectbo;
graph->MeasureString(strdata,wcslen(strdata),&font,PointF::PointF(point2),&rectbo);


graph->DrawLine(myPen,point2,point1);
Region pathRegion(&path);
sta=pathRegion.Intersect(rectbo);
graph->fillRegion(pathRegion,&brush);
graph->DrawString(strdata,wcslen(strdata),&font,point2,&format,brush1);

先画线,然后画文本

  • 另外,请确保启用了笔刷实体/清除样式
  • 因此,文本将覆盖文本下方的空格
  • 纸张按原样清除/或留下
我为你找到的

  • 所以设置
    LOGBRUSH::lbStyle=BS_NULL用于bsClear等效程序
  • LOGBRUSH::lbStyle=BS_SOLID用于等效实体

先画线,然后再画文本。此外,请确保启用了画笔实体样式,以便文本覆盖文本下方的空间(如果需要)。能否给出当前渲染和所需渲染的视觉示例?到目前为止,你有什么代码?@Spektre如何启用已售出的画笔样式。只需创建一个实心画笔即可?@Spektre我想隐藏箭头中以包含矩形的矩形为边界的部分。不,行中以文本为边界的部分在VCL中输入代码,因此对我来说,它只是
一些\u VCL\u Obj\u或\u Form->Canvas->brush->style=bsSolid很难说,但应该是类似的。GDI不允许绘制wothLOGBRUSH@user3845376尝试使用空指针而不是画笔,或者查看GDI+文档中的画笔样式属性。如果你的问题没有解决,那么不要检查答案。。。在解决之前…如果我写入NULL,它将删除字符串。GDI支持的LOGBRUSH,但GDI+不支持LOGBRUSH。它不允许您设置propoert,因为存在固定笔刷,如实心笔刷图案填充笔刷和图案brush@user3845376用空填充图案填充位图怎么样?如果GDI+允许设置自定义图案填充贴图,则将其与空位图一起使用。还有一种可能是创建实体画笔,并直接在画笔结构中更改它的属性(但需要访问权限),但我仍然认为GDI+中应该有ClearBrush或NullBrush之类的东西,这是GDI中经常使用的东西,所以不在GDI+中实现它是愚蠢的。。。