|
|
|
Hi,
I have a word file. I want to save the first page as a picture. How can I do it using C# code?
Thanks,
Prajeesh
|
|
|
|
|
Please pick a more appropriate forum.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i have a RadialGradiantBrush in the app.xaml
<Application.Resources>
<RadialGradientBrush x:Name="RGB1">
<GradientStop Color="AntiqueWhite" Offset="0.0" />
<GradientStop Color="LightSalmon" Offset="0.25" />
<GradientStop Color="LightBlue" Offset="0.75" />
<GradientStop Color="Wheat" Offset="1.0" />
</RadialGradientBrush>
</Application.Resources>
I assign it to a background in the generic.xaml
<Canvas x:Name="RightCanvas" Grid.Column="2" Background = "{StaticResource RGB1}"/>
How can i do this in the .cs file
RightCanvas.Background = "{StaticResource RGB1}" as RadialGradiantBrush
?
Thank you .
|
|
|
|
|
RightCanvas.Background = Application.Current.Resources["RGB1"] as RadialGradientBrush;
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks
Great, I have my brushes in app.xaml
and now can access them from xaml or cs !
But now the designer doesnt work
Error HRESULT E_FAIL has been returned from a call to a COM component.
vs2008
|
|
|
|
|
daveyerwin wrote: But now the designer doesnt work
Since the Silverlight XAML designer is only partially implemented in VS,
it can be "challenging" to find the offending code or markup
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi.
I have a big image ( like a map ).
I wanna show it in an image (in WPF) as when user do MouseDown on it , it can move map coordinates .
Something like Google map.
Could you guide me how I can do it ?
Thanks
|
|
|
|
|
A popular way to deal with images that are too large to fit all at once
into a practical amount RAM and/or transferred across a network in a reasonable
amount of time is to deal with the image in parts, or "tiles".
Displaying a single tile is relatively easy...handling mouse events is relatively easy...
Designing a system to work with tiles and keep track of them is the majority of the
work.
What kind of guidance are you looking for? Do you have a more specific part of the given
problem that you are struggling with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark .
Mark Salsbery wrote: Displaying a single tile is relatively easy...handling mouse events is relatively easy...
I'm green in these subjects (tiles and move image with mouse events).
Could you post a references about them ?
|
|
|
|
|
Mohammad Dayyan wrote: I'm green in these subjects (tiles and move image with mouse events).
By "tile", I mean a rectangular (usually) portion of a larger image.
For example, I work with large images (larger than 20000 pixel dimensions) divided
into tiles 256x256 and/or 512x512 pixels.
How you load, cache, and render the tiles depends on your requirements.
Maybe start with the fundamentals:
WPF Fundamentals[^]
Input Overview[^]
WPF: Images[^]
Of course, if your entire image fits in memory, you could simply use an Image control
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am creating a chat program in WPF based on the one I made in WinForms,
to give it an edge and a cool new look.
As part of the program, when the user logs in, it displays a custom
welcome message with the user's name in it. I used the 'modified' tag in
VB WinForms to do this.
The code I am using for this operation is:
Dim name As String = ""
If TextBox1.Modified Then
name &= TextBox1.Text
End If
If name <> "" Then
Label3.Text = ("Welcome " & name)
MsgBox("Welcome " & name)
End If
I am wondering if anyone
knows what the equivalent is in WPF as I have no idea. I would also like to know if you
can put a WebBrowser control on a form in WPF. Any responses would be
greatly appreciated.
Dloog!
|
|
|
|
|
What you could do (and I'd recommend this) is use two way databinding. That way, you don't have to write code to check for modified flags or the like. First of all, you should write a class that implements the interface INotifyPropertyChanged like so:
public class Login : INotifyPropertyChanged
{
private string _name;
public string Name
{
get { return _name; }
set
{
if (_name != value)
{
_name = value;
Changed("Name");
}
}
public event PropertyChangedEventHandler;
protected virtual void Changed(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
} Then, in your XAML, you'd bind the textbox and the label to the same property
:<TextBox Text="{Binding Path=Name, Mode=TwoWay}" MaxLength="10" />
<Label Text="{Binding Path=Name, Mode=TwoWay}" /> Bind this object to the datacontext of your window, using this.DataContext = new Login(); in the window class (you may want to do this immediately after you the call to InitializeComponent(); . Now, when you change a value in the textbox, the label updates automatically.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
One could still go wild with an attached behaviour in order to mimic the WinForms functionality, but with WPF, it really isn't necessary anymore. But you gotta love the flexibility of the platform
btw: Subscribed to your blog lately and noticed that your blog is missing a visible feed link (unless it's really well hidden).
Cheers,
Philipp
NetDrives - Open Source Network Share Management
|
|
|
|
|
Philipp Sumi wrote: btw: Subscribed to your blog lately and noticed that your blog is missing a visible feed link (unless it's really well hidden).
Oops. I'll have to sort that out.
Philipp Sumi wrote: But you gotta love the flexibility of the platform
Damn straight. Attached functionality is one of the reasons that the Tag property is no longer necessary.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Sorted - take a look under the Meta link. I've moved it to the top from the bottom of the sidebar.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
It was there the whole time, wasn't it? It's surprising how the brain even filters information ("do not interpret entries in the meta section because there's the admin stuff") even if you don't want it to. I honestly never noticed that there's an additional feed link although my blog runs on WP, too
In case I'm not the only one with that particular problem - an RSS link in the top area along with a shiny orangy RSS icon might help to get you some additional readers. Maybe not the brightest ones
Cheers,
Philipp
NetDrives - Open Source Network Share Management
|
|
|
|
|
Ah - the joy of WordPress - especially with their default templates. I've been trying to find out how to add RSS feed links to the site and haven't been having too much luck with it.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
It's pretty easy, actually. In the admin section, go to the editor for your theme and look through the PHP templates. There should be template for the header, footer, sidebar etc. If you want to put it on top of the sidebar, there should be a PHP template that loops over the configured widgets.
For example, the HTML that is rendered for your sidebar looks like this:
<!-- begin sidebar -->
<div id="menu">
<ul>
<li id="pages" class="widget widget_pages">
<h2 class="widgettitle">Pages</h2>
...
If you find the PHP that generates this markup, all you have to do is putting a link to http://peteohanlon.wordpress.com/feed/ in there and you're done (that is, unless your template is seriously screwed up ).
HTH,
Philipp
NetDrives - Open Source Network Share Management
|
|
|
|
|
Philipp Sumi wrote: If you find the PHP that generates this markup, all you have to do is putting a link to http://peteohanlon.wordpress.com/feed/ in there and you're done (that is, unless your template is seriously screwed up ).
Ah, now there's the problem. As I'm running on WordPress.com, the template support is extremely limited; i.e. there's no template editor.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: there's no template editor.
Outch! Guess you're screwed then
NetDrives - Open Source Network Share Management
|
|
|
|
|
Not necessarily. I've just found a Widget that does what I want. Jobs a good'un.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Good morning everybody,
I would like to know how to show in GridViewColumn of pictures of a table of database.
I explain me fill DataSet has leave a request SQL.
In my DataSet I have a column which contains of of the data of type Varbinary.
I would like to know how to show in GridViewColumn of pictures instead of of the data of type Varbinary.
If you can help me please.
Excuse me I am French my English is bad
|
|
|
|
|
What you need to do is convert the binary into an image using something like:
public BitmapImage ConvertImage(byte[] value)
{
if (value != null && value.Length > 0)
{
using (MemoryStream stream = new MemoryStream(value))
{
BitmapImage image = new BitmapImage();
image.BeginInit();
image.StreamSource = stream;
image.EndInit();
return image;
}
}
return null;
}
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|