/// <summary> /// Metoda volaná pro vykreslování obsahu "Přes Child prvky". /// </summary> /// <param name="e"></param> /// <param name="boundsAbsolute"></param> /// <param name="drawMode"></param> public void DrawOverChilds(GInteractiveDrawArgs e, Rectangle boundsAbsolute, DrawItemMode drawMode) { Rectangle boundsVisibleAbsolute = boundsAbsolute; if (e.DrawLayer == GInteractiveDrawLayer.Standard) { boundsVisibleAbsolute = e.GetClip(boundsAbsolute); } this.ControlBuffered.DrawImages(e, ref boundsAbsolute, boundsVisibleAbsolute, drawMode); if (!this.DrawTextInCurrentState) { return; } if (e.DrawLayer == GInteractiveDrawLayer.Standard) { boundsVisibleAbsolute = e.GetClip(boundsAbsolute); } FontInfo fontInfo = FontInfo.CaptionBold; ExtendedContentAlignment textPosition = this.TextPosition; string text = this.GetCaption(e, boundsAbsolute, boundsVisibleAbsolute, fontInfo, textPosition); if (String.IsNullOrEmpty(text)) { return; } this.ControlBuffered.DrawText(e, boundsVisibleAbsolute, text, fontInfo, textPosition); }
/// <summary> /// Vykreslí tuto grupu. /// Grupa se kreslí pouze tehdy, pokud obsahuje více než 1 prvek, a pokud vrstva <see cref="ITimeGraphItem.Layer"/> je nula nebo kladná (pro záp**né vrstvy se nekreslí). /// </summary> /// <param name="e">Standardní data pro kreslení</param> /// <param name="boundsAbsolute">Absolutní souřadnice tohoto prvku</param> /// <param name="drawMode">Režim kreslení (má význam pro akce Drag and Drop)</param> public void Draw(GInteractiveDrawArgs e, Rectangle boundsAbsolute, DrawItemMode drawMode) { if (!this.IsValidRealTime || this.Layer < 0 || this.ItemCount <= 1) { return; } this.ControlBuffered.DrawItem(e, boundsAbsolute, drawMode); }
/// <summary> /// Vrátí danou barvu, s modifikovanou průhledností Opacity (<see cref="Color.A"/>). /// Zadaná Opacity je respektována, ale pokud celý graf má deklarovaou svoji průhlednost v <see cref="TimeGraph.GraphOpacity"/>, pak je akceptována rovněž. /// A dále, pokud se aktuálně kreslí do vrstvy <see cref="GInteractiveDrawLayer.Interactive"/>, pak je akceptována i hodnota <see cref="DragDropDrawInteractiveOpacity"/>. /// </summary> /// <param name="baseColor">Výchozí barva, typicky BackColor nebo ForeColor prvku grafu.</param> /// <param name="drawLayer">Vykreslovaná vrstva grafiky</param> /// <param name="drawMode">Režim kreslení předaný systémem</param> /// <param name="forGroup">true = pro barvu grupy / false = pro barvu prvku</param> /// <param name="forBackColor">true = pro barvu pozadí / false = pro barvu okrajů, čar a textů</param> /// <returns></returns> public Color GetColorWithOpacity(Color baseColor, GInteractiveDrawLayer drawLayer, DrawItemMode drawMode, bool forGroup, bool forBackColor) { if (!this.IsDragged) { // Běžný stav prvku, kdy tento pvek není přetahován jinam: return(this._GetColorWithOpacityStandard(baseColor, forGroup, forBackColor, null)); } else { // Drag and Drop tohoto prvku, kdy prvek je přemisťován jinam: if (drawLayer == GInteractiveDrawLayer.Standard) { return(this._GetColorWithOpacityDragOriginal(baseColor, forGroup, forBackColor)); } else { return(this._GetColorWithOpacityDragTarget(baseColor, forGroup, forBackColor)); } } }
/// <summary> /// Vrátí danou barvu, s modifikovanou průhledností Opacity (<see cref="Color.A"/>). /// Zadaná Opacity je respektována, ale pokud celý graf má deklarovaou svoji průhlednost v <see cref="TimeGraph.GraphOpacity"/>, pak je akceptována rovněž. /// A dále, pokud se aktuálně kreslí do vrstvy <see cref="GInteractiveDrawLayer.Interactive"/>, pak je akceptována i hodnota <see cref="DragDropDrawInteractiveOpacity"/>. /// </summary> /// <param name="baseColor">Výchozí barva, typicky BackColor nebo ForeColor prvku grafu.</param> /// <param name="drawLayer">Vykreslovaná vrstva grafiky</param> /// <param name="drawMode">Režim kreslení předaný systémem</param> /// <param name="forGroup">true = pro barvu grupy / false = pro barvu prvku</param> /// <param name="forBackColor">true = pro barvu pozadí / false = pro barvu okrajů, čar a textů</param> /// <returns></returns> public Color?GetColorWithOpacity(Color?baseColor, GInteractiveDrawLayer drawLayer, DrawItemMode drawMode, bool forGroup, bool forBackColor) { if (!baseColor.HasValue) { return(null); } return(this.GetColorWithOpacity(baseColor.Value, drawLayer, drawMode, forGroup, forBackColor)); }
/// <summary> /// Kreslení prvku HORIZONAL /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected void DrawHorizontal(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { Rectangle beginBounds = new Rectangle(absoluteBounds.X, absoluteBounds.Y, absoluteBounds.Width, 1); Rectangle centerBounds = new Rectangle(absoluteBounds.X, absoluteBounds.Y + 1, absoluteBounds.Width, absoluteBounds.Height - 2); Rectangle endBounds = new Rectangle(absoluteBounds.X, absoluteBounds.Bottom - 1, absoluteBounds.Width, 1); this.DrawResizer(e, beginBounds, centerBounds, endBounds); }
void ITimeGraphItem.Draw(GInteractiveDrawArgs e, Rectangle boundsAbsolute, DrawItemMode drawMode) { this.Draw(e, boundsAbsolute, drawMode); }
/// <summary> /// Kreslení prvku /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected override void Draw(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { if (!this._ResizeControl.ShowResizeAllways && !this.ParentHasMouse) { return; } if (this.Orientation == Orientation.Vertical) { this.DrawVertical(e, absoluteBounds, absoluteVisibleBounds, drawMode); } else { this.DrawHorizontal(e, absoluteBounds, absoluteVisibleBounds, drawMode); } }
/// <summary> /// Kreslení prvku VERTICAL /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected void DrawVertical(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { Rectangle beginBounds = new Rectangle(absoluteBounds.X, absoluteBounds.Y, 1, absoluteBounds.Height); Rectangle centerBounds = new Rectangle(absoluteBounds.X + 1, absoluteBounds.Y, absoluteBounds.Width - 2, absoluteBounds.Height); Rectangle endBounds = new Rectangle(absoluteBounds.Right - 1, absoluteBounds.Y, 1, absoluteBounds.Height); this.DrawResizer(e, beginBounds, centerBounds, endBounds); }
/// <summary> /// Vykreslí pozadí. /// Bázová metoda <see cref="TextObject.DrawBackground(GInteractiveDrawArgs, Rectangle, Rectangle, DrawItemMode)"/> /// vyvolá prosté kreslení pozadí <see cref="InteractiveObject.Draw(GInteractiveDrawArgs, Rectangle, Rectangle, DrawItemMode)"/>. /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected virtual void DrawBackground(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { base.Draw(e, absoluteBounds, absoluteVisibleBounds, drawMode); // Background }
/// <summary> /// Vykreslí rámeček. /// Bázová metoda <see cref="TextObject.DrawBorder(GInteractiveDrawArgs, Rectangle, Rectangle, DrawItemMode)"/> nekeslí nic. /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected virtual void DrawBorder(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { }
/// <summary> /// Vykreslí text /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected override void Draw(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { this.DrawBackground(e, absoluteBounds, absoluteVisibleBounds, drawMode); // Background this.DrawText(e, absoluteBounds, absoluteVisibleBounds, drawMode); // Text this.DrawBorder(e, absoluteBounds, absoluteVisibleBounds, drawMode); // Rámeček }
/// <summary> /// Draw this item in standard mode /// </summary> /// <param name="e">Data pro kreslení</param> /// <param name="absoluteBounds">Absolutní souřadnice tohoto prvku, sem by se mělo fyzicky kreslit</param> /// <param name="absoluteVisibleBounds">Absolutní souřadnice tohoto prvku, oříznuté do viditelné oblasti.</param> /// <param name="drawMode">Režim kreslení (pomáhá řešit Drag and Drop procesy)</param> protected override void Draw(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { bool isGhost = (drawMode.HasFlag(DrawItemMode.Ghost)); if (!isGhost) { this.DrawStandardBackground(e, absoluteBounds); } else { this.DrawGhostBackground(e, absoluteBounds); } bool isTarget = (drawMode.HasFlag(DrawItemMode.DraggedBounds)); if (isTarget) { this.DrawChildItems(e); } }
/// <summary> /// Vykreslí text /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected override void DrawText(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { string text = this.Text; if (!String.IsNullOrEmpty(text)) { Painter.DrawString(e.Graphics, text, this.FontCurrent, absoluteBounds, this.Alignment, color: this.TextColorCurrent); } }
protected override void Draw(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { var style = this.StyleCurrent; var borderType = style.BorderType; int borderWidth = Painter.GetBorderWidth(borderType); var interactiveState = VisualInteractiveState; var backColor = style.GetBackColor(interactiveState); var borderColor = style.GetBorderColor(interactiveState); Rectangle backBounds = absoluteBounds.Enlarge(-borderWidth); Painter.DrawAreaBase(e.Graphics, backBounds, backColor, System.Windows.Forms.Orientation.Horizontal, interactiveState); Painter.DrawBorder(e.Graphics, absoluteBounds, borderColor, borderType, interactiveState); }
/// <summary> /// Vykreslí TrackBar /// </summary> /// <param name="e"></param> /// <param name="absoluteBounds"></param> /// <param name="absoluteVisibleBounds"></param> /// <param name="drawMode"></param> protected override void Draw(GInteractiveDrawArgs e, Rectangle absoluteBounds, Rectangle absoluteVisibleBounds, DrawItemMode drawMode) { Painter.DrawTrackBar(e.Graphics, absoluteBounds, this.Layout); }