public TunnelManagerFrm() { InitializeComponent(); ucToolBar.IconImage = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("add.png"); this.Load += new EventHandler(TunnelManagerFrm_Load); }
/// <summary> /// 私有的单元格重绘方法,根据鼠标是否移动到按钮上,对按钮的不同背景和边框进行绘制。 /// </summary> private Rectangle PrivatePaint(Graphics graphics, Rectangle cellBounds, int rowIndex, DataGridViewCellStyle cellStyle, bool clearBackground) { if (mouseOnDetailButton) // 鼠标移动到查看详细按钮上,更换背景及边框颜色 { ImageDetail = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("BtnView02.png"); penDetail = new Pen(Color.FromArgb(162, 144, 77)); } else { ImageDetail = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("BtnView.png"); penDetail = new Pen(Color.FromArgb(135, 163, 193)); } if (clearBackground) // 是否需要重绘单元格的背景颜色 { Brush brushCellBack = (rowIndex == this.DataGridView.CurrentRow.Index) ? new SolidBrush(cellStyle.SelectionBackColor) : new SolidBrush(cellStyle.BackColor); graphics.FillRectangle(brushCellBack, cellBounds.X + 1, cellBounds.Y + 1, cellBounds.Width - 2, cellBounds.Height - 2); } Rectangle recDetail = new Rectangle(cellBounds.Location.X + (cellBounds.Width - ImageDetail.Width) / 2, cellBounds.Location.Y + (cellBounds.Height - ImageDetail.Height) / 2, ImageDetail.Width, ImageDetail.Height); graphics.DrawImage(ImageDetail, recDetail); graphics.DrawRectangle(penDetail, recDetail.X, recDetail.Y - 1, recDetail.Width, recDetail.Height); return(cellBounds); }
void MainFrm_Load(object sender, EventArgs e) { this.Left = 0; this.Top = 0; this.Width = Screen.PrimaryScreen.WorkingArea.Width; this.Height = Screen.PrimaryScreen.WorkingArea.Height; userToolStripMenuItem.Image = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("user72.png"); dataToolStripMenuItem.Image = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("data72.png"); dockPanelContent.BackgroundImage = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("bkg_blueteacup.jpg"); dockPanelContent.BackgroundImageLayout = ImageLayout.Stretch; tableLayPanelMiddle.BackgroundImage = ResourceDynamicReaderUtils.DynamicLoadResourceByResourceName("bg.png"); tableLayPanelMiddle.BackgroundImageLayout = ImageLayout.Stretch; panelLeftColumn.BackColor = Color.Transparent; linkLblChangePwd.BackColor = Color.Transparent; linkLblExit.BackColor = Color.Transparent; string diplayLoginInfo = lblDisplayLoginInfo.Text; lblDisplayLoginInfo.Text = string.Format(diplayLoginInfo, currentLoginUser.UserName); }