private void YobaButtonAbs_MouseHoverBGChange(object sender, EventArgs e) { MouseHoverState = true; BackgroundImageLayout = StyleInfo.BgImageHover.ImageLayout; BackgroundImage = YU.readBitmap(PreloaderForm.IMGPATH + StyleInfo.BgImageHover.Path); }
private void YobaButtonAbs_MouseDownBGChange(object sender, EventArgs e) { BackgroundImageLayout = StyleInfo.BgImageClick.ImageLayout; BackgroundImage = YU.readBitmap(PreloaderForm.IMGPATH + StyleInfo.BgImageClick.Path); }
public virtual void ApplyUIStyles(UIElement styleInfo) { StyleInfo = styleInfo; UseVisualStyleBackColor = true; if (styleInfo.Position != null) { Location = new Point(styleInfo.Position.X, styleInfo.Position.Y); } if (styleInfo.Size != null) { Size = new Size(styleInfo.Size.X, styleInfo.Size.Y); } if (styleInfo.Caption != null) { Text = styleInfo.Caption; } if (styleInfo.CustomStyle) { FlatStyle = FlatStyle.Flat; ForeColor = YU.colorFromString(styleInfo.Color, BtnColors.Fore); FlatAppearance.BorderColor = YU.colorFromString(styleInfo.BorderColor, BtnColors.Border); } if (styleInfo.BgImage != null && YU.stringHasText(styleInfo.BgImage.Path)) { styleInfo.BgImage.ImageLayout = ImageLayout.Stretch; if (YU.stringHasText(styleInfo.BgImage.Layout)) { if (Enum.TryParse(styleInfo.BgImage.Layout, out ImageLayout layout)) { styleInfo.BgImage.ImageLayout = layout; } } BackgroundImageLayout = styleInfo.BgImage.ImageLayout; BackgroundImage = YU.readBitmap(PreloaderForm.IMGPATH + styleInfo.BgImage.Path); if (styleInfo.BgImageClick != null && YU.stringHasText(styleInfo.BgImageClick.Path)) { styleInfo.BgImageClick.ImageLayout = ImageLayout.Stretch; if (YU.stringHasText(styleInfo.BgImageClick.Layout)) { if (Enum.TryParse(styleInfo.BgImageClick.Layout, out ImageLayout layout)) { styleInfo.BgImageClick.ImageLayout = layout; } } MouseDown += YobaButtonAbs_MouseDownBGChange; MouseUp += YobaButtonAbs_MouseUpBGChange; } if (styleInfo.BgImageHover != null && YU.stringHasText(styleInfo.BgImageHover.Path)) { styleInfo.BgImageHover.ImageLayout = ImageLayout.Stretch; if (YU.stringHasText(styleInfo.BgImageHover.Layout)) { if (Enum.TryParse(styleInfo.BgImageHover.Layout, out ImageLayout layout)) { styleInfo.BgImageHover.ImageLayout = layout; } } MouseEnter += YobaButtonAbs_MouseHoverBGChange; MouseLeave += YobaButtonAbs_MouseLeaveBGChange; } } }