本文整理汇总了C#中IVwGraphics类的典型用法代码示例。如果您正苦于以下问题:C# IVwGraphics类的具体用法?C# IVwGraphics怎么用?C# IVwGraphics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVwGraphics类属于命名空间,在下文中一共展示了IVwGraphics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRenderer
public IRenderEngine GetRenderer(int ws, IVwGraphics vg)
{
IRenderEngine result;
if (m_renderers.TryGetValue(ws, out result))
return result;
return Renderer;
}
示例2: DrawText
public void DrawText(int ichBase, IVwGraphics vg, Rect rcSrc, Rect rcDst, out int dxdWidth)
{
dxdWidth = Width;
var args = new SegDrawTextArgs();
args.ichBase = ichBase;
args.vg = vg;
args.rcSrc = rcSrc;
args.rcDst = rcDst;
LastDrawTextCall = args;
}
示例3: PaintForeground
public override void PaintForeground(IVwGraphics vg, PaintTransform ptrans)
{
if (Segment == null)
return;
int dxdWidth;
PaintTransform segTrans = ptrans.PaintTransformOffsetBy(Left, Top);
if (AnyColoredBackground)
Segment.DrawTextNoBackground(IchMin, vg, segTrans.SourceRect, segTrans.DestRect, out dxdWidth);
else
Segment.DrawText(IchMin, vg, segTrans.SourceRect, segTrans.DestRect, out dxdWidth); // more efficient.
}
示例4: FindBreakPoint
public void FindBreakPoint(IVwGraphics vg, IVwTextSource _ts, IVwJustifier _vjus, int ichMin, int ichLim,
int ichLimBacktrack, bool fNeedFinalBreak, bool fStartLine, int dxMaxWidth, LgLineBreak lbPref,
LgLineBreak lbMax, LgTrailingWsHandling twsh, bool fParaRightToLeft,
out ILgSegment segRet, out int dichLimSeg, out int dxWidth, out LgEndSegmentType est, ILgSegment _segPrev)
{
MockSegment seg;
var key = new MockSegKey(ichMin, ichLim);
if (lbPref != LgLineBreak.klbClipBreak && m_failOnPartialLine.Contains(key))
{
// fail.
segRet = null;
dichLimSeg = 0;
dxWidth = 0;
est = LgEndSegmentType.kestNothingFit;
return;
}
if (m_potentialSegs.TryGetValue(key, out seg))
{
if (seg.Width < dxMaxWidth) // otherwise we meant it for the next line.
{
segRet = seg;
dichLimSeg = seg.get_Lim(ichMin);
dxWidth = seg.get_Width(ichMin, vg);
est = seg.EndSegType;
return;
}
}
switch(OtherSegPolicy)
{
case UnexpectedSegments.DontFit:
default: // to make compiler happy
Assert.AreNotEqual(LgLineBreak.klbClipBreak, lbMax,
"FindBreakPoint called with unexpected arguments.");
// If we aren't pre-prepared for the requested break, assume nothing fits with these arguments.
segRet = null;
dichLimSeg = 0;
dxWidth = 0;
est = LgEndSegmentType.kestNothingFit;
break;
case UnexpectedSegments.MakeOneCharSeg:
// Make a very narrow segment that will fit and allow more stuff. This will usually give a test failure if not intentional.
seg = new MockSegment(1, 2, 1, LgEndSegmentType.kestOkayBreak);
// If we aren't pre-prepared for the requested break, assume nothing fits with these arguments.
segRet = seg;
dichLimSeg = 1;
dxWidth = 2;
est = LgEndSegmentType.kestOkayBreak;
break;
}
}
示例5: PaintForeground
public override void PaintForeground(IVwGraphics vg, PaintTransform ptrans)
{
((MockGraphics)vg).DrawActions.Add(this);
}
示例6: get_Renderer
public IRenderEngine get_Renderer(int ws, IVwGraphics _vg)
{
return m_engine;
}
示例7:
/// -----------------------------------------------------------------------------------
/// <summary>
/// Inform the container when done with the graphics object.
/// </summary>
/// <param name="prootb"></param>
/// <param name="pvg"></param>
/// -----------------------------------------------------------------------------------
void IVwRootSite.ReleaseGraphics(IVwRootBox prootb, IVwGraphics pvg)
{
// Do nothing for printing
}
示例8: MakeSelectionAt
/// <summary>
/// Make whatever selection is appropriate for the given click. The transformation is the usual one passed to this box,
/// that is, it transforms where (which is in paint coords) into a point in the same coordinate system as our own top, left.
/// </summary>
internal virtual Selections.Selection MakeSelectionAt(Point where, IVwGraphics vg, PaintTransform leafTrans)
{
return null;
}
示例9: Location
public void Location(IVwGraphics _vg, Utils.Rect rcSrc, Utils.Rect rcDst,
out Utils.Rect _rdPrimary, out Utils.Rect _rdSecondary, out bool _fSplit,
out bool _fEndBeforeAnchor)
{
_rdPrimary = default(Utils.Rect);
_rdSecondary = default(Utils.Rect);
_fSplit = false;
_fEndBeforeAnchor = false;
}
示例10: DrawingErrors
public void DrawingErrors(IVwGraphics _vg)
{
throw new NotImplementedException();
}
示例11: MakeLayoutInfo
internal static LayoutInfo MakeLayoutInfo(int maxWidth, IVwGraphics vg, IRendererFactory factory)
{
return new LayoutInfo(2, 2, 96, 96, maxWidth, vg, factory);
}
示例12: CallOnTyping
protected override void CallOnTyping(IVwGraphics vg, string str, int cchBackspace, int cchDelForward, char chFirst, Rectangle rcSrcRoot, Rectangle rcDstRoot)
{
base.CallOnTyping(vg, str, cchBackspace, cchDelForward, chFirst, rcSrcRoot, rcDstRoot);
Cache.EnableUndo = false; // Things have changed in a way we can't Undo.
}
示例13: Paint
/// <summary>
/// The root box handles the overall paint.
/// </summary>
/// <param name="vg"></param>
/// <param name="ptrans"></param>
public void Paint(IVwGraphics vg, PaintTransform ptrans)
{
if (m_layoutCallbacks != null)
{
// In a state where we can't paint. Arrange for an invalidate AFTER the dangerous operation is over,
// so what needs painting eventually does get painted.
var bounds = Bounds;
bounds.Inflate(10, 10);
m_layoutCallbacks.Invalidate(bounds);
return;
}
// First we paint the overall background. This basically covers everything but text.
PaintBackground(vg, ptrans);
// Then the text.
PaintForeground(vg, ptrans);
// And finally the selection.
if (Selection != null && m_selectionShowing)
{
if (Selection.IsValid)
Selection.Draw(vg, ptrans);
else
Selection = null;
}
}
示例14: OnDragDrop
/// <summary>
/// Implement dragging to this view.
/// </summary>
public void OnDragDrop(DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans)
{
var sel = GetSelectionAt(location, vg, ptrans) as InsertionPoint;
if (sel == null)
return;
var rtf = drgevent.Data.GetData(DataFormats.Rtf);
var data = drgevent.Data.GetData(DataFormats.StringFormat);
if (data == null)
return;
var text = data.ToString(); // MS example of GetData does this, though for DataFormats.Text.
if (DragState == WindowDragState.InternalMove)
{
DragState = WindowDragState.None;
// We are dragging our own selection. Is it in the same property?
var range = (RangeSelection)Selection;
// Enhance JohnT: when we can drag a range that isn't all in one property, this needs more work.
if (!Selection.IsInsertionPoint)
{
if (Selection.Contains(sel))
{
Selection = sel;
return; // Can't drag to inside own selection.
}
}
if (range.End.Hookup == sel.Hookup && range.End.StringPosition < sel.StringPosition)
{
// Dragging to later in the same property. If we delete first, we will mess up the insert
// position. However, a simple solution is to insert first.
//Log("Inserted dropped " + text + " before deleted range");
if (rtf == null)
sel.InsertText(text);
else if (!sel.InsertRtfString(rtf.ToString()))
sel.InsertText(text);
range.Delete();
return;
}
// The bit we're moving comes after the place to insert, or they are in separate properties.
// We can just go ahead and delete the source first, since we already have a copy of the
// text to insert.
// Enhance JohnT: do we need to consider a special case where the source and destination are
// different occurrences of the same property?
//Log("Deleted selection");
range.Delete();
}
DragState = WindowDragState.None;
//Log("Dropped text: " + text);
if (rtf == null)
sel.InsertText(text);
else if (!sel.InsertRtfString(rtf.ToString()))
sel.InsertText(text);
}
示例15: OnDragEnter
/// <summary>
/// Returns information about possible drops with these arguments.
/// </summary>
public void OnDragEnter(DragEventArgs drgevent, Point location, IVwGraphics vg, PaintTransform ptrans)
{
if (DragState == WindowDragState.InternalMove)
{
// On a simple click (at least), Windows calls OnDragEnter AFTER OnQueryContinueDrag, attempting to drop
// right where we clicked. OnQueryContinueDrag detects this; we must not reset it.
return;
}
drgevent.Effect = DragDropEffects.None; // default
var sel = GetSelectionAt(location, vg, ptrans) as InsertionPoint;
if (sel == null)
return;
if (!sel.CanInsertText)
return;
var data = drgevent.Data.GetData(DataFormats.StringFormat);
if (data == null)
return;
DragState = WindowDragState.DraggingHere;
// We will copy if control is held down or move is not allowed.)
if ((drgevent.KeyState & (int)DragDropKeyStates.ControlKey) != 0 ||
(drgevent.AllowedEffect & DragDropEffects.Move) == 0)
{
//Log("DragEnter/Move: set effect to copy");
drgevent.Effect = DragDropEffects.Copy;
}
else
{
//Log("DragEnter/Move: set effect to move");
drgevent.Effect = DragDropEffects.Move;
}
}