|
Ah, OK thanks. That makes sense. Is there a way to disable all the controls? Well except for the main windows things mentioned above, resize, minimize, etc... I am sure there is, never mind, I will go look it up. Thanks for getting me that far though.
Sean
|
|
|
|
|
foreach (Control c in this.Controls) {
c.Enabled = false;
} /ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi.
I write a program that have a database(Access) and is using crystal report.
How can I make a setup for it?
My question is more about Access databaes and crystal report.
(C#,VS2003)
Best wishes
|
|
|
|
|
|
Hi. I am a new beginner in C#. If a C# project is started with a normal Windows application template rather than a SmartDevices template, is there anyway to change it afterwards?
Thanks, Pedro
|
|
|
|
|
Not easily. The best bet would be to create a SmartDevices project and copy over the files that you need
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/[^]
|
|
|
|
|
I am trying to set the back color of indavidual charachters in a RichTextBox by using SendMessage()
and the charformat2 structure. This works setting the forecolor of the charachters, but the back color will not work. I know that my version of RichEdit supports backcolors because they will show up if I paste, just not with the code. I thought that maybe it was assigning the wrong size to cbSize, but I dont know why it would do that. I am missing something very simple here im sure. I have tried this with the API call and have the same result. The message returns a non zero value, meaning it was successful, but the RichTextBox doesnt reflect that.
...
private const int CFM_BACKCOLOR=0x4000000;
.....
CHARFORMAT2 cf2=new CHARFORMAT2();
cf2.dwMask=CFM_BACKCOLOR;
cf2.cbSize=Marshal.SizeOf(cf2);
cf2.crBackColor=ColorTranslator.ToWin32(Color.Red);
IntPtr lParam=Marshal.AllocCoTaskMem(Marshal.SizeOf(cf2));
Marshal.StructureToPtr(cf2, lParam, false);
Message msg=Message.Create(this.Handle, EM_SETCHARFORMAT, (IntPtr)SCF_SELECTION, lParam);
DefWndProc(ref msg);
Marshal.FreeCoTaskMem(lParam);
Thanks!
|
|
|
|
|
You'll also have to clear the CFE_AUTOBACKCOLOR flag or your background color will be ignored.
Regards,
mav
|
|
|
|
|
Do you mean to set dwEffects=0? I tried that before I posted and nothing. If that isnt what you meant could you elaborate? Thanks!
|
|
|
|
|
You have to set dwMask to CFM_BACKCOLOR|CFM_COLOR and be sure NOT to set CFE_AUTOBACKCOLOR in dwEffects.
Here's the description of the flags you can use:
CHARFORMAT2 struct on MSDN[^]
Regards,
mav
|
|
|
|
|
I tried all of that before I posted, and tried it again after you posted, and still, nothing. I tried dwEffects=0, dwEffects=CFE_PROTECTED, not setting dwEffects, etc. Nothing has worked. Like I said, the call to DefWndProc is returning a non zero value, so it is working, just not how I want it to. There has to be something I am missing somewhere... I am going to list all my constants, structure, etc, and perhaps someone can figure out what is going on. FYI, I have also tried the API call and it does the same thing.
[StructLayout(LayoutKind.Sequential)]
private struct CHARFORMAT2
{
public int cbSize;
public int dwMask;
public int dwEffects;
public int yHeight;
public int yOffset;
public int crTextColor;
public byte bCharSet;
public byte bPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)]
public string szFaceName;
public int wWeight;
public int sSpacing;
public int crBackColor;
public int lcid;
public int dwReserved;
public int sStyle;
public int wKerning;
public byte bUnderlineType;
public byte bAnimation;
public byte bRevAuthor;
public byte bReserved1;
}//struct charformat2
//constants
EM_SETCHARFORMAT=0x444;
CFM_BACKCOLOR=0x4000000;
CFM_COLOR=0x40000000;
SCF_SELECTION=0x1;
//Call to format, tried CFM_BACKCOLOR and CFM_BACKCOLOR|CFM_COLOR, etc,
// only forecolor changes
CHARFORMAT2 cf2=new CHARFORMAT2();
cf2.dwMask=CFM_BACKCOLOR;
cf2.cbSize=Marshal.SizeOf(cf2);
cf2.crBackColor=ColorTranslator.ToWin32(Color.Red);
IntPtr lParam=Marshal.AllocCoTaskMem(Marshal.SizeOf(cf2));
Marshal.StructureToPtr(cf2, lParam, false);
Message msg=Message.Create(this.Handle, EM_SETCHARFORMAT, (IntPtr)SCF_SELECTION, lParam);
DefWndProc(ref msg);
Marshal.FreeCoTaskMem(lParam);
|
|
|
|
|
I have 3 docking panel controls in a form.
Left Dock is a toolbox.
Center Dock has 2 children, one child is another panel with a bitmap on it. And the other is a panel for displaying a bitmap font for a corresponding KeyPress value.
Right Dock Panel has a textbox child.
When I use the Center.KeyPress mapped it a function it works correctly and types out the appropriate font, but if I click on the other child within the Center Dock, The Center dock(parent) loses focus and the KeyPress event is not firing.
I tried several things to regain focus: like overriding several functions to force Center.Focus() so the input would still type out. I am at a total loss on what to do now. The only way the KeyPress works again is if I click OUT of the Center Dock and then click back in.
Any suggestions would be great.
|
|
|
|
|
You could try mapping the child controls KeyPress event to the Center Dock's KeyPress event so if a key is pressed on the child control the code in your Center Dock's KeyPress event handler will be called.
- Aaron
|
|
|
|
|
Is it possible to create an abstract class with multiple constructors, and the constructor that is called is control by the class that inherits from it?
As an example, I have these two classes:
public abstract class MyAbs
{
protected MyAbs(){}
protected MyAbs(string foo){}
}
}
public sealed class Something : MyAbs
{
public Something(){}
public Something(string foo){}
}
If an instance of the "Something" class is created using the constructor that takes a string parameter I would like to constructor the base "MyAbs" class using that value. Is this possible?
|
|
|
|
|
public Something( string foo ) : base( foo ) {}
|
|
|
|
|
Thanks for the reply it works exactly as I needed
Whilst on this subject is it possible to construct the abstract class with a string that is created within the "Something" class constructor?
|
|
|
|
|
No. The constructor of the abstract class is executed before the code in the constructor of the inheriting class.
---
b { font-weight: normal; }
|
|
|
|
|
I have been using threadpool to run a thread, and the worker thread need an integer as argument:
<br />
private void someMainThread() {<br />
int ordernum = 10;<br />
ThreadPool.QueueUserWorkItem(new WaitCallback(chkOrderstart), ordernum);<br />
}<br />
<br />
private void chkOrderstart(Object stateinfo) {<br />
int orderNum = (Int32)stateinfo;
...<br />
}<br />
I tried the above code and it is giving me:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(2071,9): error MSB3113: Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'.
Done building project "VWStressTester.csproj" -- FAILED.
Pleas help
|
|
|
|
|
wow. uh, that seems like an install problem. your code *looks* correct (C# will 'BOX' the int as an object). try casting 'stateinfo' to int instead of Int32.
Did you have beta versions of VS2005 installed previously?
|
|
|
|
|
Hi
I need to print the report which I am creating using crystal reports. I am getting the list of attached printers and displaying in a drop down list as follows:
for( int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++ )
{
string printerName = PrinterSettings.InstalledPrinters[i].ToString();
ddlPrinters.Items.Add( printerName );
}
This particular piece of code displays the list of printers on server side. I instead want the list of printers on client side. Can someone please suggest how to do that?
Thanks in advance
|
|
|
|
|
I take it this is a WEB application and not Windows Forms???
If so, then you can't do this in your C# code since the server-side has absolutely zero access to the client. You'll have to use client-side JavaScript to do something like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In Javascript, I know window.print() is used but it prints the complete page.
1. Is their anyway in javascript to get the printer names on client machine ?
1. What do we do in javascript to print only the part of page and not the complete page ?
Thanks
|
|
|
|
|
I have no idea.
In theory, JavaScript running in a browser has no access to the list of installed printers.
But, you'd have to ask this in the Web Development forum for a better answer.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, you got question number one, and question number one?
For the first question number one:
No. There is absolutely no way that you can det the printer names using javascript.
For the second question number one:
You can't print a part of a page using javascript. You could take the contents of a part of a page, put it in a page in a new window, and print it.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks
That is what I am doing now. Displaying a part of page that I want to print on a new page and then printing.
|
|
|
|