private void Initialize() { this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.UpdateStyles(); this.AutoScaleMode = AutoScaleMode.Font; this.Paint += new PaintEventHandler(HandlePaint); this.Resize += new EventHandler(HandleResize); this.xMin = 0; this.xMax = 1; this.yMin = 0; this.yMax = 1; this.leftFrameWidth = DEFAULT_FRAME_WIDTH; this.rightFrameWidth = DEFAULT_FRAME_HEIGHT; // Yes, use height here. this.topFrameHeight = DEFAULT_FRAME_HEIGHT; this.bottomFrameHeight = DEFAULT_FRAME_HEIGHT; this.Font = new System.Drawing.Font(new FontFamily("Times New Roman"), this.Font.Size); frameBackColor = Color.White; plotBackColor = Color.White; axisColor = Color.Black; axisThickness = 1; horizontalAxisVisible = false; verticalAxisVisible = false; gridColor = Color.DarkGray; gridLineThickness = 1; gridVisible = false; // ToDo: Perhaps change to false as default majorHorizontalTickMarksVisible = true; majorVerticalTickMarksVisible = true; majorTickMarkThickness = DEFAULT_MAJOR_TICK_MARK_THICKNESS; majorTickMarkLength = DEFAULT_MAJOR_TICK_MARK_LENGTH; tickMarkColor = Color.Black; horizontalAxisMarkingsVisible = true; horizontalAxisMarkingsFormatString = DEFAULT_FORMAT_STRING; axisMarkingsColor = Color.Black; verticalAxisMarkingsVisible = true; verticalAxisMarkingsFormatString = DEFAULT_FORMAT_STRING; horizontalAxisLabelVisible = true; horizontalAxisLabel = ""; horizontalAxisLabelFontSize = this.Font.Size; verticalAxisLabelVisible = true; verticalAxisLabel = ""; verticalAxisLabelFontSize = this.Font.Size; generatePostscript = false; postscriptRenderer = null; Invalidate(); }
public void SaveAsPostscript(string filePath) { postscriptRenderer = new PostscriptRenderer(); postscriptRenderer.SetSize(0, 0, this.Width, this.Height); generatePostscript = true; Refresh(); generatePostscript = false; postscriptRenderer.MakeHeader(); postscriptRenderer.SaveToFile(filePath); }