protected override void DoDrawGlyph(ControlGraphicsInfoArgs info, TokenEditTokenInfo tokenInfo) { base.DoDrawGlyph(info, tokenInfo); if (editor.Properties.CheckBoxSkinElement != null) { int index = 0; CustomTokenEditTokenInfo customTokenInfo = tokenInfo as CustomTokenEditTokenInfo; int offset = customTokenInfo.Checked == true ? 4 : 0; Rectangle rect = customTokenInfo.CheckBoxGlyphBounds; Rectangle r = new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height); SkinElementInfo skinElementInfo = new SkinElementInfo(editor.Properties.CheckBoxSkinElement, r); switch (customTokenInfo.CheckBoxState) { case ObjectState.Normal: index = offset; break; case ObjectState.Hot: index = offset + 1; break; case ObjectState.Hot | ObjectState.Pressed: index = offset + 2; break; } skinElementInfo.ImageIndex = index; ImageCollection imageCollection = editor.Properties.CheckBoxSkinElement.Image.GetImages(); info.Graphics.DrawImage(imageCollection.Images[index], new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height)); ObjectPainter.DrawObject(info.Cache, SkinElementPainter.Default, skinElementInfo); } }
protected override void DoDrawGlyph(ControlGraphicsInfoArgs info, TokenEditTokenInfo tokenInfo) { base.DoDrawGlyph(info, tokenInfo); if (editor.Properties.CheckBoxCollection.Images.Count != 0) { int index = 0; CustomTokenEditTokenInfo customTokenInfo = tokenInfo as CustomTokenEditTokenInfo; int offset = customTokenInfo.Checked == true ? 4 : 0; switch (customTokenInfo.CheckBoxState) { case ObjectState.Normal: index = offset; break; case ObjectState.Hot: index = offset + 1; break; case ObjectState.Hot | ObjectState.Pressed: index = offset + 2; break; } Rectangle rect = customTokenInfo.CheckBoxGlyphBounds; info.Graphics.DrawImage(editor.Properties.CheckBoxCollection.Images[index], new Rectangle(rect.X + (int)info.Graphics.ClipBounds.X, rect.Y + (int)info.Graphics.ClipBounds.Y, rect.Width, rect.Height)); } }
protected override void UpdateTokenState(TokenEditTokenInfo tokenInfo) { base.UpdateTokenState(tokenInfo); if (!Item.ReadOnly) { Point pt = OwnerControl != null?OwnerControl.PointToClient(Control.MousePosition) : MousePosition; CustomTokenEditTokenInfo info = tokenInfo as CustomTokenEditTokenInfo; if (info.CheckBoxGlyphBounds.Contains(pt)) { info.CheckBoxState = ObjectState.Hot; if ((Control.MouseButtons & MouseButtons.Left) != 0) { info.CheckBoxState |= ObjectState.Pressed; } } else { info.CheckBoxState = ObjectState.Normal; } } }
protected override TokenEditTokenInfo CreateTokenEditTokenInfo(TokenEditToken token) { CustomTokenEditTokenInfo info = new CustomTokenEditTokenInfo(token, checkBoxBounds, this); return(info); }