|
You're welcome.
|
|
|
|
|
I have a project where I'm using SetWindowPos through pinvoke to show a frameless window. In Windows Vista, when the window would load, there would be no window opening animation, but now that I'm running the project in Windows 7 the animation is there.
I'm now trying to use AnimateWindow to change the opening animation so that the length is 0. But I'm having trouble accomplishing anything with AnimateWindow except changing the behavior to hiding the window instead of showing it.
Is there anyone who can help?
Do we have any forum here specifically for Win32 API discussions?
|
|
|
|
|
Given the following code:
namespace WinServices
{
public enum SC_ACTION_TYPE
{
SC_ACTION_NONE=0,
SC_ACTION_RESTART=1,
SC_ACTION_REBOOT=2,
SC_ACTION_RUN_COMMAND=3
}
}
using WinServices;
public class MyClass
{
private static WinServices.SC_ACTION_TYPE m_actionType1 =
WinServices.SC_ACTION_TYPE.SC_ACTION_NONE;
private static WinServices.SC_ACTION_TYPE m_actionType2 =
WinServices.SC_ACTION_TYPE.SC_ACTION_NONE;
private static WinServices.SC_ACTION_TYPE m_actionType3 =
WinServices.SC_ACTION_TYPE.SC_ACTION_NONE;
}
Why am I getting a CLS compliance warning with this code (the property name - bolded, italicized, and underlined - is where the warning is happening)?
using WinServices;
public class MyClass
{
public static WinServices.SC_ACTION_TYPE ActionType1
{ get { return m_actionType1; } }
public static WinServices.SC_ACTION_TYPE ActionType2
{ get { return m_actionType2; } }
public static WinServices.SC_ACTION_TYPE ActionType3
{ get { return m_actionType3; } }
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Are both the enum and the class in the same assembly? If they are, is the assembly marked CLSCompliant ( the default is false ).
Have you tried explicitly marking the enum as compliant?
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Nick Butler wrote: Are both the enum and the class in the same assembly
No. Why should that matter?
Nick Butler wrote: Have you tried explicitly marking the enum as compliant?
No. I didn't know I could. Is that really a "good idea" (tm)?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
If the enum is in an assembly that is marked not compliant ( or not explicitly marked as the default is false ), and you try to use it in an assembly that *is* marked as compliant, you will get this warning.
If you don't want to set the whole assembly that contains the enum as compliant, you can just mark the enum as compliant. It's just an option.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
I have:
onchange="resetDest(1)" id="from1Select">
Origin
-------------------------
AUSTRALIA
Adelaide
Ballina Byron
Brisbane
Cairns
Darwin
Fraser Coast
Gold Coast
Hamilton Island
Hayman Island
Hobart
Launceston
Mackay
Melbourne (all airports)
Melbourne - Avalon
Melbourne - Tullamarine
Newcastle
Perth
Rockhampton
Sunshine Coast
Sydney
Townsville
Whitsunday Coast
-------------------------
CAMBODIA
Phnom Penh
Siem Reap (Angkor Wat)
-------------------------
HONG KONG
Hong Kong
-------------------------
INDONESIA
Denpasar (Bali)
Jakarta
Medan
Surabaya
-------------------------
JAPAN
Nagoya
Osaka (Kansai International)
Tokyo (Narita International)
-------------------------
MACAU
Macau
-------------------------
MALAYSIA
Kota-Kinabalu
Kuala Lumpur
Kuching
-------------------------
MYANMAR
Yangon
-------------------------
NEW ZEALAND
Auckland
Christchurch
-------------------------
PHILIPPINES
Manila
-------------------------
SINGAPORE
Singapore
-------------------------
TAIWAN
Taipei
-------------------------
THAILAND
Bangkok
Phuket
-------------------------
UNITED STATES
Honolulu
-------------------------
VIETNAM
Buon Me Thuot
Can Tho
Da Lat
Danang
Ha Noi
Hai Phong
Ho Chi Minh City
Hue
Nha Trang
Vinh
I do code:
webBrowser1.Document.GetElementById(select).InvokeMember("onchange()", "resetDest(1)");
I want to start function
onchange="resetDest(1) .
What do I do?
Thanks you very much
|
|
|
|
|
Hey, I have button in a Form, I implemented its Click handler as when its clicked an X is drawn.... I obtained the Graphics using the CreateGraphics() method of the button used it to call the DrawLine methods..
When I click it, it draws the line properly but when I move the mouse outside the button's boundary it vanishes. why?
The code for the click event handler is
private void button1_Click(object sender, EventArgs e)
{
Graphics g = button1.CreateGraphics();
g.DrawLine(new Pen(Color.Black), 20, 20, 200, 200);
g.DrawLine(new Pen(Color.Black), 200, 20, 20, 200);
}
|
|
|
|
|
When you say an X is drawn, do you mean on the button or on the form?
Also, you have to realize that any event that alters the form visually like a drag & drop or a mouse movement, you would need to "invalidate" the present form so that it would redraw itself.
|
|
|
|
|
I get the graphics from the button's CreateGraphics method and draw with it, this means that I'm drawing on the button right?
When I move the mouse inside the button's boundary it doesn't redraws, why? as soon as it gets outside the button, the drawing is gone Here, what is being redrawn? the button or the form?
|
|
|
|
|
Colin gave you the answer, much better than I did.
|
|
|
|
|
Ahmed Manzoor wrote: I get the graphics from the button's CreateGraphics method and draw with it, this means that I'm drawing on the button right?
Yes.
Ahmed Manzoor wrote: When I move the mouse inside the button's boundary it doesn't redraws, why? as soon as it gets outside the button, the drawing is gone
Because when you click a button, or hover over it the drawing of the button changes to give feedback to the user. For example when you click a button it looks pushed down, when you release your mouse button it pops back up again. Each of those drawing operations overwrite any previous drawing operations.
You draw onto the button directly. As soon as the user does anything that requires the button to redraw (clicking the button, hovering over the button, stopping hovering over the button, minimising the window, resizing the windows, moving the window, etc. etc.) then your drawing is gone and replaced with what ever the button control needs to draw.
Ahmed Manzoor wrote: Here, what is being redrawn? the button or the form?
Depending on what triggered redrawing it could be a number of things. That is why there is an OnPaint method. Regardless of what caused the button, or its parent control, or its parent form to be redrawn, OnPaint will get called.
You must therefore override the Button's OnPaint method and supply your additional drawing code in there.
|
|
|
|
|
Colin Angus Mackay wrote: Ahmed Manzoor wrote:
I get the graphics from the button's CreateGraphics method and draw with it, this means that I'm drawing on the button right?
Yes.
No.
It means that you are drawing on the screen where the button happens to be. The button is not at all aware of your drawings.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: It means that you are drawing on the screen where the button happens to be.
That is true in all cases regardless of the control. You only ever draw on the screen where other things happen to be.
Guffa wrote: The button is not at all aware of your drawings
I can draw on my kitchen table, it isn't aware of my drawing either. I suppose it would have been more correct to say "over" rather than "on", but since it is a 2D surface you can't really have "over".
|
|
|
|
|
Because what you have drawn does not persist on the control you drew it on.
Basically, when you move your mouse off the button, the button redraws itself, thus overwriting what you drew.
If you want to draw on things you have to do it by overriding the OnPaint method. You have to remember what you drew before because each time the control is invalidated you have to draw it again (The system will call OnPaint each time the control is invalidated)
|
|
|
|
|
Ahmed Manzoor wrote: Graphics g = button1.CreateGraphics();
I'd love to know what sample it is that causes people to use this method where they shouldn't. As someone else said, you need to draw in your paint event.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
Wow - now THAT is pathetic.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Ok, I don't want it to be drawn, the first time, only when the button is clicked...
But still you won, now you may give me another way to do it and I got it....
Thanks y'all
|
|
|
|
|
Hello everyone,
I want to monitor current network utilization of current machine (Windows Server 2003) to see how busy the server is with network traffic. Any samples?
BTW: the background is, I am writing a tool which will copy large file only when server network utilization is not very high (i.e. I do not want to impact current product working network utilization and want to find some relatively free network utilization time slot to copy files).
thanks in advance,
George
|
|
|
|
|
I'm probably stating the obvious here, but perhaps you could use WMI[^] to do this? See this[^] CP article as an example.
/ravi
|
|
|
|
|
Thanks Ravi,
Good documents!
regards,
George
|
|
|
|
|
|
Good to learn from you, thanks Hamid!
regards,
George
|
|
|
|
|
I glad of I heared it.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|