public void drawScreen() { SplitterPanel boardPanel = splitContainer1.Panel2; Bitmap bufl = new Bitmap(boardPanel.Width * 2, boardPanel.Height * 2); bufl.SetResolution(boardUnitBMP.HorizontalResolution, boardUnitBMP.VerticalResolution); using (Graphics g = Graphics.FromImage(bufl)) { //g.ScaleTransform(0.5f, 0.5f); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.FillRectangle(Brushes.White, new Rectangle(0, 0, Width, Height)); UpdateBoard(); DrawPieces(g); DrawBoard(g); //Form1.splitContainer1.Panel2.CreateGraphics().DrawImageUnscaled(bufl, 0, 0); boardPanel.CreateGraphics().DrawImageUnscaled(bufl, 0, 0); bufl.Dispose(); } }
private void SplitContainer_Panel2_Resize(object sender, EventArgs e) { if (_outputKrystal == null) { return; } SplitterPanel c = sender as SplitterPanel; using (Graphics g = c.CreateGraphics()) { Font font = SystemFonts.DefaultFont; string yInputFilename = _outputKrystal.YInputFilename; SizeF nameSize = g.MeasureString(yInputFilename, font); int xPos = (int)((c.Width - _uintTable.Width + nameSize.Width) / 2); if (xPos - nameSize.Width - 12 < 0) { xPos = (int)((c.Width - _uintTable.Width) / 2); } int yPos = (int)((c.Height - _uintTable.Height) / 2); _uintTable.Location = new Point(xPos, yPos); } }
/* * Met à jour l'écran en mode édition (pour le titre de la checklist) */ public static void updateEditionCheck(TextBox titreChecklist, RichTextBox shortDesc, SplitterPanel panel) { // Control controle = titreChecklist.Parent; // Graphics g = controle.CreateGraphics(); if (titreChecklist.ReadOnly == false) { Graphics g = panel.CreateGraphics(); Pen p = new Pen(Color.LightGray); Pen p2 = new Pen(Color.LightGray); if (titreChecklist.Focused) { p = new Pen(Constantes.pink); } if (shortDesc.Focused) { p2 = new Pen(Constantes.pink); } g.Clear(panel.BackColor); g.DrawLine(p, new Point(titreChecklist.Left, titreChecklist.Bottom + 2), new Point(titreChecklist.Right, titreChecklist.Bottom + 2)); g.DrawRectangle(p2, shortDesc.Left - 1, shortDesc.Top - 1, shortDesc.Width + 2, shortDesc.Height + 2); } }