canvas

SWT Canvas Location

I'm using the most recent stable version of SWT. I have a Shell containing a ToolBar, a ScrolledComposite, and a Canvas. The Canvas is set as the ScrolledComposite's content (e.g. scrolledComposite.setContent(canvas)). The Canvas is created with a specific size that never changes (say, 400 x 400). Whereas the ScrolledComposite is con...

How to draw on a TPanel

I need to draw on a TPanel, ideally directly so I don't have another component on top of it getting in the way of mousevent-event trapping (I want to draw a little "size-grip" on it). How should I go about doing this? ...

Is it possible to merge the difference images using < canvas >

Hi All, I am working on developing an AJAX based application similar to VNC .. I am able to reproduce keyboard and mouse interaction from the browser to the remote machine. But when it comes to display part .. I am relying on page refresh that rederes latest captured desktop image. I wanted to improve the display aspects by using AJAX...

How do I use a Silverlight2 ItemsControl to position a collection of items on a canvas?

In WPF, you can create a ListBox with a Canvas as an ItemsPanel and position items on that canvas. The code to do that looks something like this: <ListBox ItemsSource="{Binding}"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name}"/> </DataTemplate> </ListBox.ItemTemplate> ...

Is there a way to manipulate code generated by Processing.js via Javascript?

I would like to call some functions or alter some variables after the Processing.js code has been parsed. Right now the only way to do this is to manipulate the source code, and then reload the source into Processing. ...

WPF - Canvas.GetTop returning NeuN

Hi, I'm trying to get the position of a canvas from a mouse move handler but it returns NeuN. The canvas is inside another canvas and the code is: Console.WriteLine(Canvas.GetTop(canvas2)); this is inside: private void move(object sender, MouseEventArgs e) { Console.WriteLine(Canvas.GetTop(canvas2)); } I'd say it can't be a scope...

Get un-translated, un-rotated (x,y) coordinate of a point from a Javascript canvas

In Javascript we often render graphics by rotating and translating the coordinate plane before sending things ctx.save(); ctx.translate(someX, someY); ctx.rotate(someAngle * Math.PI / 180); ctx.beginPath(); ctx.moveTo(x1, y1); // What's the actual (x1,y1)? ctx.lineTo(x2, y2); // What's the actual (x2,y2)? ctx.stroke(); ctx.resto...

Why can't I stretchBlt a dc onto another dc?

Why can't the following code draw the content of graphics onto finalDC? It just draw black rectangle; Bitmap* bitmapCanvasCore = new Bitmap(width, height ,PixelFormat24bppRGB); xxxxxx // operation on bitmapCanvasCore... Graphics * canvasGraphics = new Graphics(bitmapCanvasCore); HDC tempdc = m_UnSelectedGraphics->GetHDC(); ::SetStretchB...

WPF: How to install thumb behavior in a Canvas?

I would like to have a Canvas that supports the DragDelta event. My first idea of how to do this was to make a ControlTemplate that includes a thumb. But I do not know how to do this correctly. How can I change the XAML below to make it compile, and what's the right way to install the DragDelta event handler? <UserControl.Resources> ...

WPF: How to make canvas auto-resize?

I would like my canvas to automatically resize to the size of its items, so that the ScrollViewer scroll bars have the correct range. Can this be done in XAML? <ScrollViewer HorizontalScrollBarVisibility="Auto" x:Name="_scrollViewer"> <Grid x:Name ="_canvasGrid" Background="Yellow"> <Canvas x:Name="_canvas" HorizontalAlignme...

Has anyone got processing.js working in IE?

I'm looking for examples of processing.js working in Internet Explorer via ExplorerCanvas or similar. ...

Flex canvas and mouse event

Hello flexers, This simple code shows a green canvas on a red canvas, i would like the Green canvas to let the mouse down event to be catch by the child behind him: the red Canvas. How can i do this ? <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete=...

WPF Virtualizing a Canvas

We have a series of rectangles produced inside a Canvas and they are nested in this order ScrollView>Canvas>VirtualizingStackPanel>Rectangles in the XAML. There seems to be little information on Microsoft about under what senarios Virtualization is supported, and in cases where it isn't no error is thrown, it merely treats it like a sta...

Use Canvas to mask another canvas in C#/WPF

Hi, I am learning some WPF/C# so this question might be silly for some of you but I can't find the solution. I have a Canvas (let's say it countains texts) and then I have another Canvas that I want to use as a mask (anything in this second Canvas will mask the first one). How can I do that? What if the second Canvas is moving? I want...

WPF: Is it possible to bind a Canvas's Children property in XAML?

I'm a little surprised that it is not possible to set up a binding for Canvas.Children through XAML. I've had to resort to a code-behind approach that looks something like this: private void UserControl_Loaded(object sender, RoutedEventArgs e) { DesignerViewModel dvm = this.DataContext as DesignerViewModel; dvm.D...

Flex resizing Canvas where to put such code ? (diagram inside)

Hi all, I have two Canvas A and B, A is the child of B. A can be resized by some user actions like adding some UI components to its base. A is bounded by an other Parent canvas B which should show scolling handles if its child A gets too large. I would like A to have the same width and height of B (or really close) while the calculated...

Noticeable Flex 3 performance increase using Canvas vs VBox/HBox?

I was told that there is an increase in performance when using Canvas versus HBox or VBox when laying out out the position of children. As a result, a number of our components have been converted over to using Canvas. However, now there is code being added to calculate the x and y positioning of some of the child elements based off of th...

Mask all elements of a window/canvas with C#/WPF

Hi, How can I create a mask to cover ALL the elements of a Windows/Canvas (with subcanvas/elements inside)? Thanks in advance EDIT: I want to add more controls/elements/whatever after I create the mask. Is that ok? How? ...

Generate image data from HTML Canvas element

What is the best way to generate image data from the contents of an HTML canvas element? I'd like to create the image data such that it can be transmitted to a server (it's not necessary for the user to be able to directly save to a file). The image data should be in a common format such as PNG or JPEG. Solutions that work correctly i...

WPF Child element of a Canvas outside of rect bounds

I am creating a control where I am simulating a popup by using a canvas that contains a textbox and a grid container. The size of the canvas gets set to the size of the textbox and the textbox is positioned at 0,0 within the canvas. The Grid container is positoned at the y coordinate of the textbox and its visibility is set to Collapsed....