/// <summary> /// 磁贴控件 /// </summary> /// <param name="item"></param> /// <param name="tileMouseClick"></param> public Tile(Info.TileItem item, System.Windows.Forms.MouseEventHandler tileMouseClick) { Item = item; Size = new System.Drawing.Size(285, (285 - 8)/2); BackColor = item.BColor; BackgroundImage = item.PluginBg; BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; HLabel title = null; if (!item.Title.IsNullOrEmptyOrSpace()) { title = new HLabel( this, " " + item.Title, new System.Drawing.Font(BasePublic.KcpFrmFont, 14F), new System.Drawing.Size(Width, 28), new System.Drawing.Point(0, Height - 28), item.FColor, item.BColor, BaseAlign.AlignMiddleLeft, BaseAnchor.AnchorBottomFill ) { Cursor = System.Windows.Forms.Cursors.Hand }; title.MouseClick += tileMouseClick; } if (!item.LogoFontDesc.IsNullOrEmptyOrSpace() && item.LogoFontFamily != null) { var logo = new ELabel { Size = new System.Drawing.Size(Width, title == null ? (Width - 8) / 2 : (Width - 8) / 2 - title.Height), Location = new System.Drawing.Point(0, 0), Font = new System.Drawing.Font(item.LogoFontFamily, 45F), ForeColor = System.Drawing.Color.WhiteSmoke, Text = item.LogoFontDesc, Cursor = System.Windows.Forms.Cursors.Hand, TextAlign = BaseAlign.AlignMiddleCenter, BackColor = System.Drawing.Color.Transparent, Anchor = BaseAnchor.AnchorFill }; Controls.Add(logo); logo.MouseClick += tileMouseClick; } }
public FLines( System.Windows.Forms.Control thisFather, System.Drawing.Size thisSize, System.Drawing.Point thisPoint, System.Drawing.Color thisBgColor, System.Collections.Generic.List<System.Drawing.Color> thisColors, System.Windows.Forms.MouseEventHandler clickButtonHandler, System.Windows.Forms.AnchorStyles thisAnchor ) { Size = thisSize; Location = new System.Drawing.Point(0, 0); AllowDrop = true; DragEnter += FLines_DragEnter; MouseDown += FLines_MouseDown; Anchor = thisAnchor; var fatherLine = new ELabel { Size = new System.Drawing.Size(7, thisSize.Height), BackColor = thisColors[0], Location = new System.Drawing.Point(thisSize.Width, 0) }; var fatherfather = new EPanel { Size = new System.Drawing.Size(thisSize.Width + 7, thisSize.Height), BackColor = thisBgColor, Location = thisPoint }; thisFather.Controls.Add(fatherfather); fatherfather.Controls.Add(fatherLine); fatherfather.Controls.Add(this); for (var i = 0; i < thisColors.Count; i++) { var clickButton = new ELabel { Size = new System.Drawing.Size(thisSize.Width, 50), BackColor = thisColors[i], Location = new System.Drawing.Point(0, 50*i), Text = @" X-Force" + i, ForeColor = System.Drawing.Color.FromArgb(255, 255, 255), Font = new System.Drawing.Font("Segoe UI", 22F), TextAlign = BaseAlign.AlignMiddleLeft, Cursor = System.Windows.Forms.Cursors.Hand }; var clickimage = new ELabel { Size = new System.Drawing.Size(50, 50), Text = "à", Font = new System.Drawing.Font("Wingdings", 28F), Location = new System.Drawing.Point(clickButton.Size.Width - 56, 4), TextAlign = BaseAlign.AlignMiddleCenter, BackColor = System.Drawing.Color.Transparent }; clickButton.MouseClick += clickButtonHandler; clickButton.MouseHover += clickButton_MouseHover; clickButton.MouseLeave += clickButton_MouseLeave; Controls.Add(clickButton); clickButton.Controls.Add(clickimage); } }
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); }
public MetroForListItem( System.Windows.Forms.Control fatherControl, bool isTitleDesc, bool isCanEdit, bool isButton, bool isImage, bool isTable, System.Drawing.Color foreColor, System.Drawing.Color backColor, System.Drawing.FontFamily fontFamily, object listItemDescTxt, object listItemDescTip, System.Windows.Forms.MouseEventHandler listItemMouseClick, // 小单元点击事件 System.Windows.Forms.MouseEventHandler listItemTagMouseClick // 小单元点击事件 ) { #region MetroForListItem ForeColor = foreColor; BackColor = backColor; IsTitleDesc = isTitleDesc; IsCanEdit = isCanEdit; IsButton = isButton; IsImage = isImage; IsTable = isTable; FontFamily = fontFamily; if(listItemDescTxt==null) return; var descTxt = listItemDescTxt.ToString(); if (descTxt.Contains("Button")) { IsButton = true; descTxt = descTxt.Replace("Button", ""); } if (descTxt.Contains("Select")) { IsSelect = true; descTxt = descTxt.Replace("Select", ""); } if (descTxt.Contains("Large")) { IsLarge = true; descTxt = descTxt.Replace("Large", ""); } if (descTxt.Contains("Image")) { IsImage = true; descTxt = descTxt.Replace("Image", ""); } if (descTxt.Contains("Desc")) { IsTitleDesc = true; descTxt = descTxt.Replace("Desc", ""); } if (descTxt.Contains("Tag")) { IsTag = true; descTxt = descTxt.Replace("Tag", ""); } descTxt = descTxt.Replace(",", ""); if (IsImage) { Controls.Add(new EPicBox { Image = descTxt.LoadLocalImage(), SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage, Dock = System.Windows.Forms.DockStyle.Fill }); } if (descTxt == "Empty") { IsEmpty = true; } else { ListItemTxt = new ELabel { Text = IsEmpty ? "" : descTxt, Dock = System.Windows.Forms.DockStyle.Fill, Font = IsLarge ? new System.Drawing.Font(fontFamily, 15F) : IsTitleDesc ? new System.Drawing.Font(fontFamily, 15F) : new System.Drawing.Font(fontFamily, 12.5F), TextAlign = BaseAlign.AlignMiddleCenter, ForeColor = IsSelect ? backColor : foreColor, Cursor = IsTitleDesc ? System.Windows.Forms.Cursors.Default : System.Windows.Forms.Cursors.Hand, BackColor = IsSelect ? foreColor : backColor }; Controls.Add(ListItemTxt); if (IsTable) { ListItemTxt.Tag = listItemDescTip; Tag = listItemDescTip; } ListItemTxt.MouseClick += listItemMouseClick; if (IsTag) { listItemDescTip = "X"; ListItemTxt.MouseDown += ListItemTxt_MouseDown; } if (!IsTable && listItemDescTip != null) { if (!isButton) { var tag = new ELabel { Text = listItemDescTip.ToString(), Size = new System.Drawing.Size(30, 19), Location = new System.Drawing.Point(Width - 30, IsTag ? ListItemTxt.Height - 49 : ListItemTxt.Height - 19), Anchor = BaseAnchor.AnchorBottomRight, TextAlign = BaseAlign.AlignTopCenter, BackColor = IsTag ? backColor : foreColor, ForeColor = IsTag ? foreColor : backColor, Font = IsTag ? new System.Drawing.Font("微软雅黑", 10.5F) : new System.Drawing.Font(fontFamily, 10.5F) }; ListItemTxt.Controls.Add(tag); if (IsTag) { tag.MouseClick += listItemTagMouseClick; } } } else { ListItemTxt.MouseDown += ListItemTxt_MouseDown; if (IsButton) { ListItemTxt.MouseUp += ListItemTxt_MouseUp; } } if (IsCanEdit) { ListItemTxt.DoubleClick += ListItemTxt_DoubleClick; } } fatherControl.Controls.Add(this); #endregion }