|
Hi,
So here's something I hadn't considered when I started developing my application about a year ago. It now has dozens of screens, and for just about all of them the graphics turn out wrong when I change my DPI settings from 96dpi to 120dpi. I've read some MS articles on this, but they basically state "rewrite your UI code".
Since this could take months I'm wondering if there's any way to map my pixel-based scaling to take the dpi-setting into account, or any other solution. Do any of you have experience in this? Is there anyone that has a fix or a suggestion for this that doesn't come down to "rewrite your code"? Any help would be greatly appreciated!
|
|
|
|
|
Hi all
I get points(x,y coordinates) delivered from a external source via Bluetooth. I want to draw these points(strokes) in real-time in an PowerPoint presentation. Each stroke shall be an object in PowerPoint so the user then can move around the free hand drawing stroke after the entire stroke is finished.
The problem I have is that the actual object that appears in PowerPoint when drawing flickers a lot because of up to 75 new points per second can be received. Is there any way of do this in a better way? Or should I just store up points and then update to PowerPoint in intervals?
Any help is much appreciated as there is hard to find any good information or tutorials about the best way to interface with powerpoint...
Kind Regards
Jonas Olofsson
Code snippet:
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
public void UpdateFreeDrawStroke(int x, int y)
{
// Update active free draw stroek with new point
currentStroke.Nodes.Insert(currentStroke.Nodes.Count, Microsoft.Office.Core.MsoSegmentType.msoSegmentLine, Microsoft.Office.Core.MsoEditingType.msoEditingAuto, ConvertCoord(x), ConvertCoord(y),0,0,0,0);
}
// Create new active free draw stroke at (x,y)
public void NewFreeDrawStroke(short x, short y)
{
int convX = ConvertCoord(x);
int convY = ConvertCoord(y);
PowerPoint.FreeformBuilder b = pptSlide.Shapes.BuildFreeform(Microsoft.Office.Core.MsoEditingType.msoEditingAuto, convX, convY);
b.AddNodes(Microsoft.Office.Core.MsoSegmentType.msoSegmentLine, Microsoft.Office.Core.MsoEditingType.msoEditingAuto, convX+1, convY+1, 0, 0, 0, 0);
currentStroke = b.ConvertToShape();
}
|
|
|
|
|
Hi there, i get an exception while using C# and wmi to retrieve some data.
So here is the code is wrote:
<br />
public class Adapter<br />
{<br />
public static ManagementObjectCollection GetNicAdapters()<br />
{<br />
try<br />
{<br />
WqlObjectQuery WQO = new WqlObjectQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionStatus != null");<br />
ManagementObjectSearcher MOS = new ManagementObjectSearcher(WQO);<br />
ManagementObjectCollection MOC = MOS.Get();<br />
return MOC;<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("Data couldn't be retrieved.");<br />
return null;<br />
}<br />
}<br />
I use this function to populate a field in my Form1 Base form. On the form (visually) there is a combo box, which now is filled with the Description of the Object.
All of this works so far but now i am getting problems:
<br />
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
<br />
if (Adapters != null)<br />
{<br />
try<br />
{<br />
ManagementObject[] MOArray = new ManagementObject[Adapters.Count];<br />
Adapters.CopyTo(MOArray, 0);<br />
<br />
int select = comboBox1.SelectedIndex;<br />
int selectedIndex = int.Parse(MOArray[select]["Index"].ToString());<br />
int status = int.Parse(MOArray[select]["NetConnectionStatus"].ToString());<br />
<br />
string myQueryString = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = " + selectedIndex.ToString();<br />
<br />
WqlObjectQuery ConfigQuery = new WqlObjectQuery(myQueryString);<br />
ManagementObjectSearcher ConfigSearcher = new ManagementObjectSearcher(ConfigQuery);<br />
ManagementObjectCollection ManagementObjectConfigurations = ConfigSearcher.Get();<br />
<br />
ManagementObject[] CurrentArray = new ManagementObject[ManagementObjectConfigurations.Count];<br />
<br />
ManagementObjectConfigurations.CopyTo(CurrentArray, 0);<br />
ManagementObject CurrentConfig = CurrentArray[0];<br />
<br />
#region Draw Status<br />
IconConverter IC = new IconConverter();<br />
switch (status)<br />
{<br />
case 0:<br />
l_status.Text = "Gerät nicht angeschlossen";<br />
pb_status.Image = (Image)IC.ConvertTo(Switch.Properties.Resources.status_disconnected, typeof(Image));<br />
break;<br />
}<br />
#endregion<br />
<br />
l_MAC.Text = CurrentConfig["MACAddress"].ToString();<br />
l_host.Text = CurrentConfig["DNSHostName"].ToString();<br />
l_svc.Text = CurrentConfig["ServiceName"].ToString();<br />
<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString());<br />
}<br />
}<br />
Executing the code i get a NullReferenceException where it says:
l_MAC.Text = CurrentConfig["MACAddress"].ToString();
So why is the MACAddress Property not set? It seems to be that the second wql query isn't working, but why? please help me i am soooo close to loosing it and throwing my laptop out of my window!
please rescue me.thanx in advance.
|
|
|
|
|
Hi,
is there a way to make a property from a base class like "BackColor" protected or private in the derived class?
I want to make a ThinButton inherited from the button class and don't want to see BackColor in the propertygrid..
Thx
Kurt
|
|
|
|
|
You can't change its visibility, but you can use the System.ComponentModel.BrowsableAttribute to hide it from the property grid.
|
|
|
|
|
Great..gonna try this one.
thx for the quick response..
Kurt
|
|
|
|
|
hello...
i am unable to fill in the property selectionformula(property of crystalreportviewer object) with a correct string .... please provide general syntax or an example and please remember to write how to select values using 2 fields.... that is how to select using 2 column values...
thanx
haseeb
|
|
|
|
|
hello...
i am unable to fill in the property selectionformula with a correct string .... please provide general syntax or an example and please remember to write how to select values using 2 fields.... that is how to select using 2 column values...
thanx
haseeb
|
|
|
|
|
i tried using wizard it shows data in data adapter
when i use
odbcConnection1.ConnectionString --> "Dsn=Visual FoxPro Tables;database ='d:\\try\try\\reconcil and bank entry\\TRY\\DOBANK\\tables'"
odbcDataAdapter1.Fill(dataSet11, "enet.dbf");
it gives error
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
ERROR [01S00] [Microsoft][ODBC Visual FoxPro Driver]database
ERROR [01S00] [Microsoft][ODBC Visual FoxPro Driver]SourceDB
any example of using them can be helpful
thanks
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Hi,
i made it like this :
string conn = "Driver={Microsoft dBASE Driver(*.dbf)};DriverID=277;Dbq=PATH_TO_YOUR_DBF_FILES;";
OdbcConnection Conn = new OdbcConnection(conn);
OdbcCommand Comm = new OdbcCommand("select * from xxx limit 30");
Conn.Open();
Comm.Connection = Conn;
OdbcDataAdapter DA = new OdbcDataAdapter(Comm);
DataSet DS = new DataSet("Table");
DA.Fill(DS);
DataGrid.DataSource = DS;
DataGrid.DataMember = "Table";
But somethimes it crashes, sometimes it works great ... But i read on the net thats a known bug
|
|
|
|
|
thanks
baerten
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
I think your dbf might contain a blob or general field. The data adapter can not handle the potential data. (da limit of 8000 or so, when blob could be 4 gig).
If you want to send me your dbf, I will send you a code snippet that can read it.
With all respect to the prior post, if your reading a FoxPro table AND it has one or more indexes you should not use a dbase driver. Also the dbase driver will truncate the blob masking the problem.
pmcgahan@hteinc.com
mcgahanfl@hteinc.com
|
|
|
|
|
I think your dbf might contain a blob or general field. The data adapter can not handle the potential data. (da limit of 8000 or so, when blob could be 4 gig).
If you want to send me your dbf, I will send you a code snippet that can read it.
With all respect to the prior post, if your reading a FoxPro table AND it has one or more indexes you should not use a dbase driver. Also the dbase driver will truncate the blob masking the problem.
pmcgahan@hteinc.com
mcgahanfl@hteinc.com
|
|
|
|
|
Hi,
i want to download a file from a http adres (by example http:\\www.downloadit.com\exports.xml). When i do this in my browser i get a screen where i have to give my username and password (by example username=JohnDoe and password = zzz).
Now i want to make an aspx page where i can download the file on the pageload event. Can someone give me some tips on how i can do this?
Arvind sharma
|
|
|
|
|
Use the Credentials property of the HttpWebRequest class (if you use that class).
Ex.
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.downloadit.com/exports.xml");
myRequest.Credentials = new NetworkCredentials("JohnDoe", "zzz");
// Make your request.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I am dynamically creating the controls in code behind page.I also created the required field validators. It is working fine but it is showing error redirecting the page to next which I ant to stop the action there itself
Bhanu
|
|
|
|
|
HI all
built a small c# app in visual studio express edition and it works from the debugger(er)
now i run each exe file (release and debug) from outside the debugger and they
wont run.
Their size is 24k, so i figure they need to be statically linked etc but i cant see how and where in Visual Studio to do this
does anyone have any suggestions?
Bryce
-- modified at 22:33 Wednesday 18th October, 2006
|
|
|
|
|
There is no static linking to the .NET Framework. You're looking for an option that doesn't exist. Are you saying the the .EXE won't run on the development machine? Any machine that runs your app must have the .NET Framework 2.0 installed in order to work.
Well, there ARE a couple products out there that will compile your code into an .EXE that has the parts of the .NET Framework built into the app, but they cost LARGE $$$$ and introduce their own problems into the maintainability of your code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
bugger.
Bryce
p.s. thanks
|
|
|
|
|
What do you mean when you say that "they wont run"(sic)? What happens when you try? Do you get an error message?
---
b { font-weight: normal; }
|
|
|
|
|
I'm trying to send a WM_CONTEXTMENU message to an NotifyIcon control, hoping to pop open the context menu. Am I totally off base with the following code? Needless to say, since I am posting to this forum, it isn't working.
// Send message to open context menu
Message m = new Message();
m.Msg = WM_CONTEXTMENU;
// Get notify icon native window
Type t = this.notifyIcon1.GetType();
NativeWindow icon = ((NativeWindow)t.GetField("window", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this.notifyIcon1));
// Create message
m.HWnd = icon.Handle;
m.WParam = icon.Handle;
Int16 high = Convert.ToInt16(this.m_ptLeftClick.X);
Int16 low = Convert.ToInt16(this.m_ptLeftClick.Y);
m.LParam = (IntPtr)((Int32)(high << 16) + low);
// Send message
icon.DefWndProc(ref m);
|
|
|
|
|
I read about wininet.dll, but i'd like to know if a computer is connected as soon as is connected, how can i know it? i thought using a timer, but i don't think it's a good idea..
|
|
|
|
|
Hope following helps you
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;
//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc = 0 ;
return InternetGetConnectedState( out Desc, 0 ) ;
}
- ashish
|
|
|
|
|
Yes, but the problem isn't this. I need know where a computer is connected, how can i check it? checking with this method every second with a timer?
|
|
|
|
|
So I have the following structure definition:
[StructLayout(LayoutKind.Explicit)]<br />
struct MyStruct<br />
{<br />
[FieldOffset(0)]<br />
public float f;<br />
<br />
[FieldOffset(0)]<br />
public int i;<br />
<br />
[FieldOffset(4)]<br />
public object o;<br />
<br />
[FieldOffset(4)]<br />
public ArrayList al;<br />
}
And the following program:
static void Main(string[] args)<br />
{<br />
MyStruct s;<br />
s.i = 1;<br />
s.f = 1.0f;<br />
s.al = null;<br />
s.o = new object();<br />
Console.WriteLine("float = {0}", s.f);<br />
Console.WriteLine("int = {0:x}", s.i);<br />
Console.WriteLine("object = {0}", s.o);<br />
Console.WriteLine("arraylist = {0}", s.al);<br />
Console.WriteLine("arraylen = {0}", s.al.Capacity);<br />
s.al.Remove(s.o);<br />
Console.ReadLine();<br />
}
Essentially, I'm forcing an ArrayList reference to point to an object of type Object, then calling ArrayList member functions on that Object. As you might imagine, this leads to some fairly disastrous consequences in the runtime. Calling various members of the ArrayList results in an exception being thrown:
s.al.Add(s.o): RemotingException ("Cannot load type")
s.al.Remove(s.o): AccessViolationException
s.al.BinarySearch(s.o): SEHException
Obviously this program is no longer type-safe, but running the peverify utility on the generated executable gives a thumbs-up. All of this brings me to the actual question.. is this the intended behavior of the language and runtime, or is this a bug?
Googling brings me to http://discuss.develop.com/archives/wa.exe?A2=ind0112c&L=dotnet&D=0&P=53651, but this was written five years ago and doesn't actually provide an answer to the question. What do you guys think about this behavior? Am I justified in seeing this as a security vulnerability (perhaps a plugin commits a privilege escalation attack) rather than a simple bug?
|
|
|
|