I need a right to left Window (is a object in ScriptUI). In C#, a form has tow properties RightToLeft and RightToLeft layout that create a right to left form.
How can I do this in Extendscript?
In ScriptUI, the alignment property can be set on either the container itself or on its children. Given that w is your window :
var w = new Window('dialog');
w.preferredSize.width = 200;
var t1 = w.add('statictext',undefined, "I am right justified");
t1.alignment = "right";
var t2 = w.add('statictext',undefined, "I am centered justified");
t2.alignment = "center";
var t3 = w.add('statictext',undefined, "I am left justified");
t3.alignment = "left";
w.show();
Related
i want to align center in header0 on Cell Value "testing testing"
val style = workbook.createCellStyle()
style.borderTop = 24.toShort() // double lines border
style.borderBottom = 24.toShort() // single line border
val font = workbook.createFont()
font.fontHeightInPoints = 15.toShort()
font.boldweight = XSSFFont.BOLDWEIGHT_BOLD
style.setFont(font)
style.borderRight = 6.toShort()
style.borderLeft = 6.toShort()
var rowNum = 11
var rowNumber = 1
header0.createCell(0).setCellValue("TESTING TESTING")
cell value will be align center
The contents to the text layer are added from csv import. Some are short length and some are long, contain 2 words and take up 2 lines in the layer. What I need is after the content is added, the layer should be horizontally and vertically aligned to another layer. I want to do this alignment using a script.
var doc = app.activeDocument;
var grps = doc.layerSets;
var pnamegrp = grps.getByName('Group 1');
var childlyr = pnamegrp.layers.getByName('child');
childlyr.textItem.contents = pname; //come from a csv file
var parentlyr= pnamegrp.layers.getByName('ReferenceRectangle');
Align_HorizCenter_VerticalCenter_withreference( childlyr , parent);
function Align_HorizCenter_VerticalCenter_withreference( child, parent){
//need help to write this
}
I am using Photoshop cc 2015 and JavaScript jsx file scripting.
Just incase somebody is looking for a solution. Translate is the method to move layer. The number of pixels to be moved can be determined by the difference in the width between the target and reference layer.
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.INCHES;
var doc = app.activeDocument;
var grps = doc.layerSets;
var pnamegrp = grps.getByName('Group 1');
var pnamelyr= pnamegrp.layers.getByName('pname'); //target
var pnameREF = pnamegrp.layers.getByName('Rectangle 1'); //reference var LB = pnameREF.bounds;
var RWidth = (LB[2].value) - (LB[0].value);
var RHeight = (LB[3].value) - (LB[1].value);
pnamelyr.textItem.contents = pnamearr[i];
LB = pnamelyr.bounds;
TWidth = (LB[2].value) - (LB[0].value);
THeight = (LB[3].value) - (LB[1].value);
var OffsetX = (RWidth - TWidth)/2;
var OffsetY = (RHeight - THeight)/2;
pnameTGT.translate(OffsetX,OffsetY); //move layer by offset pixels from the current position
I am trying to create an application which should consist of a line drawn when keyboard key is pressed. When the left arrow in the keyboard is pressed then the line should move in left direction. When right arrow in the keyboard is pressed then the respective line should move in right direction.
I think it is possible with Path class but I don't know how to implement. Even I don't know how to start the code. Can you please guide me how to draw the line in windows store apps.
private PathGeometry DrawGeometry()
{
bool largeArc = WedgeAngle > 180.0;
Size outerArcSize = new Size(Radius, Radius);
Size innerArcSize = new Size(InnerRadius, InnerRadius);
Point innerArcStartPoint = Utilities.ComputeCartesianCoordinate(RotationAngle, InnerRadius);
Point ButtomLineEndPoint = Utilities.ComputeCartesianCoordinate(RotationAngle, Radius);
Point OuterArcEndPoint = Utilities.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, Radius);
Point EndLineEndPoint = Utilities.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, InnerRadius);
innerArcStartPoint.X += CentreX;
innerArcStartPoint.Y += CentreY;
ButtomLineEndPoint.X += CentreX;
ButtomLineEndPoint.Y += CentreY;
OuterArcEndPoint.X += CentreX;
OuterArcEndPoint.Y += CentreY;
EndLineEndPoint.X += CentreX;
EndLineEndPoint.Y += CentreY;
PathFigure path = new PathFigure();
path.StartPoint = innerArcStartPoint;
ArcSegment InnerArc = new ArcSegment();
InnerArc.Size = innerArcSize;
InnerArc.SweepDirection = SweepDirection.Counterclockwise;
InnerArc.Point = innerArcStartPoint;
InnerArc.IsLargeArc = largeArc;
LineSegment ButtomLine = new LineSegment();
ButtomLine.Point = ButtomLineEndPoint;
ArcSegment OuterArc = new ArcSegment();
OuterArc.SweepDirection = SweepDirection.Clockwise;
OuterArc.Point = OuterArcEndPoint;
OuterArc.Size = outerArcSize;
OuterArc.IsLargeArc = largeArc;
LineSegment EndLine = new LineSegment();
EndLine.Point = EndLineEndPoint;
path.Segments.Add(ButtomLine);
path.Segments.Add(OuterArc);
path.Segments.Add(EndLine);
path.Segments.Add(InnerArc);
PathGeometry myPath = new PathGeometry();
myPath.Figures.Add(path);
return myPath;
}
This code will Draw a Pie slice for you as I was building a PieChart it Containsn Lines Curves etc. It will save lots of your time
I want to float an image on the right of some text in a table cell.
cell.AddParagraph("some text");
cell.AddParagraph("next line other text");
Paragraph p = cell.AddParagraph();
p.Format.Alignment = ParagraphAlignment.Right;
p.Format.RightIndent = 12;
Image image = p.AddImage("image.png");
image.ScaleWidth = 0.07;
This code puts the image to the right, but I can't move it up.
p.Format.Linespacing = -10;
image.WrapFormat.DistanceTop = -10;
These settings did not work.
For moving elements up or down SpaceBefore and SpaceAfter can be used.
In this case:
p.Format.SpaceBefore = - 20;
I have a code from some article. (picture inner inside the picture outer)
The result of the code is when i click the place in the picture outer, the picture inner will show in the place i clicked, but in diagonal place.
It wasnt in the right place i click. I want the picture inner will show
in the spot i clicked
picturebox1 name = PictOuter
picturebox2 name = PictInner
Dim pos As String
Dim bos As String
pos = Format(x / PictOuter.Width * 100, "0")
bos = Format(y / PictOuter.Height * 100, "0")
PictInner.Left = PictOuter.Width * pos / 100
PictInner.Top = PictOuter.Height * bos / 100
PictInner.Visible = True
Your information will so helpfull, thanks for your attention
If you simply want the top left corner of the inner box to be where you click, you can use the MouseDown event of the outer PictureBox, which would look like this:
Private Sub PictOuter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
PictInner.Left = X
PictInner.Top = Y
End Sub
You can also choose to perform whatever calculations you'd like on X and Y to center the inner PictureBox however you'd like.