public void SelectButton(Graphics graphics) { Pen linePen = new System.Drawing.Pen(Brushes.SkyBlue, 4); GrapTBEditor graptb = this.currSelectedTB as GrapTBEditor; if (graptb == null) { return; } if (graptb.Visible == true) { this.drawTool.DrawRect(graphics, linePen, graptb.ButtonArea); } }
private bool CreateTbox(string name, DATATYPE type, string value, STYLE style, string desc, int index, ref IGrapTB grapTb) { if (IsExistNameInEditor(name) == true) { return(false); } if (style == STYLE.EDITOR) { grapTb = new GrapTBEditor(); } else if (style == STYLE.DEFAULT) { grapTb = new GrapTB(); } else { return(false); } grapTb.Name = name; grapTb.ValueDataType = type; grapTb.Value = value; grapTb.Style = style; grapTb.Index = index; grapTb.Desc = desc; double rowthTemp = (1.0 + index) / this.columnNum; grapTb.Rowth = (int)Math.Ceiling(rowthTemp); int colthTemp = (index + 1) % this.columnNum; if (colthTemp == 0) { grapTb.Colth = this.columnNum; } else { grapTb.Colth = colthTemp; } int x = startPos.X + grapTb.Size.Width * (grapTb.Colth - 1) + (grapTb.Colth - 1) * this.columnInterval; int y = startPos.Y + grapTb.Size.Height * (grapTb.Rowth - 1) + (grapTb.Rowth - 1) * this.rowInterval; grapTb.Location = new Point(x, y); grapTb.PosRect = new Rectangle(grapTb.Location, grapTb.Size); return(true); }
private IGrapTB GetBttonByPt(Point pt) { IGrapTB pos = null; foreach (IGrapTB tb in this.superEditor.TextBoxList) { if (tb == null) { continue; } if (tb.Style == STYLE.EDITOR) { GrapTBEditor tbEditor = tb as GrapTBEditor; if (tbEditor.ButtonArea.Contains(pt) == true) { pos = tb; break; } } } return(pos); }