Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

CooperWu

@CooperWu
About
Posts
226
Topics
46
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • The Webbrowser in WPF can’t display page unless mouse moving on.
    C CooperWu

    The Webbrowser in WPF can't display page unless mouse moving on. This bug can't reproduce in my demo project, and I don't know how to fix it. I tried: call WindowsFormsHost.UpdateLayout. (Failed) call WindowsFormsHost's child, a WebBrowser control. call WebBrowser.Update or WebBrowser.Refresh. (Failed) call WindowsFormsHost.InvalidateVisual() (Failed) Is there other solution? I even simulated mouse moving on like this:

    AutomationElement element = AutomationElement.FromHandle(winAdHoster.Handle);
    ATGTestInput.Input.MoveToAndClick(element);

    this failed again.

    Glad to discuss with you and best wishes.

    WPF help csharp wpf tutorial question

  • Nothing displayed when set a line to DashStyles.Dot
    C CooperWu

    <DockPanel LastChildFill="True" Height="18">
    <Image Height="18" Width="80">
    <Image.Source>
    <DrawingImage>
    <DrawingImage.Drawing>
    <GeometryDrawing Brush="Black">
    <GeometryDrawing.Geometry>
    <LineGeometry StartPoint="0,9" EndPoint="38,9" />
    </GeometryDrawing.Geometry>
    <GeometryDrawing.Pen>
    <Pen DashCap="Flat"
    Brush="Black"
    Thickness="0.5"
    DashStyle="{x:Static DashStyles.Dot}, Mode=OneTime}"
    />
    </GeometryDrawing.Pen>
    </GeometryDrawing>
    </DrawingImage.Drawing>
    </DrawingImage>
    </Image.Source>
    </Image>
    <TextBlock Height="18" Text="{Binding Name, Mode=OneTime}" Margin="3,2,5,0" />
    </DockPanel>

    Actually, I want to list all line styles in a ComboBox.

    Glad to discuss with you and best wishes.

    WPF wpf wcf graphics

  • change directory access control for common application data folder failed.
    C CooperWu

    Thanks for your reply, we granted directory access right in installer too. It works well. :laugh: :laugh:

    Glad to discuss with you and best wishes.

    C# help

  • change directory access control for common application data folder failed.
    C CooperWu

    does this work on Vista?

    Glad to discuss with you and best wishes.

    C# help

  • change directory access control for common application data folder failed.
    C CooperWu

    nobody know how to solve this? :sigh: :sigh: :(( :((

    Glad to discuss with you and best wishes.

    C# help

  • change directory access control for common application data folder failed.
    C CooperWu

    Here is my code, and i tried same code for file access control, it works well. but doesn't work for common application data on Vista.

    private static void GrantEveryoneFullControlRight(string directory)
            {
                try
                {
                    if (!Directory.Exists(directory))
                        Directory.CreateDirectory(directory);
    
                    DirectoryInfo dirInfo = new DirectoryInfo(directory);
                    DirectorySecurity ds = dirInfo.GetAccessControl(AccessControlSections.Access);
    
                    FileSystemAccessRule rule = new FileSystemAccessRule(
                        "Users", FileSystemRights.FullControl, AccessControlType.Allow);
    
                    ds.AddAccessRule(rule);
                    dirInfo.SetAccessControl(ds);
    
    
                }
                catch (Exception ex)
                {
                    // Logger.WriteLog(LogType.Error, ex.ToString());
                    Console.WriteLine(ex.ToString());
                }
            }
    

    Glad to discuss with you and best wishes.

    C# help

  • How can I be notified when Windows XP fades the screen to gray?
    C CooperWu

    Thanks for your reply, i tried it, it doesn't work. the WPF window can't catch WM_QUERYENDSESSION message...

    Glad to discuss with you and best wishes.

    WPF csharp question dotnet wpf help

  • How can I be notified when Windows XP fades the screen to gray?
    C CooperWu

    We have an application developed in C# with WPF (.NET Framework 3.0) The main window has a glass border, and a child window containing a WebBrowser is centered within it: WPF main window  -> Child window - frame control   -> Page    -> WindowsFormsHost     -> WebBrowser Because we used .NET 3.0, we have to put WebBrowser in WindowsFormsHost, and it can't show if we set the window property AllowTransparency to true. Now, on Windows XP, when the user clicks the Shutdown button on the Start menu, a dialog is displayed with various choices (shutdown, restart, etc.) while behind it the entire desktop appears to fade from color to shades of gray. When this occurs, our main window becomes hidden, while the page window is still displayed on the screen. We have already set page window's owner to be the main window, but this did not help. Therefore, I have come to the conclusion that I must intercept the "fade to gray" event and... do something to mitigate this ugliness. So: does anyone know how I might allow my program to be notified prior to the fade to gray?

    Glad to discuss with you and best wishes.

    WPF csharp question dotnet wpf help

  • how to reduce CPU usage of WPF application?
    C CooperWu

    My WPF application used high CPU usage after about 30 minutes, then i break the application to find out what code spent high CPU usage, but i got nothing. Visual Studio 2008 can't display current running code, but i found this in "Call Stack" panel: [In a sleep, wait, or join] mscorlib.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) + 0x8f bytes System.dll!System.Net.TimerThread.ThreadProc() + 0x2f9 bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes what's this? what's matter with high CPU usage? and how to reduce the CPU usage? PS: I used Performance Profiling for WPF tool to found out which events or element take high CPU usage, then we found: Tick(TimeManager.Tick()) was take about 40% CPU usage of app. which events will call TimeManager.Tick? how to reduce it? – Cooper.Wu 5 secs ago

    Glad to discuss with you and best wishes.

    WPF csharp performance visual-studio wpf data-structures

  • Force a WPF control to refresh?
    C CooperWu

    We have two textBlock like this: (we used .NET FW 3.0) <TextBlock Grid.Column="0" Name="tabName" Style="{StaticResource textBlockBarStyle}" HorizontalAlignment="Left"> <TextBlock.Margin> <Binding Converter="{StaticResource dpiConverter}"> <Binding.ConverterParameter> <Thickness Left="3" Top="6" Right="0" Bottom="0"/> </Binding.ConverterParameter> </Binding> </TextBlock.Margin> </TextBlock> and <TextBox x:Name="txtBoxHelp" IsReadOnly="True" Style="{DynamicResource txtBoxHelpStyle}" IsTabStop="False" Text="some text" MouseLeftButtonDown="txtBoxHelp_MouseLeftButtonDown"> <TextBox.Margin> <Binding Converter="{StaticResource dpiConverter}"> <Binding.ConverterParameter> <Thickness Left="7" Top="0" Right="0" Bottom="0"/> </Binding.ConverterParameter> </Binding> </TextBox.Margin> </TextBox> these two textBlock work well on others OS, but sometimes miss on the Windows XP Home Version with SP3. we have tried many ways to refresh these, but failed. we tried: 1, UpdateLayout 2, InvalidateVisual 3, changed the set Text property in code to binding mode. how to force these controls to refresh?

    Glad to discuss with you and best wishes.

    WPF csharp wpf css wcf tutorial

  • How to capture the Windows XP backgournd to gray? (.NET Framework 3.0)
    C CooperWu

    We have an application developed in C# with WPF(.NET Framework 3.0) A main window with glass border, and a child window contains WebBrowser puts on main window center. -------------------------------------------------------------- WPF main window-> Child window-> frame control -> Page -> WindowsFormsHost -> WebBroswer -------------------------------------------------------------- because we used .NET FW 3.0, so we have to puts WebBrowser in WindowsFormsHost, and it can't show if we set the window AllowTransparency to true. when user click 'start menu/shutdown', then Windows XP background fade to gray, then we saw, the main window hide, but page window still display on the screen. we have already set page window's owner to main window. it still have this issue. so, i want to know, how to capture the Windows XP background fade to gray event?

    Glad to discuss with you and best wishes.

    C# csharp dotnet wpf help tutorial

  • how to read a file content, that file was already opened ?
    C CooperWu

    thanks, i fixed it with your help. i debug the code very carefully, find the exception was throw by next sentence. StreamReader reader = new StreamReader(fileStream); but not new FileStream(), so i changed StreamReader to fileStream.GetByte(..) then it works. :rose::rose::rose:

    Glad to discuss with you and best wishes.

    C# tutorial question

  • how to read a file content, that file was already opened ?
    C CooperWu

    Sorry for my mistake, i create a test project like the first message, and it works. but in my real project, it always throw the exception... I wrote a singleton mode class, Logger class, to write log to file. This logger class has 'LogLevel' property, the actions like in log4net. then, i wrote a unit test class to test its LogLevel property setting will work. ... I use the first FileStream in Logger class, then I use the second FileStream in Logger Unit Test class, to check log message is corrent. ... the second FileStream always throw that exception. :(

    Glad to discuss with you and best wishes.

    C# tutorial question

  • how to read a file content, that file was already opened ?
    C CooperWu

    thanks for your reply, i have tried this, throw the same exception. i nearly tried all 'FileAccess', 'FileShare' combination :(

    Glad to discuss with you and best wishes.

    C# tutorial question

  • how to read a file content, that file was already opened ?
    C CooperWu

    I try these code, but doesn't work, string file = @"e:\test.log"; FileStream fs1 = new FileStream(file, FileMode.Append, FileAccess.Write, FileShare.Read); FileStream fs2 = new FileStream(file, FileMode.Open, FileAccess.Read); throw an exception: System.IO.IOException: The process cannot access the file 'e:\test.log' because it is being used by another process.. how to solve this?

    Glad to discuss with you and best wishes.

    C# tutorial question

  • How to get "frequency of use" information in "Add or Remove Programs" window?
    C CooperWu

    We need frequency information like "frequency of use" information in "Add or Remove Programs", I find a article about this at http://blogs.msdn.com/oldnewthing/archive/2004/07/09/178342.aspx[^]

    System Admin com tutorial question

  • GetPrivateProfileString does not work in WPF
    C CooperWu

    Pete O'Hanlon wrote:

    If it works in a unit test, there's no reason it shouldn't work in WPF.

    Agree with you, but it true, it happened.

    Pete O'Hanlon wrote:

    You should look to use either the registry or a config file for your settings.

    I intend to write my classes to read\write ini file. I prefer to ini files than xml file as config file.

    Glad to discuss with you and best wishes.

    WPF csharp sharepoint wpf testing json

  • GetPrivateProfileString does not work in WPF
    C CooperWu

    I wrapped a class to call win32 api functions, use GetPrivateProfileString to get values in ini file. it works in Unit Test, but does not work called in WPF window. My project based on .NET FW 3.0, without any SP. anyone know how to solve this?

    Glad to discuss with you and best wishes.

    WPF csharp sharepoint wpf testing json

  • How the UpdateProgress controls should not fire when the list index is -1?
    C CooperWu

    It seems NO, you can set 'Loading' text to 'UpdateProgress'. it will display 'Loading' when the page is loading... check out this

    ASP.NET database sysadmin help question announcement

  • Creating a ActiveX control
    C CooperWu

    Yes, if the ActiveX based on .NET Framework. you should use ATL if you want to clients access normal without .Net Framework

    Glad to discuss with you and best wishes.

    ASP.NET csharp dotnet com question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups