本篇我们会针对 XAML Brushes 做详细分享。 ? Win2D/html/Introduction.htm Sample App: https://www.microsoft.com/store/apps/9NBLGGGXWT9F 代码分析 XAML Brushes 是 V2.2.0 版本新增加的功能,目前共支持 7 种画刷,它们都继承自 XamlCompositionBrushBase,一个创建 XAML Brushes 的基类,使用 CompositionBrush
Color.Black, 1); 25 e.Graphics.DrawString("专家抽取列表", new Font("宋体", 20, FontStyle.Bold), Brushes.Black + (90 - GetWidth("专业", font)) / 2 - 5), y + 10); 44 e.Graphics.DrawString("姓名", font, Brushes.Black (70 - GetWidth("姓名", font)) / 2 - 5), y + 10); 45 e.Graphics.DrawString("固定电话", font, Brushes.Black (90 - GetWidth("固定电话", font)) / 2 - 5), y + 10); 46 e.Graphics.DrawString("手机", font, Brushes.Black (110 - GetWidth("手机", font)) / 2 - 5), y + 10); 47 e.Graphics.DrawString("工作单位", font, Brushes.Black
, 170, 10 中的 System.Drawing.Brushes.Blue 为颜色,后面的为输出的位置 */ e.Graphics.DrawString("新乡市三月软件公司入库单 ", new Font(new FontFamily("黑体"),11), System.Drawing.Brushes.Black, 170, 10); e.Graphics.DrawString ("供货商:河南科技学院", new Font(new FontFamily("黑体"), 8), System.Drawing.Brushes.Blue, 10, 12); / 30); e.Graphics.DrawString("入库单编号" , new Font(new FontFamily("黑体"), 8), System.Drawing.Brushes.Black 9, 35); e.Graphics.DrawString("商品名称", new Font(new FontFamily("黑体"), 8), System.Drawing.Brushes.Black
, 170, 10 中的 System.Drawing.Brushes.Blue 为颜色,后面的为输出的位置 */ e.Graphics.DrawString("新乡市三月软件公司入库单 ", new Font(new FontFamily("黑体"),11), System.Drawing.Brushes.Black, 170, 10); e.Graphics.DrawString ("供货商:河南科技学院", new Font(new FontFamily("黑体"), 8), System.Drawing.Brushes.Blue, 10, 12); / 30); e.Graphics.DrawString("入库单编号" , new Font(new FontFamily("黑体"), 8), System.Drawing.Brushes.Black 9, 35); e.Graphics.DrawString("商品名称", new Font(new FontFamily("黑体"), 8), System.Drawing.Brushes.Black
28 29 if (m_checked) 30 { 31 g.FillEllipse(Brushes.White (this.Height - (int)sizeF.Height) / 2 + 2; 40 g.DrawString(strText, Font, Brushes.White (this.Height - (int)sizeF.Height) / 2 + 2; 54 g.DrawString(strText, Font, Brushes.White , path2); 111 112 //g.FillEllipse(Brushes.White, new Rectangle(1 + 2, 1 + 2, this.Height , path2); 227 228 //g.FillEllipse(Brushes.White, new Rectangle(1 + 2, 1 + 2, this.Height
, 50, 50); g.DrawString("Bold Font", boldFont, Brushes.Black, 50, 70); g.DrawString(" Italic Font", italicFont, Brushes.Black, 50, 90); g.DrawString("Underline Font", underlineFont , Brushes.Black, 50, 110); g.DrawString("Strikeout Font", strikeoutFont, Brushes.Black, 50, 130 , 50, 50); g.DrawString("Bold Font", boldFont, Brushes.Black, 50, 70); g.DrawString(" Italic Font", italicFont, Brushes.Black, 50, 90); // 释放资源 regularFont.Dispose();
Rectangle(LeftMargin, TopMargin, width, (pageSize) * rowHeight); g.DrawRectangle(new Pen(Brushes.Black = 1) { g.DrawLine(new Pen(Brushes.Black, 1), new Point(LeftMargin )); } else { g.DrawLine(new Pen(Brushes.Black tempLeft + 1 + (int)(this.dataview.Columns[i - 1].Width / Rate); g.DrawLine(new Pen(Brushes.Black } } g.DrawString(headString, font, Brushes.Black
; i < 10000; i++) { canvas.Children.Add(new Label() { Content = i.ToString(), BorderBrush = Brushes.Black DrawingVisual(); DrawingContext dc = dv.RenderOpen(); dc.DrawRectangle(Brushes.Green , new Pen(Brushes.Black, 3), new Rect(pt.X, pt.Y, 20, 10)); dc.DrawText(new FormattedText (i.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 10, Brushes.Red , 3), rt); g.DrawString(i.ToString(), new Font("Arial", 15), System.Drawing.Brushes.Black, rt,
2, QuietZoneModules.Two); 19 GraphicsRenderer render = new GraphicsRenderer(moduleSize, Brushes.Black , Brushes.White); 20 render.Draw(g, qrCode.Matrix); 21 } 22 23 private void 32 new FixedModuleSize(modelSizeInPixels, QuietZoneModules.Two), 33 Brushes.Black , 34 Brushes.White); 35 36 string fileName = Application.ExecutablePath
new Rectangle(110, 10, 40, 40);gp.AddEllipse(rectangle);Region region = new Region(gp);g.FillRegion(Brushes.Green RegionData regionData = region.GetRegionData();Region region2 = new Region(regionData);g.FillRegion(Brushes.Green 110, 10, 40, 40);Region region = new Region(rectangle);Region region2 = region.Clone();g.FillRegion(Brushes.Green rect2 = new Rectangle(10, 50, 130, 50);Region reg = new Region(rect1);reg.Union(rect2);g.FillRegion(Brushes.Red = new Rectangle(10, 50, 130, 50);Region reg = new Region(rect1);reg.Complement(rect2);g.FillRegion(Brushes.Red
NewAxis() { var axisLabels = new AxisLabels(); axisLabels.FontColor = Brushes.White ; this.chart.Background = Brushes.Transparent; this.chart.LightingEnabled = false axisY); this.chart.PlotArea = new PlotArea() { Background = Brushes.Transparent this.chart.Titles.Clear(); this.chart.Titles.Add(new Title() { Text = "标题", FontColor = Brushes.Tomato "name" + i; dataPoint.YValue = (i + 1) * 10; dataPoint.Background = Brushes.Red
(int i = 0; i < 12; i++) { g.DrawString(n[i].ToString(), font, Brushes.Red ), 150, 370, 250, 50); //绘制范围框 g.FillRectangle(Brushes.Red, 250, 380, 20, 10); //绘制小矩形 g.DrawString("试用员工人数", font2, Brushes.Red, 270, 380); //绘制试用员工人数 g.FillRectangle(Brushes.Black, 250, 400, 20, 10); //绘制小矩形 g.DrawString("正式员工人数", font2, Brushes.Black, 270, 400); //绘制正式员工人数
; Font font = new Font("Arial", 16); Brush brush = Brushes.Black; PointF point = new PointF ; Font font = new Font("Arial", 16); Brush brush = Brushes.Black; // 计算文本绘制所需的区域大小 SizeF ; Font font = new Font("Arial", 16); Brush brush = Brushes.Black; PointF point = new PointF = g.MeasureString(s, f); g.DrawRectangle(p, 1, 1, sf.Width, sf.Height); g.DrawString(s, f, Brushes.Red , Font, Brushes.Black, new RectangleF(0, 0, ClientSize.Width, ClientSize.Height), stringFormat
(this.panel1.Height / 2) - 26)表示字体底部距离panel1顶部的距离) g.DrawString(str1, ft, Brushes.White this.panel1.Height / 2) - 26)); //同上,绘制第二行字符串 g.DrawString(str2, ft, Brushes.White } //一行可以搞定的话,将字符串绘制在panel的中间 else g.DrawString(message, ft, Brushes.White
public class Foo : ResourceDictionary { public Foo() { Add("Foo", Brushes.Gray public class Foo : ResourceDictionary { public Foo() { Add("Foo", Brushes.Gray void OnGettingValue(object key, ref object value, out bool canCache) { value = Brushes.Blue void OnGettingValue(object key, ref object value, out bool canCache) { value = Brushes.Blue void OnGettingValue(object key, ref object value, out bool canCache) { value = Brushes.Blue
new PointF(cpt.X + 8, cpt.X) };//y轴三角形 gph.DrawString("某工厂某产品月生产量图表", new Font("宋体", 14), Brushes.Black gph.FillPolygon(new SolidBrush(Color.Black), xpt); gph.DrawString("月份", new Font("宋体", 12), Brushes.Black < 11) { gph.DrawString((i * 10).ToString(), new Font("宋体", 11), Brushes.Black - 5, cpt.Y + 5)); gph.DrawString(month[i - 1].Substring(1, 1), new Font("宋体", 11), Brushes.Black , 3); //画数值 gph.DrawString(d[i - 1].ToString(), new Font("宋体", 11), Brushes.Black
moduleSizeInPixels, QuietZoneModules.Two) 26 Dim render As New GraphicsRenderer(moduleSize, Brushes.Black , Brushes.White) 27 28 Dim fileName As String = Application.ExecutablePath + "_One.png" 29 FixedModuleSize(2, QuietZoneModules.Two) 49 Dim render As New GraphicsRenderer(moduleSize, Brushes.Black , Brushes.White) 50 51 ' // 根據字符串生成 QR Code 52 qrCode = qrEncoder.Encode(str) 53 54
,260,4000); e. e.Graphiscs.DrawString(textBox1.Text,new Font(“宋体”,10,FontStyle.Regular),Brushes.Brushes.Black ,260,4000); e.Graphiscs.DrawString(label2.Text,new Font(“宋体”,10,FontStyle.Regular),Brushes.Brushes.Black ,260,4000); e.Graphiscs.DrawString(textBox2.Text,new Font(“宋体”,10,FontStyle.Regular),Brushes.Brushes.Black ,260,4000); e.Graphiscs.DrawString(label3.Text,new Font(“宋体”,10,FontStyle.Regular),Brushes.Brushes.Black ,260,4000); e.Graphiscs.DrawString(textBox3.Text,new Font(“宋体”,10,FontStyle.Regular),Brushes.Brushes.Black
ContrastList = new List<Contrasts>(); ContrastList.Add(new Contrasts() { Title = "减数", IA = 110, AFColor = Brushes.Black , IB = 220, BFColor = Brushes.Black, IC = 330, CFColor = Brushes.Green }); dataGrid.ItemsSource = ContrastList
pot[i] = (new Point(x[i], y[i])); //gobj.FillEllipse(Brushes.Black i - 1, 0.05f);//数据间连曲线 for (int j = 1; j <= i; j++) { gobj.FillEllipse(Brushes.Gray