public MetroForFly( System.Windows.Forms.Control fatherControl, // 父容器 int flyWidth, int flyHeight, System.Drawing.Point locationPoint, // 整体位置 System.Windows.Forms.AnchorStyles anchorstyle ) { // 包裹外层 var panelSec = new HPanel { Size = new System.Drawing.Size(flyWidth, flyHeight), Location = locationPoint, Anchor = anchorstyle, BackColor = System.Drawing.Color.Transparent }; Size = new System.Drawing.Size(flyWidth + 3 + 12, flyHeight + 3); Location = new System.Drawing.Point(-3, -3); BackColor = System.Drawing.Color.Transparent; Anchor = BaseAnchor.AnchorFill; AllowDrop = true; AutoScroll = true; MouseDown += MetroForFly_MouseDown; DragEnter += MetroForFly_DragEnter; // 加载实体层 panelSec.Controls.Add(this); // 加载包裹外层 fatherControl.Controls.Add(panelSec); }
public MetroForView( System.Windows.Forms.Control fatherControl, // 父容器 string nullTip, int viewWidth, int viewHeight, System.Drawing.Color backColor, // 背景颜色 System.Drawing.Font font, // 背景字体 System.Drawing.Point locationPoint, // 整体位置 System.Windows.Forms.AnchorStyles anchorstyle ) { NullTip = nullTip; SetStyle( System.Windows.Forms.ControlStyles.UserPaint | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.ResizeRedraw, true); // 包裹外层 var panelSec = new HPanel { Size = new System.Drawing.Size(viewWidth, viewHeight), Location = locationPoint, Anchor = anchorstyle, BackColor = backColor, }; // 加载包裹外层 fatherControl.Controls.Add(panelSec); Size = new System.Drawing.Size(viewWidth + 3 + 12, viewHeight - 4); Location = new System.Drawing.Point(-3, 4); BackColor = backColor; Anchor = BaseAnchor.AnchorFill; Font = font; AllowDrop = true; AutoScroll = true; DragEnter += QueCardCell_DragEnter; MouseDown += QueCardCell_MouseDown; // 加载实体层 panelSec.Controls.Add(this); UpdateStyles(); }
public LPanel( System.Windows.Forms.Control parentpal, int lineint, System.Drawing.Size size, System.Drawing.Point point, System.Drawing.Color linecolor, System.Drawing.Color backcolor, System.Windows.Forms.AnchorStyles anchorstyle ) { var panelSec = new HPanel { Size = size, Location = point, Anchor = anchorstyle, BackColor = linecolor, }; Size = new System.Drawing.Size(panelSec.Size.Width - 2*lineint, panelSec.Size.Height - 2*lineint); Location = new System.Drawing.Point(lineint, lineint); BackColor = backcolor; Anchor = BaseAnchor.AnchorFill; panelSec.Controls.Add(this); parentpal.Controls.Add(panelSec); }
public LButton( System.Windows.Forms.Control parentpal, int lineint, string text, System.Drawing.Font font, System.Drawing.Size size, System.Drawing.Point point, System.Drawing.Color linecolor, System.Drawing.Color linelight, System.Drawing.Color backcolor, System.Drawing.Color backlight, System.Drawing.Color forecolor, System.Drawing.Color forelight, System.Windows.Forms.AnchorStyles anchorstyle ) { Linecolor = linecolor; Linelight = linelight; Backcolor = backcolor; Backlight = backlight; Forecolor = forecolor; Forelight = forelight; var panelSec = new HPanel { Size = size, Location = point, Anchor = anchorstyle, BackColor = linecolor, }; Text = text; Font = font; TextAlign = System.Drawing.ContentAlignment.MiddleCenter; Size = new System.Drawing.Size(panelSec.Size.Width - 2*lineint, panelSec.Size.Height - 2*lineint); Location = new System.Drawing.Point(lineint, lineint); ForeColor = Forecolor; BackColor = Backcolor; Anchor = System.Windows.Forms.AnchorStyles.Top; Cursor = System.Windows.Forms.Cursors.Hand; panelSec.Controls.Add(this); parentpal.Controls.Add(panelSec); MouseUp += LButton_MouseUp; MouseDown += LButton_MouseDown; MouseHover += LButton_MouseHover; MouseLeave += LButton_MouseLeave; }
public MoodForPaper( System.Windows.Forms.Control fatherControl, // 父容器 int paperWidth, // 每个小单元的宽度 int paperHeight, // 每个小单元的高度 int paperCheight, int paperCWidth, int topmargin, int topheader, string papertitle, string papersubmit, System.Drawing.Image image, System.Windows.Forms.DragEventHandler palDragDrop ) { if (image != null) { Image = image; } PaperCWidth = paperCWidth; PalDragDrop = palDragDrop; Size = new System.Drawing.Size(paperWidth, paperHeight); BackgroundImage = new ResxHelper().GetImage("wood.gif"); // var beforeHeader = new HPanel { Size = new System.Drawing.Size(paperCWidth + topheader, 121),// 686 Location = new System.Drawing.Point((paperWidth - paperCWidth - topheader) / 2, topmargin), BackgroundImage = new ResxHelper().GetImage("grouping-before.png"), BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch }; Controls.Add(beforeHeader); // MainHpaper var hPaper = new HPanel { Size = new System.Drawing.Size(beforeHeader.Width - 18, paperCheight + 48 + topheader + topmargin+10), Location = new System.Drawing.Point((paperWidth - beforeHeader.Width) / 2 + 9, topmargin+9), BackColor = System.Drawing.Color.White, }; Controls.Add(hPaper); hPaper.BringToFront(); hPaper.Controls.Add(new ELabel{ Size = new System.Drawing.Size(1, 1), Dock = System.Windows.Forms.DockStyle.Left, BackColor = System.Drawing.Color.FromArgb(233, 233, 233) }); hPaper.Controls.Add(new ELabel { Size = new System.Drawing.Size(1, 1), Dock = System.Windows.Forms.DockStyle.Right, BackColor = System.Drawing.Color.FromArgb(233, 233, 233) }); // paperheader var paperheader = new HPanel { Size = new System.Drawing.Size(hPaper.Width-2, topheader), BackColor = System.Drawing.Color.FromArgb(252, 252, 252), Location = new System.Drawing.Point(1, 0) }; hPaper.Controls.Add(paperheader); // paperheader line paperheader.Controls.Add( new ELabel{ Size = new System.Drawing.Size(paperheader.Width, 1), Dock = System.Windows.Forms.DockStyle.Bottom, BackColor = System.Drawing.Color.FromArgb(235, 235, 235) }); if (!papertitle.IsNullOrEmptyOrSpace()) { Title = new ELabel { Text = " " + papertitle, Size = new System.Drawing.Size(paperheader.Width, paperheader.Height - 1), Location = new System.Drawing.Point(0, 0), TextAlign = BaseAlign.AlignMiddleLeft, ForeColor = BasePublic.Ui.BackColor, Font = new System.Drawing.Font(BasePublic.KcpFrmFont, 28F), Anchor = BaseAnchor.AnchorFill }; paperheader.Controls.Add(Title); Title.MouseDown += Title_MouseDown; } // paperFooter var paperFooter = new HPanel { Size = new System.Drawing.Size(hPaper.Width-2, 48), BackColor = System.Drawing.Color.FromArgb(250, 250, 250), Location = new System.Drawing.Point(1, hPaper.Height - 48) }; hPaper.Controls.Add(paperFooter); // paperFooter line paperFooter.Controls.Add( new ELabel { Size = new System.Drawing.Size(paperFooter.Width, 1), Dock = System.Windows.Forms.DockStyle.Top, BackColor = System.Drawing.Color.FromArgb(227, 231, 234), }); if (!papersubmit.IsNullOrEmptyOrSpace()) { Submit = new ELabel { Text = papersubmit, Size = new System.Drawing.Size(paperFooter.Width, paperFooter.Height - 1), Location = new System.Drawing.Point(0, 1), TextAlign = BaseAlign.AlignMiddleCenter, ForeColor = BasePublic.Ui.BackColor, Font = new System.Drawing.Font(BasePublic.KcpFrmFont, 14F), Anchor = BaseAnchor.AnchorFill, Cursor = System.Windows.Forms.Cursors.Hand }; paperFooter.Controls.Add(Submit); Submit.MouseDown += Submit_MouseDown; } // PaperFly Paper = new MetroForFly( hPaper, paperCWidth, paperCheight, new System.Drawing.Point((hPaper.Width - paperCWidth) / 2, paperheader.Height + 10), BaseAnchor.AnchorFill ); Paper.DragDrop += PalDragDrop; // LowFooter Controls.Add(new HPanel { Size = new System.Drawing.Size(beforeHeader.Width, 18), BackgroundImage = new ResxHelper().GetImage("grouping-after.png"), BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch, Location = new System.Drawing.Point(beforeHeader.Location.X, hPaper.Location.Y + hPaper.Height - 9) }); fatherControl.Controls.Add(this); }