internal static void KeyEnterDown() { //两个维文中间回车换行 WeiWenProcess.boolEnter = true; ZYTextChar myCurrentChar = WeiWenProcess.document.Content.GetPreChar(0); myChars.Add(myCurrentChar.Char); ZYTextChar myPreChar = WeiWenProcess.document.Content.GetPreChar(1); myChars.Add(myPreChar.Char); for (int i = 0; i < 5; i++) { for (int j = 0; j < 34; j++) { if (Harip[i, j] == (int)myCurrentChar.Char) { switch (weiwenType(myCurrentChar.Char)) { case 1: myCurrentChar.Char = UnicodeToString(Harip[0, j].ToString("X4")).ToCharArray()[0]; myCurrentChar.RefreshSize(); break; case 2: myCurrentChar.Char = UnicodeToString(Harip[3, j].ToString("X4")).ToCharArray()[0]; myCurrentChar.RefreshSize(); break; default: break; } } if (Harip[i, j] == (int)myPreChar.Char) { switch (weiwenType(myPreChar.Char)) { case 3: myPreChar.Char = UnicodeToString(Harip[0, j].ToString("X4")).ToCharArray()[0]; myPreChar.RefreshSize(); break; case 2: myPreChar.Char = UnicodeToString(Harip[1, j].ToString("X4")).ToCharArray()[0]; myPreChar.RefreshSize(); break; default: break; } } } } }
public static void KeyBackspace() { //如果上一次是在维文中间回车换行 if (WeiWenProcess.boolEnter) { ZYTextElement CurrentElement = WeiWenProcess.document.Content.CurrentElement; if (WeiWenProcess.document.Content.GetPreElement(CurrentElement) is ZYTextEOF && isWeiwen(WeiWenProcess.document.Content.GetPreChar(2).Char)) { ZYTextChar PreChar = WeiWenProcess.document.Content.GetPreChar(2); (CurrentElement as ZYTextChar).Char = (char)myChars[0]; (CurrentElement as ZYTextChar).RefreshSize(); PreChar.Char = (char)myChars[1]; PreChar.RefreshSize(); boolEnter = false; return; } } ZYTextChar myChar = WeiWenProcess.document.Content.GetPreChar(1); if (isWeiwen(myChar.Char))//当前要删除的是维文 { switch (weiwenType(myChar.Char)) { //0-单独 1-接尾 2-中间 3-起始 //单独(原型) 左 false 右 false 左右不用改变任何 //左右都不是维文,那么左右两个相接不是维文相接,跟当前字符删不删除是一样 // 中间形式 左 true 右 true 左右不用改变 //左右都是维文,那么左右两个相接依然是维文相接,跟当前字符删不删除是一样 case 1: //接尾形式 左 false 右 true 左不用改变 右要改变(中间 -> 接尾 或 起始 -> 单独) ZYTextChar RightChar = WeiWenProcess.document.Content.GetPreChar(2); RightChar.Char = UnicodeToString(ChangeFromweiwen(RightChar.Char, true)).ToCharArray()[0]; RightChar.RefreshSize(); break; case 3: //起始形式 左 true 右 false 左用改变 右不用改变 ZYTextChar LeftChar = WeiWenProcess.document.Content.GetFontChar(0); LeftChar.Char = UnicodeToString(ChangeFromweiwen(LeftChar.Char, false)).ToCharArray()[0]; LeftChar.RefreshSize(); break; default: break; } } }
/// <summary> /// 创建一个字符元素对象 /// </summary> /// <param name="c">该对象使用的字符</param> /// <returns>新建的字符元素对象</returns> public static ZYTextChar Create(char c) { ZYTextChar chr; if (c == '\t') { chr = new ZYTextCharTab(); } else { chr = new ZYTextChar(); } chr.Char = c; return(chr); }
public PropertyChar(object o) { _c = (ZYTextChar)o; }
/// <summary> /// 单元格深度复制 Add by wwj 2012-05-30 /// </summary> /// <returns></returns> public TPTextCell Clone() { TPTextCell newCell = new TPTextCell(); newCell.myOwnerDocument = this.myOwnerDocument; newCell.myChildElements.Clear(); newCell.colspan = Colspan; newCell.rowspan = Rowspan; newCell.horizontalAlignment = HorizontalAlignment; newCell.verticalAlignment = VerticalAlignment; newCell.bolSelected = Selected; newCell.Width = Width; newCell.Height = Height; newCell.backgroundColor = backgroundColor; newCell.PaddingTop = PaddingTop; newCell.PaddingRight = PaddingRight; newCell.PaddingBottom = PaddingBottom; newCell.PaddingLeft = PaddingLeft; newCell.BorderWidth = BorderWidth; newCell.BorderWidthTop = BorderWidthTop; newCell.BorderWidthRight = BorderWidthRight; newCell.BorderWidthBottom = BorderWidthBottom; newCell.BorderWidthLeft = BorderWidthLeft; newCell.BorderColor = BorderColor; newCell.BorderColorTop = BorderColorTop; newCell.BorderColorRight = BorderColorRight; newCell.BorderColorBottom = BorderColorBottom; newCell.BorderColorLeft = BorderColorLeft; newCell.BorderStyle = BorderStyle; newCell.BorderStyleTop = BorderStyleTop; newCell.BorderStyleRight = BorderStyleRight; newCell.BorderStyleBottom = BorderStyleBottom; newCell.BorderStyleLeft = BorderStyleLeft; newCell.ContentHeight = ContentHeight; newCell.ItalicLineStyleInCell = ItalicLineStyleInCell;//Add by wwj 2012-05-29 //*************************************** newCell.ChildElements.Clear(); for (int i = 0; i < myChildElements.Count; i++)//遍历单元格中的段落 { ZYTextParagraph para = myChildElements[i] as ZYTextParagraph; if (para != null) { ZYTextParagraph newPara = new ZYTextParagraph(); newPara.Parent = newCell; newPara.OwnerDocument = newCell.OwnerDocument; newCell.myChildElements.Add(newPara); StringBuilder sb = new StringBuilder(); para.GetFinalText(sb); newPara.Align = para.Align; foreach (ZYTextElement myElement in para.ChildElements) //遍历段落中的没有元素 { if (myElement is ZYTextChar) //如果文本元素 { ZYTextChar oldChar = myElement as ZYTextChar; ZYTextChar NewChar = ZYTextChar.Create(oldChar.Char); NewChar.OwnerDocument = newCell.OwnerDocument; NewChar.Parent = newPara; newPara.InsertBefore(NewChar, newPara.LastElement); NewChar.FontName = oldChar.FontName; NewChar.FontSize = oldChar.FontSize; NewChar.Height = oldChar.Height; NewChar.Width = oldChar.Width; NewChar.Sub = oldChar.Sub; NewChar.Sup = oldChar.Sup; } } } } //*************************************** newCell.UpdateBounds(); return(newCell); }