|
Hello
I am using DrawingContext to draw text, and then i print visual throu PrintDialog. I want to convert input from milimeters. I do not know formula and on google i only found a few pieces, but i realy want to be printer independet.
I found on a Some page
1 mm = 3.779528 px
Is this printer independet. I am writing an application that will print on normal A4 printer or on 60mm x Reciept type printers. My app is already printing, but some values i want to be in pixel and some in mm.
Thank you
Edit: Upon remote testing i noticed that no matter if Printer is 600DPI or 300dpi. I can simply ignore these values
modified 22-Jul-13 5:30am.
|
|
|
|
|
Saksida Bojan wrote: 1 mm = 3.779528 px
WPF uses Device Independent Pixels, you may have a hard-time with this asumption
Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas.
Source
|
|
|
|
|
I Know WPF is DPI indipented when putting it on screen.
Does that extend to Printing? I am using Drawing Context and all values are pixel based. My Printer has resolution 600dpi. But other printer that is currently not awaible is STAR SP 200 Series. It is a 300DPI Matrix type printer.
|
|
|
|
|
Hi,
Can somebody highlight the uses please. Also, there are lot of unused usings being created in this files, is there anyway we can suppress them?
http://authenticcode.com
|
|
|
|
|
When you use Visual Studio to write your project (no matter what type of app you are writing), it does a lot of background build work. The .g.cs and .g.i.cs files are auto-generated from XAML files when the build process runs; the .g.i.cs is the part that ties into the Intellisense builder.
As far as removing the unused usings, you'd have to edit the source template. On my machine, running Visual Studio 2012, they are located under C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\WPF\1033 . Obviously, you'd have to pick your appropriate VS install location, but this should give you a head start.
|
|
|
|
|
Hi Pete,
Thanks a lot for the explanation.
If I comment out all code in g.i.cs file then also my app runs fine without any issues and intellisense also works fine. Then, what's the actual use?
http://authenticcode.com
|
|
|
|
|
Remember that it's auto-generated, and I said the auto-build is always running.
|
|
|
|
|
Okay. Thanks.
I could not find relevant template although there are all other templates present.
http://authenticcode.com
|
|
|
|
|
Mohammed Hameed wrote: lot of unused usings being created in this files Right click on any of the using statements and select "Organize Usings" -> "Remove Unused Usings".
Use the best guess
|
|
|
|
|
But that is a auto-generated file, if we manually remove the usings then it will again recreate when we rebuild the project. Therefore I need a permanent fix, something like as suggested by Pete to edit the template but unfortunately I'm unable to find that template.
http://authenticcode.com
|
|
|
|
|
If it's an auto generated file then you should not be modifying it in the first place. Also, why does it matter, as these statements are only used by the compiler?
Use the best guess
|
|
|
|
|
Some of them are required for starting the app, intellisense, assembly identification etc.
Take a look at the App.g.cs (for a desktop wpf app). It loads the BAML (compiled XAML, embedded as a resource in the assembly) to the XAML parser. Without it probably your WPF application will not run. They just contain few lines of code so not a thing of worry as they aren't huge memory/cycle eating hogs!
Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas.
Source
|
|
|
|
|
Thank you Amitosh. Now I got the clear idea and thanks for mentioning BAML.
http://authenticcode.com
|
|
|
|
|
Hi,
I writing an app with Wpf, MVMM, Prism and Entity Framework, I have a conflict for using entity framework.
Which one is better? Code First or Database First?
Also :
- The database is existing.
- I want just save a single entity (with AutoDetectedChangedEnable)
- Working with Observable Collection in binding.
Thanks a lot
Hossein
|
|
|
|
|
Hossein Khalaj wrote: The database is existing
I would think that makes you question irrelevant for this project!
Personally I can't conceive of a code first project, it is all about the database, but then I'm purely a LOB developer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I used multiple silverlight project in my solution based on microsoft prism framework. my application is very slow and consume over 200m of memory. what to do?
|
|
|
|
|
Profile it to find out what's getting called repeatedly and unecessarily, or what is being loaded when it doesn't need to be. There are many suitable profilers you could use.
|
|
|
|
|
i wanna to get audio buffer to mediaelement. when playing wmv file in mediaelement.
|
|
|
|
|
Hi,
I have a requirement, where i need to draw line dynamically with the help of mouse using WPF. Finally i need to capture X-Axis & Y-Axis measurement once a curve line drawn, how to do that?
|
|
|
|
|
Have you looked around on htis site for projects, as there are many articles on the subject.
HEres one
WPF DrawTools[^]
|
|
|
|
|
Im using MVVM. I have a form and a grid view below the form. Once I save data in GridView, it goes to database and show in GridView. I want to load data to the controls when select a particular row in GridView.
This is my GridView in View
<ListView SelectedValue="_row" ItemsSource="{Binding PromExams}" Name="ListViewEmployeeDetails" Margin="13,159,38,0" Height="183" VerticalAlignment="Top" >
<ListView.View>
<GridView x:Name="grdTest" >
<GridViewColumn Header="Part 1 Marks" DisplayMemberBinding="{Binding Part1Marks}" Width="100"/>
<GridViewColumn Header="Part 2 Marks" DisplayMemberBinding="{Binding Part2Marks}" Width="100"/>
<GridViewColumn Header="Total" DisplayMemberBinding="{Binding Total}" Width="100"/>
<GridViewColumn Header="Average" DisplayMemberBinding="{Binding Average}" Width="100"/>
</GridView>
</ListView.View>
</ListView>
how can I do that
|
|
|
|
|
i want to implement audio bars in mediaelemnt ...
|
|
|
|
|
I dont understand, could you expalain or elaborate?
|
|
|
|
|
I am trying to create a reasonably complex datagrid.
At the core, there are sting pairs where the first string is the key and the second is the value.
I make 2 passes through the base array. Don't try to understand the base array, just accept that 2 strings, key and value, are extracted.
On the first pass, the datagrid has columns dynamically created. The column names works as expected. I believe the binding is not correct.
Once all know possible columns are known, the second pass extracts the key/value pairs from the original table and composes a dictionary called "person".
The original table is a 2 dimensional table, first an array of key/values of dynamic length then a dynamic number of such arrays.
Each dictionary is added to a List called "persons"
If a particular key is not found in the base table, the value "_" is assigned.
Finally the datagrid.itemsource is assigned the list "persons".
When the datagrid is displayed, the column names are correct.
The number of columns is correct.
The number of rows is correct but blank.
The debugger output window shows a flurry of error messages such as:
==========
System.Windows.Data Error: BindingExpression path error: 'mv' property not found on 'System.Dynamic.ExpandoObject' 'System.Dynamic.ExpandoObject' (HashCode=60469192). BindingExpression: Path='mv' DataItem='System.Dynamic.ExpandoObject' (HashCode=60469192); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'Text' (type 'System.String')...
======
Note that "mv" is one of the column names.
When I display the "persons" list using the debugger dynamicview for "persons" it does show the column name "mv" with the correct value.
The xaml:
===
<controls:ChildWindow x:Class="VCI_Envision_Portal.Views.LegacyGraphicDisplay.BackgroundDataxaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
Width="400" Height="300"
Title="BackgroundDataxaml"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
>
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
<data:DataGrid AutoGenerateColumns="True" Height="226" HorizontalAlignment="Left" Name="BackgroundDataGrid" VerticalAlignment="Top" Width="372" />
</Grid>
</controls:ChildWindow>
===
the xaml.cs:
====
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections;
using System.Collections.ObjectModel;
using System.Windows.Data;
using System.Dynamic;
using Microsoft.CSharp;
using Microsoft.CSharp.RuntimeBinder;
using VCI_Envision_Portal.VCIWCFServicesNS;
namespace VCI_Envision_Portal.Views.LegacyGraphicDisplay
{
public partial class BackgroundDataxaml : ChildWindow
{
private ObservableCollection<VCI_Point_Data[]> vci_pt_data_cooked_bg = new ObservableCollection<VCI_Point_Data[]>();
List< ExpandoObject > persons;
public BackgroundDataxaml(VCI_Point_Data[][] vci_pt_data_cooked_in)
{
int i;
for (i = 0; i < vci_pt_data_cooked_in.Length; i++)
{
vci_pt_data_cooked_bg.Add(vci_pt_data_cooked_in[i]);
}
InitializeComponent();
SetPageValues();
}
private void SetPageValues()
{
int index = 0;
RowDefinition rd = new RowDefinition();
persons = new List<ExpandoObject>();
ObservableCollection<Customer> bdd = new ObservableCollection<Customer>();
int iCount = vci_pt_data_cooked_bg.Count();
while (index < iCount)
{
int iColumnCount = 0;
DataGridRow dgr = new DataGridRow();
if (vci_pt_data_cooked_bg[index] != null)
{
int iColumns = vci_pt_data_cooked_bg[index].Count();
while (iColumnCount < iColumns)
{
if (vci_pt_data_cooked_bg[index][iColumnCount] != null)
{
Customer bob = new Customer();
bob.FieldName = vci_pt_data_cooked_bg[index][iColumnCount].Pt_Column;
bob.FieldValue = vci_pt_data_cooked_bg[index][iColumnCount].Pt_Value;
bdd.Add(bob);
{
int i = 0;
bool bFound = false;
for (i = 0; (i < BackgroundDataGrid.Columns.Count) && !bFound; i++)
{
if (BackgroundDataGrid.Columns[i].Header.Equals(bob.FieldName))
bFound = true;
}
if (!bFound)
{
DataGridTextColumn mycol = new DataGridTextColumn
{
Header = bob.FieldName,
Binding = new Binding( bob.FieldName )
};
BackgroundDataGrid.Columns.Add( mycol );
}
}
}
iColumnCount++;
}
}
index++;
}
iCount = vci_pt_data_cooked_bg.Count();
ObservableCollection<DataGridColumn> dgc = BackgroundDataGrid.Columns;
index = 0;
while (index < iCount)
{
int iCols = 0;
var aperson = new ExpandoObject() as IDictionary<string, Object>;
while (iCols < dgc.Count())
{
bool bFound = false;
int y = 0;
string skey = dgc[iCols].Header.ToString();
if ( vci_pt_data_cooked_bg[index] != null )
{
while ( (y < vci_pt_data_cooked_bg[index].Length) && !bFound )
{
if (vci_pt_data_cooked_bg[index][y].Pt_Column.Equals(skey ) )
{
bFound = true;
aperson.Add( skey, vci_pt_data_cooked_bg[index][y].Pt_Value );
}
y++;
}
if (!bFound)
{
aperson.Add(skey, "_");
}
}
iCols++;
}
index++;
persons.Add((ExpandoObject)aperson);
}
BackgroundDataGrid.ItemsSource = persons;
}
private void OKButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
public class Customer
{
public string FieldName { get; set; }
public string FieldValue { get; set; }
}
}
}
===
I think the binding is wrong.
But this is the best I could decipher from online examples.
Please advise.
Boyd
Boyd D. Mills
mailto:BMills@VCIControls.ca
|
|
|
|
|
I have a WPF project and I have added a user control but when I try to add the xmlns of the user control to the MainWindow xaml, nothing shows up in the intellisense what am I missing here. Thanks.
|
|
|
|