I am building dynamically more paths in a canvas, and i want to add a tooltip with more details about the path shape. But it looks like the tolltip appears only when i hover the path points. I want it to appear also when i hover the filled area or the contour of it.
PolyLineSegment polySeg = new PolyLineSegment(new Point[] { new Point(triangleX - 8, triangleY - 20), new Point(triangleX + 8, triangleY - 20) }, true);
PathFigure pathFig = new PathFigure(new Point(triangleX, triangleY), new PathSegment[] { polySeg }, true);
PathGeometry pathGeo = new PathGeometry(new PathFigure[] { pathFig });
pathGeo.Transform = new RotateTransform(angleOfTheTriangleInGrades, triangleX, triangleY);
Path path = new Path();
path.Data = pathGeo;
path.Fill = Brushes.Yellow;
var sp = new StackPanel();
sp.Children.Add(new TextBlock
{
Text = "aaa"
});
sp.Children.Add(new Button
{
Height = 20,
Width = 100,
Content = "bbbaaa"
});
path.ToolTip = sp;
pathList.Add(path);
Related
I have a lot of qx.ui.menu.Button and I want to add a scrollbar to it, how can I do it?
`var menu = new qx.ui.menu.Menu();
var button1 = new qx.ui.menu.Button("Line 431");
var button2 = new qx.ui.menu.Button("Line 30");
var forwardButton = new qx.ui.toolbar.SplitButton(
"Next",
null,
menu
);
var forwardButton2 = new qx.ui.toolbar.SplitButton(
"Next2",
null,
menu
);
//buttons should go one after another
//scroll = new qx.ui.container.Scroll();
//scroll._add()
this.getRoot().add(forwardButton);
this.getRoot().add(forwardButton2, {top: 30});`
the scrollbar should be like it exists for qx.ui.list.List
The solution is to use combination of Popup and List widgets:
// Create a button
const button1 = new qx.ui.form.Button("Click me", "test/test.png");
const model = new qx.data.Array(["a", "ab", "abc", "abcd", "abcde", "abcdef", "abcdefg", "abcdefgh"]);
const list = new qx.ui.list.List(model);
list.addListener("changeValue", function(value){console.log(value)}, this);
const popup = new qx.ui.popup.Popup(new qx.ui.layout.Grow());
popup.add(list);
// Document is the application root
const doc = this.getRoot();
// Add button to document at fixed coordinates
doc.add(button1, {left: 100, top: 50});
// Add an event listener
button1.addListener("execute", function() {
popup.show();
popup.placeToWidget(button1);
});
i'm using oxyplot,i want to drag point in scatter series,but i hava no idea.
i tried to add OnMouseMove but its not work.
var _model0 = new PlotModel();
//axes
_model0.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = -24, Maximum =
12, IsZoomEnabled = false });
_model0.Axes.Add(new LogarithmicAxis { Position = AxisPosition.Bottom, Minimum = 20,
Maximum = 20000, TickStyle = TickStyle.None, IsZoomEnabled = false });
//series
var s = new AreaSeries();
s.MouseMove += (s, e) =>{ MessageBox.Show("1");};
_model0.Series.Add(s);
enter image description here
the pic is follow:
I have background image on background of canvas. And i want to put another image on background image. SO i can rotate upward image in any direction. I am trying javascript code which is available on internet. But both images were rotated. I want to rotate only upward image with some angle.
/* Upload first image to 0,0 co-ordinate. */
ctx.beginPath();
var imageObj = new Image();
imageObj.onload = function()
{
ctx.drawImage(imageObj, 0, 0, 300, 150);
};
imageObj.src = 'C://Users//rajesh.r//Downloads//images//images.jpg';
options.ctx.fill();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ctx.beginPath();
ctx.translate(400,300);
ctx.rotate(2*Math.PI / 8);
var thumbImageObj = new Image();
thumbImageObj.onload = function()
{
ctx.drawImage(thumbImageObj, 0, 0, 120, 20);
};
thumbImageObj.src = 'C://Users//rajesh.r//Downloads//images//images.png';
ctx.fill();
I want some solution so i can rotate second image by some angle.
When you call rotate on your canvas, you're not rotating an individual image, but instead rotating the entire canvas. To only rotate the second image you need take advantage of the save and restore methods provided by the canvas API.
Here's an example, based off of the code that you shared:
// canvas setup
var canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var ctx = canvas.getContext('2d');
// 1st image
var imageObj = new Image();
imageObj.onload = function() {
ctx.drawImage(imageObj, 0, 0, 100, 100);
};
imageObj.src = 'https://s3.amazonaws.com/so-answers/image1.jpg';
// 2nd image
var thumbImageObj = new Image();
thumbImageObj.onload = function() {
// save current canvas state
ctx.save();
// perform transformation
ctx.translate(110,110);
ctx.rotate(20*Math.PI / 180);
ctx.drawImage(thumbImageObj, 0, 0, 100, 100);
// restore original canvas state (without rotation etc)
ctx.restore();
};
thumbImageObj.src = 'https://s3.amazonaws.com/so-answers/image2.jpg';
body {
overflow: hidden;
margin: 0;
padding: 0;
}
<canvas id="canvas"></canvas>
I'm having a content control which have a image inside when im trying to save that image im getting a black image. What am i missing.
RenderTargetBitmap rtb = new RenderTargetBitmap((int)content1.ActualWidth, (int)content1.ActualHeight, 96, 96, PixelFormats.Pbgra32);
rtb.Render(content1);
PngBitmapEncoder pnge = new PngBitmapEncoder();
pnge.Frames.Add(BitmapFrame.Create(rtb));
Stream stream = File.Create(DriveName + ":/OpenCV/Images/UI/LeftEdge.png");
pnge.Save(stream);
stream.Close();
Looks like your ContentControl hasn't been layouted when you try to render it.
Try to call UpdateLayout() on it.
If that doesn't do the trick try calling first Measure(), than Arrange() - also before rendering.
Have you tried something like this :
if (control.Type == WdContentControlType.wdContentControlPicture)
{
if (control.Range.InlineShapes.Count != 0)
{
// Clear previous shapes
foreach (InlineShape shape in control.Range.InlineShapes)
{
if (shape.Type == WdInlineShapeType.wdInlineShapePicture)
{
shape.Delete();
}
}
// Add new shape
InlineShape img = control.Range.InlineShapes.AddPicture (valueToSet, false, true);
img.Width = 90;
img.Height = 90;
}
}
I try formatting text in richTextBox, something like in skype chat.
1.column-"Nick" 2.column-"Text of Messange" 3.column-"DateTime"
I want alling 1. column max left and 3. column max right.
What is the best way how can I do it? I am using WPF.
My solution:
Simple solution is create Table object and add to blocks of richtextbox, somothing like this:
var tab = new Table();
var gridLenghtConvertor = new GridLengthConverter();
tab.Columns.Add(new TableColumn() { Name = "colNick", Width = (GridLength)gridLenghtConvertor.ConvertFromString("*") });
tab.Columns.Add(new TableColumn { Name = "colMsg", Width = (GridLength)gridLenghtConvertor.ConvertFromString("5*") });
tab.Columns.Add(new TableColumn() { Name = "colDt", Width = (GridLength)gridLenghtConvertor.ConvertFromString("*") });
tab.RowGroups.Add(new TableRowGroup());
tab.RowGroups[0].Rows.Add(new TableRow());
var tabRow = tab.RowGroups[0].Rows[0];
tabRow.Cells.Add(new TableCell(new Paragraph(new Run(rpMsg.Nick))) { TextAlignment = TextAlignment.Left });
tabRow.Cells.Add(new TableCell(ConvertToRpWithEmoticons(rpMsg.RpText)));
tabRow.Cells.Add(new TableCell(new Paragraph(new Run("Cas"))) { TextAlignment = TextAlignment.Right });
RtbConversation.Document.Blocks.Add(tab);