本文整理汇总了C#中IDiagramPresenter.DiagramToControl方法的典型用法代码示例。如果您正苦于以下问题:C# IDiagramPresenter.DiagramToControl方法的具体用法?C# IDiagramPresenter.DiagramToControl怎么用?C# IDiagramPresenter.DiagramToControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDiagramPresenter
的用法示例。
在下文中一共展示了IDiagramPresenter.DiagramToControl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Construct
private void Construct(IDiagramPresenter owner, ICaptionedShape shape, int captionIndex, string currentText, string newText) {
if (owner == null) throw new ArgumentNullException("owner");
if (shape == null) throw new ArgumentNullException("shape");
if (captionIndex < 0 || captionIndex >= shape.CaptionCount) throw new ArgumentOutOfRangeException("captionIndex");
// Set control styles
SetStyle(ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);
UpdateStyles();
// Set general properties
this.BackColor = Color.Transparent; // Does not matter - see CreateParams()
this.AutoScrollOffset = Point.Empty;
this.ScrollBars = RichTextBoxScrollBars.None;
this.BorderStyle = BorderStyle.None;
// Set caption / style specific properties
this.owner = owner;
this.shape = shape;
this.captionIndex = captionIndex;
// Set Styles here because the ParagraphStyle is needed for resizing
characterStyle = shape.GetCaptionCharacterStyle(captionIndex);
paragraphStyle = shape.GetCaptionParagraphStyle(captionIndex);
// set base' members
SuspendLayout();
try {
this.WordWrap = paragraphStyle.WordWrap;
this.Font = ToolCache.GetFont(characterStyle);
this.ZoomFactor = owner.ZoomLevel / 100f;
// Get line height
Size textSize = TextRenderer.MeasureText(((IDisplayService)owner).InfoGraphics, "Iq", Font);
owner.DiagramToControl(textSize, out textSize);
lineHeight = textSize.Height;
DoUpdateBounds();
SelectAll();
SelectionAlignment = ConvertToHorizontalAlignment(paragraphStyle.Alignment);
DeselectAll();
} finally {
ResumeLayout();
}
}
示例2: IsMinRotateRangeExceeded
private bool IsMinRotateRangeExceeded(IDiagramPresenter diagramPresenter, MouseState mouseState) {
if (diagramPresenter == null) throw new ArgumentNullException("diagramPresenter");
if (mouseState == MouseState.Empty) throw new ArgumentException("mouseState");
Point p;
if (PendingToolActionsCount <= 1) p = ActionStartMouseState.Position;
else {
MouseState prevMouseState = GetPreviousMouseState();
p = prevMouseState.Position;
}
Debug.Assert(Geometry.IsValid(p));
int dist = (int)Math.Round(Geometry.DistancePointPoint(p.X, p.Y, mouseState.X, mouseState.Y));
diagramPresenter.DiagramToControl(dist, out dist);
return (dist > diagramPresenter.MinRotateRange);
}