public LoginWindow(ISizeable size) : base(size) { VisibleFrame = CreateFrame(); _titleFireLeft = CreateTitleFireAnimation(new Point(Width / 2 - TITLE.Length / 2 - 7, 0)); _titleFireRight = CreateTitleFireAnimation(new Point(Width / 2 + TITLE.Length / 2 + 3, 0)); }
public Window(ISizeable size, Window parent, Window[] childWindows) { Width = size.Width; Height = size.Height; Parent = parent; ChildWindows = childWindows; }
/****************************************************************************/ internal PageBlobWriteStream(Stream output, ISizeable sizeable, int bufferSize = 4096 * 1024) { this.Output = output; _sizeable = sizeable; _bufferSize = Math.Max(AzurePageBlobStorage.PageSize, (int)(Math.Floor((double)bufferSize / AzurePageBlobStorage.PageSize) * AzurePageBlobStorage.PageSize)); _buffer = new byte[_bufferSize]; }
void IDesign.OffSetHeight(int inte) { foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Size = new Size(sizeable.Size.Width, sizeable.Size.Height + inte); } }
void IDesign.OffSetY(int inte) { foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X, sizeable.Location.Y + inte); } }
public GUIAdapter(IRenderable renderable) { Sizeable = renderable as ISizeable; if (Sizeable == null) { throw new ArgumentException("GUIAdapter can not adapt an object that does not implement ISizeable interface"); } Primitive = renderable; }
public CharacterWindow(ISizeable size, Window parent) : base(size) { Parent = parent; _character = new SocketCharacter() { Name = "LtLi0n", TotalXp = "0", Gold = 0 }; VisibleFrame = CreateFrame(size); }
public SizeForm(ISizeable shape) { InitializeComponent (); s = shape; asi = shape as IAutoSizeable; if (asi != null) { checkBox1.Checked = asi.AutoResizeHeight; checkBox2.Checked = asi.AutoResizeWidth; } else { checkBox1.Visible = false; checkBox2.Visible = false; } textBox1.Text = shape.Height.ToString (CultureInfo.CurrentCulture); textBox2.Text = shape.Width.ToString (CultureInfo.CurrentCulture); }
private void menuFieldClick(object sender, EventArgs e) { ToolStripMenuItem menu = (ToolStripMenuItem)sender; string field = menu.Text; IPrintObject ins = new PrintObject2(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; IFieldAble fieldable = (IFieldAble)ins; fieldable.Field = field; ins.Show(pnl); }
private Frame CreateFrame(ISizeable size) { FrameBuilder fb = new FrameBuilder(size) { Color = FG_WHITE, Offset = new Point(4, 2) }; string levelProgress = _character.LevelProgress.ToString(); int width = _character.Name.Length; int reserved_width = 2 + TITLE.Length; if (levelProgress.Length > width) { width = levelProgress.Length + 1; } if (width < 24) { width = 24; } //top border int top_border_remaining = width - reserved_width; { int border_n = top_border_remaining / 2; fb.Color = CONJUNCTION_COLOR; fb.Write('+'); fb.Color = BORDER_COLOR; fb.Write(new string(BORDER_GLYPGH, border_n)); fb.Color = TITLE_COLOR; fb.Write("[Character]"); fb.Color = BORDER_COLOR; fb.Write(new string(BORDER_GLYPGH, top_border_remaining - border_n)); fb.Color = CONJUNCTION_COLOR; fb.WriteLine('+'); } fb.NewLine(); fb.WriteLine($" Name: {_character.Name}"); fb.WriteLine($" {levelProgress}"); return(fb.Build()); }
public PlayerWindow(ISizeable size, Window parent) : base(size) { Parent = parent; FrameBuilder fb = new FrameBuilder(this) { Color = FG_GREEN, Offset = new Point(4, 2) }; fb.WriteLine("Hello Player"); fb.Color = FG_WHITE; fb.WriteLine("2) Character stuff"); VisibleFrame = fb.Build(); ChildWindows = new[] { new CharacterWindow(size, this) }; }
public MenuWindow(ISizeable size) : base(size) { FrameBuilder fb = new FrameBuilder(size) { Color = FG_GREEN, Offset = new Point(4, 2) }; fb.WriteLine("1) Play"); fb.Color = FG_CYAN; fb.WriteLine("2) Player"); fb.Color = FG_BLUE; fb.WriteLine("3) Exit"); VisibleFrame = fb.Build(); ChildWindows = new[] { new PlayerWindow(size, this) }; }
public ResizeHandle(CompassPoint compassPoint, ISizeable owner) { mCompassPoint = compassPoint; mOwner = owner; }
private void contextMenuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { this.contextMenuStrip2.Visible = false; try { if (e.ClickedItem.Text == "文本内容") { IInput input = new InputString(); string def = ""; if (SelectObjects.Count == 1) { IContextable contextable = (IContextable)SelectObjects[0]; def = contextable.Context; } if (input.Input(def, out def) == true) { foreach (IPrintObject ins in SelectObjects) { IContextable contextable = (IContextable)ins; contextable.Context = def; } Record(); } } else if (e.ClickedItem.Text == "文本对齐") { ISelectContextAlign align = new SelectContextAlign(); int def = 0; if (SelectObjects.Count == 1) { IContextAlignAble contextalignable = (IContextAlignAble)SelectObjects[0]; def = contextalignable.Align; } if (align.Select(def, out def) == true) { foreach (IPrintObject ins in SelectObjects) { IContextAlignAble contextalignable = (IContextAlignAble)ins; contextalignable.Align = def; } Record(); } } else if (e.ClickedItem.Text == "区域") { IInput input = new InputString(); int Area = -1; if (SelectObjects.Count == 1) { IChangeAreaAble changeareaable = (IChangeAreaAble)SelectObjects[0]; Area = changeareaable.Area; } IChangePrintArea printarea = new ChangePrintArea(); if (printarea.Change(Area, out Area) == true) { foreach (IPrintObject ins in SelectObjects) { IChangeAreaAble changeareaable = (IChangeAreaAble)ins; changeareaable.Area = Area; } Record(); } } else if (e.ClickedItem.Text == "删除") { List <IPrintObject> lst = new List <IPrintObject>(); foreach (IPrintObject ins in SelectObjects) { lst.Add(ins); } foreach (IPrintObject ins in lst) { IDeleteable deleteable = (IDeleteable)ins; deleteable.Delete(pnl); } Record(); } else if (e.ClickedItem.Text == "字体") { FontDialog f = new FontDialog(); if (SelectObjects.Count == 1) { IFontable fontable = (IFontable)SelectObjects[0]; f.Font = fontable.Font; } if (f.ShowDialog() == DialogResult.OK) { foreach (IPrintObject ins in SelectObjects) { IFontable fontable = (IFontable)ins; fontable.Font = f.Font; } Record(); } } else if (e.ClickedItem.Text == "边框") { IEditBorder border = new EditBorder(); int borderLeft = 0; int borderRight = 0; int borderTop = 0; int borderBottom = 0; if (SelectObjects.Count == 1) { IBorderable borderable = (IBorderable)SelectObjects[0]; borderLeft = borderable.BorderLeft; borderRight = borderable.BorderRight; borderTop = borderable.BorderTop; borderBottom = borderable.BorderBottom; } if (border.EditBorder(borderLeft, borderRight, borderTop, borderBottom, out borderLeft, out borderRight, out borderTop, out borderBottom) == true) { foreach (IPrintObject ins in SelectObjects) { IBorderable borderable = (IBorderable)ins; borderable.BorderLeft = borderLeft; borderable.BorderRight = borderRight; borderable.BorderTop = borderTop; borderable.BorderBottom = borderBottom; } Record(); } } else if (e.ClickedItem.Text == "颜色") { ColorDialog f = new ColorDialog(); Color def = Color.Black; if (SelectObjects.Count == 1) { IColorable colorable = (IColorable)SelectObjects[0]; def = colorable.Color; } f.Color = def; if (f.ShowDialog() == DialogResult.OK) { foreach (IPrintObject ins in SelectObjects) { IColorable colorable = (IColorable)ins; colorable.Color = f.Color; } Record(); } } else if (e.ClickedItem.Text == "左对齐") { ISizeable sizeable2 = (ISizeable)_fistSelectObject; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable2.Location.X, sizeable.Location.Y); } Record(); } else if (e.ClickedItem.Text == "右对齐") { ISizeable sizeable2 = (ISizeable)_fistSelectObject; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point((sizeable2.Location.X + sizeable2.Size.Width) - sizeable.Size.Width, sizeable.Location.Y); } Record(); } else if (e.ClickedItem.Text == "上对齐") { ISizeable sizeable2 = (ISizeable)_fistSelectObject; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X, sizeable2.Location.Y); } Record(); } else if (e.ClickedItem.Text == "下对齐") { ISizeable sizeable2 = (ISizeable)_fistSelectObject; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X, (sizeable2.Location.Y + sizeable2.Size.Height) - sizeable.Size.Height); } Record(); } else if (e.ClickedItem.Text == "表格内容") { IGridable gridable = (IGridable)_fistSelectObject; List <string> lst = new List <string>(); if (tbdetail != null) { foreach (System.Data.DataColumn col in tbdetail.Columns) { if (col.ColumnName.StartsWith("#") == false) { lst.Add(col.ColumnName); } } } if (lst.Contains("#") == false) { lst.Add("#"); } if (lst.Contains("i") == false) { lst.Add("i"); } if (gridable.EditGrid(lst.ToArray()) == true) { Record(); } } else if (e.ClickedItem.Text == "表格格式") { IGridable gridable = (IGridable)_fistSelectObject; if (gridable.SetStyle() == true) { Record(); } } else if (e.ClickedItem.Text == "导入图片") { OpenFileDialog f = new OpenFileDialog(); if (f.ShowDialog() == DialogResult.OK) { var fileInfo = new System.IO.FileInfo(f.FileName); decimal len = Conv.ToDecimal(fileInfo.Length); len = len / 1024; if (len > 500) { throw new Exception("图片文件大于500K"); } var img = Image.FromFile(f.FileName); IImageAble imageable = (IImageAble)_fistSelectObject; imageable.Image = img; Record(); } } else if (e.ClickedItem.Text == "导出图片") { IImageAble imageable = (IImageAble)_fistSelectObject; if (imageable.Image == null) { throw new Exception("无可导出的图片"); } else { SaveFileDialog f = new SaveFileDialog(); f.Filter = "*.jpg|*.jpg"; if (f.ShowDialog() == DialogResult.OK) { imageable.Image.Save(f.FileName, System.Drawing.Imaging.ImageFormat.Jpeg); } } } else if (e.ClickedItem.Text == "属性") { System.Windows.Forms.MessageBox.Show(_fistSelectObject.propertyInfo, "属性"); } else if (e.ClickedItem.Text == "格式化") { IInput input = new InputFormatString(); string def = ""; if (SelectObjects.Count == 1) { IFormatable formatable = (IFormatable)SelectObjects[0]; def = formatable.Format; } if (input.Input(def, out def) == true) { foreach (IPrintObject ins in SelectObjects) { IFormatable formatable = (IFormatable)ins; formatable.Format = def; } Record(); } } else if (e.ClickedItem.Text == "改字段") { string def = ""; if (SelectObjects.Count == 1) { IFieldAble fieldable = (IFieldAble)SelectObjects[0]; def = fieldable.Field; } IChangeField chg = new ChangeField(); List <string> lst = new List <string>(); if (tbmain != null) { foreach (System.Data.DataColumn col in tbmain.Columns) { lst.Add(col.ColumnName); } } if (chg.Change(lst.ToArray(), def, out def) == true) { foreach (IPrintObject ins in SelectObjects) { IFieldAble fieldable = (IFieldAble)ins; fieldable.Field = def; } Record(); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
private void PrintD_KeyDown(object sender, KeyEventArgs e) { if (e.Shift == true) { if (e.KeyCode == Keys.Up) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Size = new Size(sizeable.Size.Width, sizeable.Size.Height - 1); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Down) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Size = new Size(sizeable.Size.Width, sizeable.Size.Height + 1); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Left) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Size = new Size(sizeable.Size.Width - 1, sizeable.Size.Height); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Right) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Size = new Size(sizeable.Size.Width + 1, sizeable.Size.Height); flag = 1; } if (flag == 1) { Record(); } } if (e.Control == true && e.KeyCode == Keys.Z) { if (operRecord.Next == null) { } else { operRecord.Next.Undo(des); operRecord = operRecord.Next; } } } else if (e.Control == true) { if (e.KeyCode == Keys.A) { foreach (IPrintObject ins in pnl.Controls) { ins.Selected = true; } } if (e.KeyCode == Keys.S) { IDesign des = this; string xml = des.xml; // string t = sheetType; string file = path + "\\print_style\\" + t + ".xml"; System.IO.File.WriteAllText(file, xml, Encoding.GetEncoding("gb2312")); } if (e.KeyCode == Keys.Z) { if (operRecord.Pre == null) { } else { operRecord.Pre.Undo(des); operRecord = operRecord.Pre; } } } else { if (e.KeyCode == Keys.Up) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X, sizeable.Location.Y - 1); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Down) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X, sizeable.Location.Y + 1); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Left) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X - 1, sizeable.Location.Y); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Right) { int flag = 0; foreach (IPrintObject ins in SelectObjects) { ISizeable sizeable = (ISizeable)ins; sizeable.Location = new Point(sizeable.Location.X + 1, sizeable.Location.Y); flag = 1; } if (flag == 1) { Record(); } } else if (e.KeyCode == Keys.Delete) { int flag = 0; List <IPrintObject> lst = new List <IPrintObject>(); foreach (IPrintObject ins in SelectObjects) { lst.Add(ins); } foreach (IPrintObject ins in lst) { if (ins.GetType().GetInterface(typeof(IDeleteable).ToString()) != null) { IDeleteable del = (IDeleteable)ins; del.Delete(pnl); flag = 1; } } if (flag == 1) { Record(); } } } }
//default public Window(ISizeable size) { Width = size.Width; Height = size.Height; }
public Size(ISizeable size) { Width = size.Width; Height = size.Height; }
public Window(ISizeable size, Window parentWindow) { Width = size.Width; Height = size.Height; Parent = parentWindow; }
public ResizeHandle(CompassPoint compassPoint, ISizeable owner) { m_compassPoint = compassPoint; m_owner = owner; }
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { this.contextMenuStrip1.Visible = false; try { if (e.ClickedItem.Text == "保存") { IDesign des = this; string xml = des.xml; // string t = sheetType; string file = path + "\\print_style\\" + t + ".xml"; System.IO.File.WriteAllText(file, xml, Encoding.GetEncoding("gb2312")); } else if (e.ClickedItem.Text == "页面") { IInputSize ins = new InputSizeForPage(); System.Drawing.Size size = pnl.Size; if (ins.Input(size, out size) == true) { pnl.Size = size; Record(); } } else if (e.ClickedItem.Text == "背景") { OpenFileDialog f = new OpenFileDialog(); f.Filter = "*.jpg|*.jpg"; if (f.ShowDialog() == DialogResult.OK) { pnl.BackgroundImage = Image.FromFile(f.FileName); pnl.BackgroundImageLayout = ImageLayout.Stretch; } } else if (e.ClickedItem.Text == "撤销") { if (operRecord.Pre == null) { } else { operRecord.Pre.Undo(des); operRecord = operRecord.Pre; } } else if (e.ClickedItem.Text == "重做") { if (operRecord.Next == null) { } else { operRecord.Next.Undo(des); operRecord = operRecord.Next; } } else if (e.ClickedItem.Text == "文本") { IPrintObject ins = new PrintObject1(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; IContextable contextable = (IContextable)ins; sizeable.Location = this.p; contextable.Context = "普通文本"; ins.Show(pnl); Record(); } else if (e.ClickedItem.Text == "表格") { IPrintObject ins = new PrintObject3(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; ins.Show(pnl); Record(); } else if (e.ClickedItem.Text == "竖线") { IPrintObject ins = new PrintObject4(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; ins.Show(pnl); Record(); } else if (e.ClickedItem.Text == "横线") { IPrintObject ins = new PrintObject5(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; ins.Show(pnl); Record(); } else if (e.ClickedItem.Text == "图片") { IPrintObject ins = new PrintObject6(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; ins.Show(pnl); Record(); } else if (e.ClickedItem.Text == "页码") { IPrintObject ins = new PrintObject7(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; ins.Show(pnl); Record(); } else if (e.ClickedItem.Text == "时间") { IPrintObject ins = new PrintObject8(); ins.SetSelectControl(this); ISizeable sizeable = (ISizeable)ins; sizeable.Location = this.p; ins.Show(pnl); Record(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }