I am experimenting with the WPF RichTextBox and it shows some text in my application. I notice that When I select some text in that RichTextBox, the selected text gets distorted and the text below to that also gets distorted as shown below.
After I deselect that and scroll it comes back to normal.Is there anyway to avoid this distortion?
Now I solved this problem by myself. I just added the following single line of code in my application and make it works. We need to disable hardware acceleration in screen settings using this.
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
This helped me a lot to fix my issue and it works for me.
Related
I'm trying to enable the IME in WPF... which works for some textboxes but not the one I actually need it for. I do the following in XAML
InputMethod.IsInputMethodEnabled="True" InputMethod.PreferredImeConversionMode="Native" InputMethod.PreferredImeState="On"
I have a custom on-screen keyboard, the textbox has focus, and keys can be pushed on the screen and send the appropriate letter to the textbox. But when setting this above xaml to the textbox in this custom keyboard, the candidate window doesn't display at all, instead a strange small black control appears on the top left of the screen with a text box and a green arrow which has a caption of "Enter". Any text pressed on the keyboard goes to that small black control without showing the text, but after pressing enter, that text appears in my keyboard.
Ultimately I'm trying to incorporate simplified Chinese. Again, this works perfect on every other textbox but the one I actually need it for, being the custom onscreen keyboard.
Any thoughts? I'm really stuck with this.
Cheers.
UPDATE
This is the image I see, don't scroll down, it's the black little control with the green arrow.
http://babelstone.blogspot.ca/2010/05/prototyping-tangut-imes-or-why-windows.html
So I've been looking for a different design of the IME, Notepad seems to show something different. But I eventually got the little black box control to work and display what I'm actually typing. Moved xaml to code behind and it started working.
I am new to winforms and I want to keep things simple
When I create a message box: I notice the top half is white background while the lower half is grey (!!!)
(what I really want is all background white).
But even the VisualStudio dialog doesn't behave this way
Can someone please help me?
Do I need to write some custom code ?
I would post the image but not allowed;(
Thanks
MessageBoxes are displayed by the operating system. If the options that are available aren't good enough, then you have to make your own form.
Alright, try as I might, I cannot for the life of me get rid of this tiny little border around my buttons.
Edit: I should mention, in case I didn't make it clear, these are buttons with an image on them, set to flat with the button sized to the image.
Images below:
Number one, I can't for the life of me get these borders to GO AWAY. I've checked everything I can think of. They're:
flat
border 0
no margins
no padding
manually sized to the size of the image (75px)
in a table layout where the columns are all:
manually sized to the width of the image (75px)
borderless
Nothing seems to really "work" to get rid of these. If I size the columns down to be 74px instead of 75px, most of them go away, but a few remain. I've triple and quadruple checked the images, and they don't have anything that I can pick up on that should be causing this... no transparency around the borders, definitely no border that looks like that.
Which leads me to the second problem:
Settings button when dialog is small...
Settings button when dialog is stretched out.
Settings button is also in the same table layout panel.
I've checked all the settings on the table layout panel as well.. I can't find any padding or margin or anything settings that suggest this should be happening.
Does anyone have any experience with this? What am I missing..?
Simple solution: using directly a PictureBox as if it was a button. You can change your image on mouse over or mouse click.
Have you tried a Toolbar/strip/whatever it's called these days? Probably not going to help as I believe it pads on your behalf, but worth a shot.
In the end you can toss the buttons in the trash and write your own control. A single control that manages N buttons will work well here.
I don't understand your second problem. What's the problem? It'll be fixed if you roll your own control anyhow.
While not a fix for the spacing issue, as a workaround you can make that gray gradient currently "behind" the "tabs" and control panel image into a BackgroundImage for the TableLayoutPanel using BackgroundImageLayout of Stretch. While not fixing the spacing issue, it would make it unnoticeable.
Writing a winforms control has its challenges (experience speaking here). I would agree that that is whats needed however. Depending on your project you may consider using XAML and WPF. It provides that fine detail you seem to be looking for in you application.
There are ways to host XAML controls in a winform app, but if you went this route it would be best to create a native WPF application. The reverse is also true (winform controls in a WPF app).
Did you check if the image has transparent pixels around the graphic pixels you want?
May be a simple crop solution.
Ive been googling this alot but can't find any working solution. Im using Shell Integration Library to cerate custom Window Chrome and I also need drop shadows for this window. Some say setting GlassFrameThickness to -1 do the trick but its not working for me. And Jeremiah Morrill suggested using DwmExtendFrameIntoClientArea. Ive tried that and it works, sort of. The shadows looks ok but when the window is shown it is first shown as a glass-frame and then a second later the real content is superimposed. This causes to much flickering for me. Is there any way to get rid of this flickering or is there any better way using only Shell Integration Library?
I had a similar problem where it wouldn't display any shadow when using a custom chrome. It worked fine when using the glass.
I got a shadow by setting GlassFrameThickness="0,0,0,1". The glass didn't show and I got the shadow.
Be warned, the shadow is a simple RECT to Windows, so if you have a funky chrome with transparencies it may look funny.
Also if you support the maximized state be aware the you'll need to set a margin on your top-level panel element of "8,8,8,8" when in maximized mode. All other modes should be "0,0,0,0".
To alimbada, the WindowStyle defaults to None on custom chrome.
The Shell Integration Library uses DwmExtendFrameIntoClientArea, plus handling of several Window messages to get the effects. If you're using the full window rect (i.e. no rounded corners) then setting it to (0,0,0,1) as suggested will give you the drop shadows as you want. If you want to simulate the rounded corners of Aero, then setting it to (8,8,8,8) will extend the glass frame enough that the corners also stay rounded, and then you're responsible for not drawing over the corners of the rectangle. The shape of the drop shadow doesn't change regardless of the glass frame thickness.
The flashing you're seeing when setting the thickness to -1 still exists even when not fully extending the glass frame. What's happening is the window is getting shown while the content is still compositing. What you can do is simplify the default UI so it displays quicker (or you can stage it, bringing in a simnple background first and then replacing it with something usable), or you can create and show the window off-screen, and then move it to the desired start location once the content has been rendered. The easy way to detect when it's probably ready is to invoke a DispatchTimer with Priority=Loaded. That should only get invoked once the basic first layout has been completed.
I have a WPF Frame with a web-based HTML source and though the contents are there, they aren't showing up. I know that the content is there because if I right click in just the right spot I can save images. Also, if I do print preview it shows just fine. The stuff is there, but it isn't showing up. Is there a known bug?
I used code from here to create a placeholder control with a window that floats right above it, so I could put the frame in the window. Its a hack but it works... sigh.