|
Thanks for the feedback peeps.
I'm just going a tad mental with the WPF DM-V-VM model that Dan Crevier talks about. Trying to get as much code out of my main window code behind.
Your both bang on the money, i'm being daft!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I met a problem,my customer feedback that they want the font a bit "bold",but when I changed the font to "Bold",they said that not what they really want. it really make me crazy,but it was what I have to face.
so does anyone have the experience to set the font a bit "bold"? maybe use some font brush...I don't know how to do it.
any suggestion,any idea are welcome!
Robin
|
|
|
|
|
That just sounds insane!!!
Personally this sounds like a red herring scenario. Maybe they are just explaining their point using the wrong language. Have you thought about showing them different options?? Different fonts?? Font sizes??
WPF allows you to embed fonts in applications so you aren't tied to just using system fonts, that said I haven't played with those settings at all. You also get into licencing issues when you start embedding other peoples assets in your application.
Anyway you can:
FontWeight="Medium"
FontWeight="SemiBold"
etc ...
The option that will actually have an effect will depend on the font you are using. Some of these settings with a lot of fonts (particularly system fonts) will have no effect ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I need a custom Canvas control with coordinate system centered in the middle of it and I still don't know, how to implement it using default WPF Canvas. I know, that there are some Transformations, that I can use, bud I didn't managed to use them for acquiring this goal.
All that I need is just Canvas and the ability to add dynamicaly objects like Ellipse, Polyline, etc., but the Left 0 Top 0 position should be in the middle.
Any idea?
|
|
|
|
|
|
Yeah, so I'm back again with a new question (yeah I'm learning WPF at the moment )
When I use a rotation transformation on an image and then save the image to file, the rotation isn't saved as part of the image. I know when we are talking about rotations other than 90 and 180 degrees there's the whole question of what to do, but even when using a rotation angle of 180 degrees it isn't actually saved in the bitmap itself.
In order to actually save such a transformation would I have to do all the dirty work myself, i.e. not using a rotation transformation but do the bit rearranging in code?
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Ok, so I discovered that some of the encoders (possibly all of them?), has a rotation property where I can specify whether a rotation should occur when saving the image. Still it only supports increments of 90 degrees which is inadequate for me, so I simply do the rotation manually.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Hey. I need some help determining the image format of an, well, image.
I have a small WPF program where I can open and display images. I load a BitmapImage objec,t and display it on an Image control in a window, and that all works fine.
Now I would like to save the image when changes are done to it, and I would like to save it in the format which was originally opened. So if I opened a JPEG image I would like to encode the BitmapImageSource as an JPEG using the JpegBitmapEncoder and that's all nice and works.
But when I load the BitmapImage it automatically determines the decoder to use, and when it's time to save the image I can't find an easy way of determining which encoder to use. I guess I could save the file name when I open it, and the from that deduce the file type and from that the image type and from that the encoder to use. It just seems so messy. I kind hoped the BitmapSource would save this information in some metadata, but doesn't (or so it seems).
Any advice as how to easy determine what encoder to use? Did I miss some obvious approach?
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
|
Hi Chandra,
No, I did actually find that page during my research. Believe my Google is my main research tool
My problem is that it seems kind of stupid that I would have to go through all that manually, when WPF does it as well since it decides on the correct decoder when I loads the image. I would just like to get to that information so I can easily decide on what encoder to use.
But thanks none the less.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
Rohde wrote: No, I did actually find that page during my research. Believe my Google is my main research tool
Hi
I wasn't trying to be a smartass - deciphering the header was what I had implemented in one my apps (though not WPF).
I am a complete ignoramus as regards WPF... If as you say WPF already does the decoding when loading the file, maybe there is a property that says what type of image it is? Or does the load image method return an image type?
|
|
|
|
|
Hi,
ChandraRam wrote: I wasn't trying to be a smartass
I know, I know. I didn't mean to imply that you were
ChandraRam wrote: If as you say WPF already does the decoding when loading the file, maybe there is a property that says what type of image it is?
You would think, but I just cannot find it. I will keep researching, I'm sure there's some logical way of doing it.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
This opens and saves a copy using the same format. I think decoder.CodecInfo has the info you need.
var uri = new Uri(@"C:\input.jpg");
BitmapDecoder decoder = BitmapDecoder.Create(uri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapEncoder enc = BitmapEncoder.Create(decoder.CodecInfo.ContainerFormat);
enc.Frames.Add(BitmapFrame.Create(decoder.Frames[0]));
enc.Save(new FileStream(@"C:\output.jpg",FileMode.Create));
|
|
|
|
|
Thank you Dave. That's exactly what I was looking for.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
modified on Thursday, May 29, 2008 1:49 PM
|
|
|
|
|
I want to start making my wpf user interfaces more interactive.
i am starting with a spring animation similar to
http://www.myphysicslab.com/spring2d.html
download my project: "FirstAnimation" here:
http://files.mixhacks.com/FirstAnimation.zip[^]
There are 3 attempts in the project:
1) is based off RungeKutta4 class found in "Practical WPF Graphics Programming by Jack Xu" ...
i'm missing something which after days of reading and hours of troubleshooting i haven't been able to fix.... anyone?
2) is an attempt to create my own solution using something i can more easily digest... vectors.
however again it has a problem. It does oscillate but .... take a look
note: it uses the vector3 class found here on codeproject.
3) the last one works .. which is based off Keith Peters flash book.... although the animation looks good its not real physics.... Foundation Actionscript 3.0 Animation: Making Things Move!
it doesn't compare to the 2d spring example above.
I'm posting this here in hopes that someone can shed some light to a newbie in animation and game programming with wpf.
Lastly....
are there any wpf projects attempting to bring compiz to normal devs?
http://compiz.org/Home/Screenshots
to normal devs in wpf?
http://www.youtube.com/watch?v=wOPOXSoArWQ
http://news.opensuse.org/2007/09/04/sneak-peeks-at-opensuse-103-compiz-and-compiz-fusion/
http://en.opensuse.org/Compiz_Fusion - see the alternative projects section for projects similar to compiz
|
|
|
|
|
|
Hi,
I would like to ask anyone have any ideas how to create own set of tool palette such as pen tool,brushes using Silverlight?
Thx.
Regards,
Katelva
|
|
|
|
|
katelva wrote: I would like to ask anyone have any ideas how to create own set of tool palette such as pen tool,brushes using Silverlight?
You mean, you want to create your own pen tool or brushes in Silverlight? Why? Silverlight already have path and brushes so why don't you use them?
|
|
|
|
|
Do you mean I can use the path in Silverlight? Can you teach me how to access the path and brushes of silverlight? Coz I would like to create something like paint application online? When user clicks on the pen tool, then the user can draw online?
Thanks
Regards,
Katelva
|
|
|
|
|
katelva wrote: I would like to create something like paint application online? When user clicks on the pen tool, then the user can draw online?
Yes. Actually, there are one online application for that. Please take a look at SilverInk[^] and tutorial[^]
I think you are very new to Silverlight. Otherwise, you won't ask how to use the path and brushes in Silverlight.
Please take a look at Silverlight Quick Start[^]. You can learn how to use Silverlight from that page. then, you can focus on how to drag and drop in Silverlight. after that, you will be able to create Silverlight paint.
|
|
|
|
|
Hi All,
Just need a couple of pointers as to why something isn't working ...
Say I have a textbox on my WPF 'form' thus:
<TextBox x:Name="EnabledTextBox" Style="{DynamicResource TextBox.Default}" ToolTip="TextBox" Text="Hello World!" TextWrapping="NoWrap" Margin="4,4,4,4" IsEnabled="True"/>
Then in my code I'm walking the visual tree and grabbing various bits of information like:
if (obj.ReadLocalValue(NameProperty) != DependencyProperty.UnsetValue)
{
_elementName = obj.ReadLocalValue(NameProperty).ToString();
}
this results in _elementName being "EnabledTextBox" ... great all good. But when I do the same for the Style:
if (obj.ReadLocalValue(StyleProperty).ToString() != null)
{
_styleProperty = obj.ReadLocalValue(StyleProperty).ToString();
}
Style always results in "System.Windows.ResourceReferenceExpression" I've been looking through the object explorer windows on a breakpoint. How do I drill down further to get the bound style ResourceKey ...
hmm ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I've been going round in circles on this now for nearly two days ... I've exhausted my ideas completely. Any help with this would be great.
Thanks,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
obj.GetValue(StyleProperty) returns a style, if you use a StaticResource your method works.
MSDN says
You should use GetValue for most typical "get" operations for a dependency property. ReadLocalValue does not return the effective value for a variety of circumstances where the value was not locally set.
Values that are set by styles, themes, templates, the default value from metadata, or property value inheritance are not considered to be local values. However, bindings and other expressions are considered to be local values, after they have been evaluated.
Mole is a lot more useful that the watch/locals window for WPF.
|
|
|
|
|
Hi Dave,
Indeed ... my method returns a string of System.Windows.Style ...
My style is set as Style="{DynamicResource TextBox.Default}" even looking through the visual tree using Mole/Woodstock doesn't get the value I'm interested in!!!
Mole shows a null reference and Woodstock has an empty box for the Style property. Yet when I hover over my obj and walk around the debug popups I can find "TextBox.Default" in the list of effective values ...
If Mole and Wodstock can't get at these values it makes me wonder if its even possible ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
What is the value you are after?
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<Style x:Key="TextBox.Default" TargetType="{x:Type TextBox}">
<Setter Property="FontFamily" Value="Century Gothic"/>
<Setter Property="FontSize" Value="40" />
</Style>
</Window.Resources>
<Grid>
<TextBox x:Name="EnabledTextBox" Style="{DynamicResource TextBox.Default}" ToolTip="TextBox" Text="Hello World!" TextWrapping="NoWrap" Margin="4,4,4,4" IsEnabled="True"/>
</Grid>
</Window>
var value = EnabledTextBox.GetValue(StyleProperty) as Style;
if (value != null)
{
foreach(Setter s in value.Setters)
{
Console.WriteLine(s.Property + " = " + s.Value);
}
}
Outputs
FontFamily = Century Gothic
FontSize = 40
|
|
|
|