MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / PaintLayout

Method PaintLayout

TexturedFontEditor/FontEditor.cs:105–153  ·  view source on GitHub ↗
(Graphics g, bool bShowSelectedItem)

Source from the content-addressed store, hash-verified

103 private Pen _M_RealMargin = new Pen(Color.LightBlue);
104 private Pen _M_SelectedMargin = new Pen(Color.Red);
105 void PaintLayout(Graphics g, bool bShowSelectedItem)
106 {
107 HashSet<FontDef.CharDef> tSet = null;
108 if (bShowSelectedItem)
109 {
110 tSet = new HashSet<FontDef.CharDef>();
111
112 if (listView_charmap.SelectedItems.Count > 0)
113 {
114 foreach (ListViewItem y in listView_charmap.SelectedItems)
115 {
116 tSet.Add((FontDef.CharDef)y.Tag);
117 }
118 }
119 }
120
121 if (ToolStripMenuItem_showmargin.Checked)
122 {
123 // 图像辅助线
124 foreach (FontDef.CharDef x in _Def.CharList)
125 {
126 g.DrawRectangle(_M_ImageMargin, new Rectangle(x.Location, x.CharSize));
127 }
128 }
129
130 if (ToolStripMenuItem_showfont.Checked)
131 {
132 // 文字度量线
133 foreach (FontDef.CharDef x in _Def.CharList)
134 {
135 bool bSelected = false;
136
137 if (bShowSelectedItem)
138 if (tSet.Contains(x))
139 bSelected = true;
140
141 if (bSelected)
142 {
143 g.DrawRectangle(_M_SelectedMargin,
144 new Rectangle(x.Location.X + x.ImageMargin, x.Location.Y + x.ImageMargin, x.CharSize.Width - x.ImageMargin * 2, x.CharSize.Height - x.ImageMargin * 2));
145 }
146 else
147 {
148 g.DrawRectangle(_M_RealMargin,
149 new Rectangle(x.Location.X + x.ImageMargin, x.Location.Y + x.ImageMargin, x.CharSize.Width - x.ImageMargin * 2, x.CharSize.Height - x.ImageMargin * 2));
150 }
151 }
152 }
153 }
154
155 private void FontEditor_Load(object sender, EventArgs e)
156 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected