I am having an issue with SystemTray.
My app has Panorama and Pivot screens. So i wish to make SystemTray invisible on both screens.
My code was:
<phone:PhoneApplicationPage shell:SystemTray.IsVisible="False"
The headache mostly was because tray reappears after gesture is received like flick or any other actions
I have made the following changes also:
shell:SystemTray.Opacity="0"
shell:SystemTray.ForegroundColor="Transparent"
shell:SystemTray.IsVisible="True"
It became worse. Tray became visible and with White color in spite of setting it as Transparent.
Regards.
Try setting visibilty in the code behind using
SystemTray.IsVisible = false;
If it doesn't work, in the constructor of the page or in the OnNavigatedTo function try the following line of code
SystemTray.SetForegroundColor(this, (Color)App.Current.Resources["PhoneBackgroundColor"]);
(Color)App.Current.Resources["PhoneBackgroundColor"] will set the foreground color as backgroud giving it a transparent effect.
**Will only work if you haven't manually added any custom background.
Let me know if it doesn't work.
try to delete shell:SystemTray.IsVisible="False" from the top of you xaml page. Then try it.
If this not works, then use the code behind on the main page loading event like SystemTray.IsVisible = false;
The visibility of the SystemTray needs to be set this way in the code behind per MSDN.
SystemTray.SetIsVisible(this, false);
Alternatively, if you just want to simulate the same "invisible" effect, set the opacity to 0 to hide most of the bar and the foreground color to transparent to hide the time. The one caveat is that the rest of your controls will still know it is there, so you'll need to adjust the top margin of at least the first control on the page up by 32 pixels (ie Margin="0,-32,0,0) in order to finish off producing the exact same effect as setting it to false in the XAML.
SystemTray.SetOpacity(this, 0);
SystemTray.SetForegroundColor(this, Color.FromArgb(0, 0, 0, 0));
Related
Context
I have a window with a fullSizeContentView and a transparent titlebar and hidden titlebar.
I don’t even want the titlebar, but I had to enable it to get rounded corners on the NSWindow.
Problem
An NSTextView, when placed near the top edge, doesn’t react to any clicks. It doesn‘t let me select any text, and doesn’t let me click links I added via NSAttributedString.
This issue disappears when I disable the titlebar altogether.
Any Help would be greatly appreciated. Thanks!
Big Context
I’m trying to implement little “in-app notifications” that show peripheral status updates. I considered using NSAlert but I don’t want to prevent the user from interacting with the rest of the interface while the notifications are showing, so I decided to implement it myself.
The notifications are little, non-movable windows without a titlebar. They are basically just grey rectangles with rounded corners and a shadow that draw inside the main application window and contain one or a few lines of text. The first line of text is almost entirely behind the invisible titlebar which is why I’m having issues.
The only thing I need the notifications to do besides display text is link to webpages that contain more info about a notification’s message.
I feel like I might be approaching this wrong. If you have any suggestions or ideas on how to solve the problem, I’m eager to hear them. Thanks!
I finally figured it out!
I nailed it down to the contentInsets of the NSScrollView. (which your are for some reason forced to have around your NSTextView when creating it in Interface Builder)
The contentInsets were automatically being set to account for the invisible titlebar, even though the docs say that NSScrollView - automaticallyAdjustsContentInsets (which is set to YES by default and which I assume was causing this) doesn't do automatic insets for transparent titlebars.
After programmatically setting the scrollView's contentInsets to 0, everything works great!
In Objective C, you can set your scrollView's contentInsets to 0 like this:
NSScrollView *scrollView = (NSScrollView *)self.textView.superview.superview;
scrollView.automaticallyAdjustsContentInsets = NO; // Doesn't remove insets // Probably calling this too late
scrollView.contentInsets = NSEdgeInsetsMake(0, 0, 0, 0);
Here's a working example.
Hope this helps!
I've created 2 buttons:
<Button title="TEST"></Button>
<Button title="TEST" backgroundColor="red"></Button>
The first is a really simple default button. And the second I just added a red background color. The result is this:
As you can see from the picture, just adding a different background color changes the button a lot from it's "native" appearance. What I would expect is that the button will remain the same, just with a red background.
The "styled" button is bigger (and as you can see I did not set up any dimensions).
The "styled" button corners are no longer round.
Most bothering - the "styled" button no longer has the android button ripple effect upon clicking.
Why is that? Can it be fixed?
The native button (AppCompatButton) is a bit more complex and is not using the backgroundColor to show the actual color. I think it is using a 9-patch in the background so if you set a backgroundColor it will remove that and you end up with the box and the color.
Try using the tintColor to change the background color or you can fake it using:
borderRadius
elevation
touchFeedback
touchFeedbackColor
I need to set the background color of a window sizing gripper control, which we're doing with:
DrawFrameControl(hdc, &rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
It doesn't appear to get any of the WM_CTLCOLOR* messages. I tried filling the window in WM_ERASEBKGND and returning TRUE, but that doesn't work.
I can paint it myself, but it seems like this would be unnecessary to just change the BG color.
Any ideas?
My Windows Application in VB 6 is having a form that contains hell lot of controls. And if the screen size at client's environment is smaller, most of the controls do not appear.
What I want to do is to provide users a vertical and horizontal scrollbar so that user can scroll across all controls.
Anyone having any idea of how to implement this?
P.S. Please do not provide examples showing just labels to display scroll value :)
I like David's answer, but if you want to do this with the scrollbars, first, you need to put all of your controls into a frame that fits them. You want to move 1 control not a "hell of a lot of controls". Second put your scroll bars into the form and in the Form_Resize event add some code to resize the scroll bars with the form. After resizing the scrollbar you need to do some math to set the Max, SmallChange, and LargeChange properties. I am showing the Min property just so you know it never changes, just set it in the designer. This example uses only a horizontal scrollbar because I am too lazy to include a vertical scrollbar too. Finally, add code to the scrollbar Change event to move the frame around.
Private Sub Form_Resize()
HScroll1.Move 0, Me.ScaleHeight - HScroll1.Height, Me.ScaleWidth
HScroll1.Min = 0
HScroll1.Max = Frame1.Width - Me.ScaleWidth
HScroll1.SmallChange = HScroll1.Max / 100
HScroll1.LargeChange = HScroll1.Max / 10
End Sub
Private Sub HScroll1_Change()
Frame1.Left = -HScroll1.Value
DoEvents ' this is not strictly necessary, but smooths the scolling some
End Sub
You also need error handling code. I am a lazy example coder.
One way is to turn on the scroll bars of your form using Windows API calls. This is different from using ScrollBar controls; turning on the form's own scroll bars keeps the scroll bars from interfering with the tab order, for example.
Here is a good page explaining how to do this, along with a helper class:
http://www.vbaccelerator.com/home/VB/Code/Libraries/Subclassing/Adding_Scroll_Bars_To_Forms__PictureBoxes_and_UserControls/article.asp
I have an MFC dialog (actual a dialog bar with in a dialog) that contains a progress bar with these strange black pixels in the corner. I have tried the following to remove them:
Change most of the border type styles and the transparent style of the control.
Override the OnEraseBkgnd in a class derived a CProgressCtrl.
Setting the background color of the control by PBM_SETBKCOLOR.
I have yet to find a way to remove these black pixel.
Here is an example of what it looks like:
It seems I have found the issue. When the progress bar performs its painting it was sending an WM_ERASEBKGND message to the dialog to get the background with which it would paint. Some how the DC brush origin was being messed up. Using the following code at the start of the function seems to have fixed the issue with no ill effects.
CRect rcClip;
pDC->GetClipBox(rcClip);
pDC->SetBrushOrg(-rcClip.left, -rcClip.top);
I've seen this occur when using ActiveX controls inside control containers that don't have a a window or proper Device Contexts (The VB6 frame control is one of these) but I'm not sure if the same problem applies to MFC windows and controls though.
Try making the control parent a normal static window.