public override void DrawScrollBarThumb(PaintEventArgs e, Rectangle bounds, ScrollBarThumb thumb) { Graphics graphics = e.Graphics; Orientation orientation = thumb.ScrollBar.Orientation; ActiproSyntaxEditorRenderer.ScrollbarStatus scrollbarStatus = this.GetScrollbarStatus(thumb.GetDrawState()); if (scrollbarStatus == ActiproSyntaxEditorRenderer.ScrollbarStatus.Disabled) { return; } Image thumbImage1 = this.GetThumbImage(orientation, ActiproSyntaxEditorRenderer.SliderRegion.FirstRegion, scrollbarStatus); Image thumbImage2 = this.GetThumbImage(orientation, ActiproSyntaxEditorRenderer.SliderRegion.MiddleRegion, scrollbarStatus); Image thumbImage3 = this.GetThumbImage(orientation, ActiproSyntaxEditorRenderer.SliderRegion.LastRegion, scrollbarStatus); if (thumb.ScrollBar.Orientation == Orientation.Horizontal) { thumbImage1.RotateFlip(RotateFlipType.Rotate180FlipX); thumbImage2.RotateFlip(RotateFlipType.Rotate180FlipX); thumbImage3.RotateFlip(RotateFlipType.Rotate180FlipX); } try { Rectangle scrollbarRegionBounds1 = this.GetScrollbarRegionBounds(bounds, orientation, ActiproSyntaxEditorRenderer.SliderRegion.FirstRegion); graphics.DrawImage(thumbImage1, scrollbarRegionBounds1); if (this.ShouldDrawMiddleRegion(bounds, orientation)) { Rectangle scrollbarRegionBounds2 = this.GetScrollbarRegionBounds(bounds, orientation, ActiproSyntaxEditorRenderer.SliderRegion.MiddleRegion); ImageAttributes imageAttr = new ImageAttributes(); imageAttr.SetWrapMode(WrapMode.Tile); graphics.DrawImage(thumbImage2, scrollbarRegionBounds2, 0, 0, thumbImage2.Width, thumbImage2.Height, GraphicsUnit.Pixel, imageAttr); } Rectangle scrollbarRegionBounds3 = this.GetScrollbarRegionBounds(bounds, orientation, ActiproSyntaxEditorRenderer.SliderRegion.LastRegion); graphics.DrawImage(thumbImage3, scrollbarRegionBounds3); } finally { if (thumbImage1 != null) { thumbImage1.Dispose(); } if (thumbImage2 != null) { thumbImage2.Dispose(); } if (thumbImage3 != null) { thumbImage3.Dispose(); } } }
private ActiproSyntaxEditorRenderer.ScrollbarStatus GetScrollbarStatus(UIElementDrawState drawState) { ActiproSyntaxEditorRenderer.ScrollbarStatus scrollbarStatus = ActiproSyntaxEditorRenderer.ScrollbarStatus.Normal; if ((drawState & UIElementDrawState.Pressed) == UIElementDrawState.Pressed) { scrollbarStatus = ActiproSyntaxEditorRenderer.ScrollbarStatus.Pressed; } else if ((drawState & UIElementDrawState.Hot) == UIElementDrawState.Hot) { scrollbarStatus = ActiproSyntaxEditorRenderer.ScrollbarStatus.Over; } else if ((drawState & UIElementDrawState.Disabled) == UIElementDrawState.Disabled) { scrollbarStatus = ActiproSyntaxEditorRenderer.ScrollbarStatus.Disabled; } return(scrollbarStatus); }
public override void DrawScrollBarButton(PaintEventArgs e, Rectangle bounds, ActiproSoftware.WinUICore.ScrollBarButton button) { Graphics graphics = e.Graphics; ActiproSyntaxEditorRenderer.ScrollbarStatus scrollbarStatus = this.GetScrollbarStatus(button.GetDrawState()); Image buttonImage = this.GetButtonImage(button, scrollbarStatus); try { graphics.DrawImage(buttonImage, bounds); } finally { if (buttonImage != null) { buttonImage.Dispose(); } } }
private string GetStatePrefix(ActiproSyntaxEditorRenderer.ScrollbarStatus state) { switch (state) { case ActiproSyntaxEditorRenderer.ScrollbarStatus.Normal: return("Normal_"); case ActiproSyntaxEditorRenderer.ScrollbarStatus.Pressed: return("MD_"); case ActiproSyntaxEditorRenderer.ScrollbarStatus.Over: return("MO_"); case ActiproSyntaxEditorRenderer.ScrollbarStatus.Disabled: return("Disabled_"); default: return(""); } }
private Image GetButtonImage(ActiproSoftware.WinUICore.ScrollBarButton button, ActiproSyntaxEditorRenderer.ScrollbarStatus state) { string str1 = ActiproSyntaxEditorRenderer.pathPrefix; string orientationPrefix = this.GetOrientationPrefix(button.ScrollBar.Orientation); string statePrefix = this.GetStatePrefix(state); string str2 = ""; if (button.CommandLink.Command == button.ScrollBar.DecreaseSmallCommand) { str2 = "Decrease"; } else if (button.CommandLink.Command == button.ScrollBar.IncreaseSmallCommand) { str2 = "Increase"; } return(this.CreateImageFromResource(str1 + orientationPrefix + statePrefix + this.themeImagePrefix + "_" + str2 + ".png")); }
private Image GetThumbImage(Orientation orientation, ActiproSyntaxEditorRenderer.SliderRegion region, ActiproSyntaxEditorRenderer.ScrollbarStatus state) { string str1 = ActiproSyntaxEditorRenderer.pathPrefix; string orientationPrefix = this.GetOrientationPrefix(orientation); string statePrefix = this.GetStatePrefix(state); string str2 = ""; switch (region) { case ActiproSyntaxEditorRenderer.SliderRegion.FirstRegion: str2 = "First"; break; case ActiproSyntaxEditorRenderer.SliderRegion.MiddleRegion: str2 = "Middle"; break; case ActiproSyntaxEditorRenderer.SliderRegion.LastRegion: str2 = "Last"; break; } return(this.CreateImageFromResource(str1 + orientationPrefix + statePrefix + this.themeImagePrefix + "_" + str2 + "Slider.png")); }