|
There's no property to use, but you can subclass a ComboBox and stop the scroll wheel message (WM_MOUSEWHEEL ) from getting through by overriding the WndProc [^] method
public class ComboBoxEx : ComboBox<br />
{<br />
public ComboBoxEx() : base()<br />
{<br />
<br />
}<br />
<br />
<br />
protected override void WndProc(ref Message m)<br />
{<br />
if (m.Msg == 0x020A )<br />
{<br />
return;<br />
}<br />
<br />
base.WndProc (ref m);<br />
}<br />
}
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Hi Mathew,
Thanks for your code. Easy and it works fine.
Regards,
Davy
|
|
|
|
|
No worries
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
How can i hide or remove 1 or 2 of the buttons (next/previous month) in the MonthCalendar Control ?
Is there a way to do it ?
|
|
|
|
|
I don't think it's possible, the MonthCalendar control is a wrapper around the SysMonthCal32 common control and I don't see that as an option in the native control.
James
|
|
|
|
|
Hi all,
I am trying to achieve the same behavior as the FlowLayoutPanel control found in .NET 2.0, but with our current .NET 1.1 project.
Anyone knows of a 3rd party control that can do that?
Thanks!
|
|
|
|
|
|
I am trying to build a lottery program and want to read a comma delimited text file into my program and display it into text boxes has anybody got any suggestions or any help
|
|
|
|
|
|
If you have used Autocad , you must know how convenient it is to use "pan",Zoom in realtime.
I am wondering how can we move an image inside a picture box, after zoom in or our.
Can Anyone help?
jim
|
|
|
|
|
Look at Graphics.Transform, should be all you need ie
float scale = percentagezoom/100f;
g.Transform = new Matrix(scale,0,0,scale, xoffest, yoffset);
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
thank ya leppie, after several hour , I got it worked,
////////////////////
everyone is my teacher
|
|
|
|
|
Hi,
I'm quite new to C# especially when using GDI+. I saw the solution for zooming an image, but I didn't manage to zoom.
I couldn't quite understand what the parameters in "new Matrix(scale,0,0,scale, xoffest, yoffset);" mean I think
In order to zoom my image by 25% I implemented your code in the following way:
float scale = 25f/100f;
pictureBox.Image.Save("OriginalImage.png",ImageFormat.Png);
Graphics g = Graphics.FromImage(pictureBox.Image);
g.Transform = new Matrix(scale,0,0,scale, 0, 0);
pictureBox.Image.Save("ResizedImage.png", ImageFormat.Png);
pictureBox.Image = Image.FromFile("ResizedImage.png"); //to load the new image
What am I doing wrong please?
Thanks A Lot!
C.N.
|
|
|
|
|
SqlConnection mySqlconnection = new SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=sa");
is an example on how to connect to a database in ms sql server
my question is: how do we connect to the database of the server if the ms sql server is using soley on windows authentication to log in, and not using sql login id or password.
|
|
|
|
|
windcar04 wrote:
SqlConnection mySqlconnection = new SqlConnection("server=localhost;database=Northwind;uid=sa;pwd=sa");
SqlConnection mySqlconnection = new SqlConnection("server=localhost;database=Northwind;Integrated Security=True");
|
|
|
|
|
|
|
I was just in Barnes and Noble and I was skimming through the book "Effective C#" by Bill Wagner. One of his tips was that you should never have a public variable in a class, that you should ALWAYS use properties. This sorta goes against some things that I've read in other books. I was just curious what others thought about it. Isnt there extra overhead for using properties?
|
|
|
|
|
xdavidx wrote:
One of his tips was that you should never have a public variable in a class, that you should ALWAYS use properties. This sorta goes against some things that I've read in other books.
What other books?! I've never seen that advice. Bill Wagner is right - you should use properties. You should declare all member variables as private or protected (some people say that even protected is bad - But I think the jury's still out on that one)
Declaring a member variable as public means that encapsulation is broken and anything outside the object can modify the member variables without notice.
Using a property you can control what happens. Sometimes you don't mind that the member variable is updated from outside as any valid value cannot make the state of the object invalid. In this case the property just passes through the value and assigns it to the member variable. What is the point in that? (you might ask.) Well, if in the future you realise that when that variable changes something else must happen then you have your property already set up and adding some lines of code to the property means that you can do the other work without having to modify vast amounts of code to now use the property instead of a member variable.
Sometimes you might only want other code to have read-only access to the member variable's value, in this case you only implement a getter property so that nothing can set values on the property.
Does this help?
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
I personally think that you should use properties since you can hide your data members from clients of your class. This enforces a better object-oriented design. Also, if you want to expose your .NET classes to COM clients, then you must use properties. Properties are really function calls so the only overhead to using them is function call overhead.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
The JIT compiler might even inline the function calls when calling properties, as most property get/setters don't do much. That'll do away with the function call overhead also.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
One of the C# program managers, Eric Gunnerson[^], has commented that in some cases properties are over-used.
There are only a few times when I don't write properties out, mainly when dealing with structs or classes that are used just as data storage without any methods.
For example, one easy way to implement IEditableObject is to do something like this:
class Foo : IEditableObject
{
private struct FooData
{
public int i;
public string j;
public DateTime t;
public object o;
}
private FooData data;
private FooData old;
public int I
{
get { return data.i; }
set { data.i = value; }
}
public string J
{
get { return data.j; }
set { data.j = value; }
}
void BeginEdit()
{
old = data;
}
void CancelEdit()
{
data = old;
}
void EndEdit()
{
}
}
I believe I do something similar in my IExtenderProvider article where all of the data stored for each object 'extended' is stored in a class with public fields. I know this is the case in the code that inspired the article.
In both cases the type exposing public fields is only intended for the use of one class in a private manner.
James
|
|
|
|
|
Ok, i have a process that launches a worker thread to do stuff. The problem I have is that while the worker bee is doing its thing, the main boss thread is coming along and killing an object that the worker bee is using. So, i am wondering is it possible to "stop" or pause the main thread while the worker bee finishes. I know its almost like a thread timing issue, so i am wondering if anyone has advice of this matter.
Thanks
Sameer
|
|
|
|
|
You can call the Join method of your worker thread to make the main thread wait until the worker thread terminates.
www.troschuetz.de
|
|
|
|
|
Autoupdater application is not able to download the files with extension .config.
Our manifest file contains entries for dll files and .config files. The problem arises when the files list starts with the .config file followed by dlls or only the .config file.
When it tries to download the .config file, it throws an error “The server does not support range header”. This comes when we re-start the client machine and download files for the first time.
The manifest file that we are using is:
---------------------------------------
<manifest manifestid="{311085F7-9320-4318-9A67-9BE32F04E111}" mandatory="False"
="" xmlns="urn:schemas-microsoft-com:PAG:updater-application-block:v2:manifest">
<description>a description for this manifest
<application applicationid="{215E1AD7-9ABA-432f-A952-24BABA556850}">
<entrypoint file="TWSWinUI.exe" parameters="">
<location>..\..\..\Elind.TraderWorkStation\Core\UserInterface\WinUI\Bin\
<files base="http://10.150.15.208/BlockBook_TWS/Version1/">
<file source="TWSWinUI.exe.config">
<activation>
<tasks>
<task name="ApplicationDeployProcessor" type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.ApplicationDeployProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors">
Downloader configuration in App.config is:
------------------------------------------
<includetypes>
<includetype name="Xml Include Type" type="Microsoft.ApplicationBlocks.Updater.Downloaders.BITSDownloaderProviderData, Microsoft.ApplicationBlocks.Updater.Downloaders">
|
|
|
|