I'm working in a WPF windows application and am wondering if it's possible
to rotate a Canvas or user control derived from Canvas. I created a user
control which derives from Canvas and I need to rotate it 90, 180, and 270
degrees. Is this possible and if so, how would I do it? The use control
lives in a main canvas.
Thanks.
-- mo*******@noema il.noemail 3 19920
moondaddy wrote:
I'm working in a WPF windows application and am wondering if it's possible
to rotate a Canvas or user control derived from Canvas. I created a user
control which derives from Canvas and I need to rotate it 90, 180, and 270
degrees. Is this possible and if so, how would I do it? The use control
lives in a main canvas.
Thanks.
Is such Xaml suitable your requirement?
<Canvas Width="200" Height="200" Background="Yel low">
<Canvas.RenderT ransform>
<RotateTransfor m CenterX="100" CenterY="100" Angle="60" />
</Canvas.RenderTr ansform>
<Button Canvas.Left="50 " Canvas.Top="50" >button1</Button>
</Canvas>
--
Jacky Kwok
jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk
Thanks. this works good, but I need to do it all from c#. Can you show an
example of this from the button click event? I see plenty of xaml examples
online, but no c# examples of working with RotateTransform .
Thanks again.
"jacky kwok" <ja********@nos pam.nospamwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
moondaddy wrote:
>I'm working in a WPF windows application and am wondering if it's possible to rotate a Canvas or user control derived from Canvas. I created a user control which derives from Canvas and I need to rotate it 90, 180, and 270 degrees. Is this possible and if so, how would I do it? The use control lives in a main canvas.
Thanks.
Is such Xaml suitable your requirement?
<Canvas Width="200" Height="200" Background="Yel low">
<Canvas.RenderT ransform>
<RotateTransfor m CenterX="100" CenterY="100" Angle="60" />
</Canvas.RenderTr ansform>
<Button Canvas.Left="50 " Canvas.Top="50" >button1</Button>
</Canvas>
--
Jacky Kwok
jacky@alumni_DO T_cuhk_DOT_edu_ DOT_hk
I found the answer:
void ButtonClick(obj ect sender, RoutedEventArgs e)
{
canv1.RenderTra nsform = new RotateTransform (90,100,100);
}
"moondaddy" <mo*******@noem ail.noemailwrot e in message
news:uF******** ******@TK2MSFTN GP02.phx.gbl...
Thanks. this works good, but I need to do it all from c#. Can you show
an example of this from the button click event? I see plenty of xaml
examples online, but no c# examples of working with RotateTransform .
Thanks again.
"jacky kwok" <ja********@nos pam.nospamwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>moondaddy wrote:
>>I'm working in a WPF windows application and am wondering if it's possible to rotate a Canvas or user control derived from Canvas. I created a user control which derives from Canvas and I need to rotate it 90, 180, and 270 degrees. Is this possible and if so, how would I do it? The use control lives in a main canvas.
Thanks. Is such Xaml suitable your requirement?
<Canvas Width="200" Height="200" Background="Yel low"> <Canvas.RenderT ransform> <RotateTransfor m CenterX="100" CenterY="100" Angle="60" /> </Canvas.RenderTr ansform>
<Button Canvas.Left="50 " Canvas.Top="50" >button1</Button> </Canvas>
-- Jacky Kwok jacky@alumni_D OT_cuhk_DOT_edu _DOT_hk
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mickel Grönroos |
last post by:
Hi,
I'm trying to put an Tkinter.Entry of fixed size onto a specific location
on a canvas using the place manager. The idea is that one can double-click
a rectangle object on a canvas to get an entry field of the same size
as the rectangle placed exactly over the rectangle thus creating
the effect that the rectangle has entered "input mode". When clicking
return in the entry field, the value is fed back to a text object within
the...
|
by: santel_helvis |
last post by:
Hi All,
Could anyone tell me how to rotate the image in javascript. Which
concepts I should concentrate to rotate the image
|
by: lovecreatesbeauty |
last post by:
I write a function to rotate a matrix by 90 degrees clockwise, this
function works on a matrix of specific size, for example, it rotates a
4*4 matrix of integers in the following code. The function makes one
more copy of the original matrix, how is the efficiency? Can the copy
be saved? Comments on it are welcome.
Can I extend it to work on a matrix of any size (or even any type, not
just integers) for the logic may be the same when it...
|
by: Samuel Shulman |
last post by:
Is it possible and how to rotate pictures in HTML document
Thank you,
Samuel
|
by: TMS |
last post by:
Schools over!!! Now its time to play.
I would like to learn how to make objects move from one location to the next on a canvas widget. For example:
from Tkinter import *
class square:
def __init__(self, canvas, xy, color, change):
self.canvas = canvas
self.id = self.canvas.create_rectangle(-10-abs(change),
| |
by: Nebulism |
last post by:
I have been attempting to utilize a draw command script that loads a canvas, and through certain mouse events, draws rectangles. The original code is from http://www.java2s.com/Code/Python/Event/Usemousetodrawashapeoncanvas.htm .
The code itself is:
from Tkinter import *
trace = 0
class CanvasEventsDemo:
def __init__(self, parent=None):
canvas = Canvas(width=300, height=300, bg='beige')
canvas.pack()
|
by: jubi |
last post by:
I'm searching an algorithm to rotate a X11 pixmap (in C with xlib).
I'm drawing on a tk canvas (which is implemented as a X11 Pixmap)
and want to rotate all elements i have drawn on it (it's a city map).
|
by: moondaddy |
last post by:
I have a wpf project where I use a canvas to drag shapes around. when I
drag a shape beyond the right or bottom side I get scrollbars which is good.
I also get scrollbars when I zoom in and a shape goes beyond the right or
bottom side. However, I don't get scrollbars when shapes move beyond the
left or top side of the canvas. This is bad. I need the behavior similar
to Visio where you can drag an object past the left or top and you will...
|
by: harryusa |
last post by:
I am experimenting with the rotate function and so far I can't get my code to return anything but the URL of my script.
Here it is:
<?php
// The file you are rotating
$image = 'halloween.jpg';
//How many degrees you wish to rotate
$degrees = 180;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |