Anchor a Note Example (C#)
This example shows how to anchor a note and set its text to all uppercase.
//----------------------------------------------------------------------------
// Preconditions: Open:
// install_dir\samples\tutorial\advdrawings\foodprocessor.slddrw
//
// Postconditions: The note, Drawing View1, is locked in position at the
// specified location, and its text is all uppercase.
//
// NOTE: Because the model is used elsewhere,
// do not save changes when closing it.
//
---------------------------------------------------------------------------
using
Microsoft.VisualBasic;
using
System;
using
System.Collections;
using
System.Collections.Generic;
using
System.Data;
using
System.Diagnostics;
using
SolidWorks.Interop.sldworks;
using
SolidWorks.Interop.swconst;
using
System.Runtime.InteropServices;
namespace
AnchorNote_CSharp.csproj
{
partial
class
SolidWorksMacro
{
ModelDoc2
Part;
Note
myNote;
Annotation
myAnnotation;
bool
boolstatus;
public
void
Main()
{
Part = (ModelDoc2)swApp.ActiveDoc;
myNote = (Note)Part.InsertNote("Drawing
View1");
if
((myNote != null))
{
myNote.LockPosition =
true;
myNote.AllUpperCase =
true;
myAnnotation = (Annotation)myNote.GetAnnotation();
if
((myAnnotation != null))
{
boolstatus = myAnnotation.SetPosition(0.2,
0.269, 0);
}
}
Part.ClearSelection2(true);
Part.WindowRedraw();
}
public
SldWorks
swApp;
}
}