private void DrawDraw2(Graphics g) { string text = "aaa\r\nbbb"; Font font1 = UFontManager.getFont(UDrawUtility.FontName, 10); SizeF size = g.MeasureString(text, font1, 1000); g.DrawString(size.ToString(), font1, Brushes.Black, 100, 200); g.FillRectangle(Brushes.Green, 100, 100, size.Width, size.Height); g.DrawString(text, font1, Brushes.Black, 100, 100); }
/** * Constructor */ public UTextView(String text, int fontSize, int priority, StringAlignment alignX, StringAlignment alignY, bool multiLine, float x, float y, Color color) : base(priority, text, x, y, 0, 0) { this.text = text; this.alignX = alignX; this.alignY = alignY; this.multiLine = multiLine; this.fontSize = fontSize; this.color = color; font = UFontManager.getFont(UDrawUtility.FontName, fontSize); }
// // Constructor // public ZoomView(int priority, string name, float x, float y) : base(priority, name, x, y, 0, 0) { font1 = UFontManager.getFont(UDrawUtility.FontName, fontSize); brush1 = Brushes.DarkBlue; brush2 = Brushes.DarkRed; brush3 = Brushes.LightGray; hoverBrush1 = new SolidBrush(Color.FromArgb(UColor.setBrightness(Color.DarkBlue.ToArgb(), 128))); hoverBrush2 = new SolidBrush(Color.FromArgb(UColor.setBrightness(Color.DarkRed.ToArgb(), 128))); hoverBrush3 = new SolidBrush(Color.FromArgb(UColor.setBrightness(Color.Gray.ToArgb(), 128))); zoom = new ZoomRate(); int _x = (int)pos.X; rect1 = new Rectangle(_x, (int)pos.Y, smallButtonW, smallButtonW); _x += smallButtonW + marginX; rect2 = new Rectangle(_x, (int)pos.Y, centerButtonW, centerButtonH); _x += centerButtonW + marginX; rect3 = new Rectangle(_x, (int)pos.Y, smallButtonW, smallButtonW); }