I am new to interface design and I would like to have my own custom software interface. I using C#.net either windows form or wpf.
Let's say I have a background image (the whole interface design), can I detect a certain mouse click event on only a certain area of the background? Like say the "login" button which I drew on background (Not a button control from the framework) so that I make it function like a button.
Or I have to do the background design separately and make the "login" button drawing a picture box control and creating events from there?
Like this ..
There's form with background image + button image in picturebox (transparent backcolor)
Test with mousehover on the button image
Private Sub PictureBox1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseHover
MsgBox("hi")
End Sub
Related
I want to draw my own TabControl with a different style. I have a TabControl in my form for which i have appended the event handler,
MainTabControl.DrawMode = TabDrawMode.OwnerDrawFixed
AddHandler MainTabControl.DrawItem, AddressOf TabControlPaint
TabControlPaint() is a method where i paint my own graphics using Bitmaps amd Buffer variables. (see here)
I'm not inheriting from TabControl because my Application has many forms and windows and that would force me to go to each form and change the TabControl for my CustomTabControl. I would like to be able to draw my own tabs overwriting the DrawItem event.
I came up with this result Screenshot, where you can see the red border, a different background color for the tabs, even different color schemes for a tab went selected.
What i can't figure out is to erase that white 3D border that appears only on the selected tab. I'm guessing is drawn on top when the OnPaint() method is called after the drawItem event (correct me if i'm wrong). If i debug, that white 3D border appears after the method TabControlPaint (the one i'm calling for the DrawItem event) has finished execution.
To make the question more clear, i want to design my own TabControl without overwriting the OnPaint method. What i have come up so far was not succesfull just because of that windows drawn border. Is there a way to take it off? Or do you know any alternatives?
I managed to solve the problem by,
For Each page As TabPage In MainTabControl.TabPages
AddHandler page.Paint, AddressOf test
Next
then in my test function i draw whatever i want. In this case i just drew a rectangle. It is not efficient but i think it can be improved by double buffering.
Private Sub test(ByVal sender As System.Object, ByVal e As PaintEventArgs)
Dim ScreenGraphic As Graphics = Graphics.FromHwnd(MainTabControl.Handle)
Dim myRect As Rectangle = MainTabControl.GetTabRect(MainTabControl.SelectedIndex)
Dim borderColor As Pen = New Pen(Color.FromArgb(42, 38, 37), 5)
myRect.X -= 1
myRect.Y -= 1
ScreenGraphic.DrawRectangle(borderColor, myRect)
End Sub
I'm working with VB6.
I have several forms and i need open a form. This form have a UserControl.
My problem is setfocus in a element of UserControl inside this form.
Sub Form_Activate()
Ctrl_User.MyTextbox.SetFocus
End Sub
but don't run
How i can do it??
Thanks
Have you tried this:
Sub Form_Activate()
Ctrl_User.Enabled = True
Ctrl_User.MyTextbox.SetFocus
End Sub
Also maybe you may need to review this here as well it may help you more:
If you're authoring a user-drawn control, there won't be any
constituent controls on your UserControl. If you don't want your
control to be able to receive the focus, set the CanGetFocus property
of the UserControl object to False. CanGetFocus is True by default.
If your user-drawn control can receive the focus, the UserControl
object will receive GotFocus and LostFocus events when your control
receives and loses the focus. A user-drawn control is responsible for
drawing its own focus rectangle when it has the focus, as described in
"User-Drawn Controls," in this chapter.
This is the only function your UserControl's GotFocus and LostFocus
events need to fulfill for a user-drawn control. You don't need to
raise GotFocus or LostFocus events for the user of your control,
because the container's extender provides these events if the
CanGetFocus property is True.
https://msdn.microsoft.com/en-us/library/aa241743(v=vs.60).aspx
I have created a custom (themed) NSWindow, by creating a borderless window and then recreating all elements of the window border/background inside the content view. I've created the window widgets (close box, zoom box, minimize box) on top of my own fake title bar using -standardWindowButton:forStyleMask:.
Trouble is, when a sheet is presented on top of my custom window (e.g. "save changes...", those buttons do not receive the clicks.
Does anybody know how I can tell NSWindow not to intercept the clicks in my minimize box? It works with a standard NSWindow. When a sheet is up, I can still send both of them to the dock, or zoom the window out.
I thought maybe there's special code in the content view that ignores clicks in subviews while a sheet is up. But it seems as if -hitTest: is called on the content view and returns the minimize widget, but the widget's action never gets triggered.
I guess I could just replace the content view and perform the action in the content view's hitTest if it is the minimize widget ... but that seems a bit ugly.
Can I animate the HorizontalFieldManager in Blackberry?
I have a button in the bottom bar of the screen, and there is an array of images which display in a horizontal layout above the button.
When I click on the button, there should be a slide-in slide-out effect and the images appear one after the other.
Can anyone suggest me any tutorial or link for this?
I think the working approach will be in implementing your own custom bitmap field and placing it above the button, you want to press. When button is pressed, then intercept this event and update contents of your custom bitmap field.
Here is an example, how to create a custom field with RIM SDK.
I am using the webbrowser to show some string with a appbar-button. When I click the button, the webbrowser will NavigateTo another string. Everything goes well except that once the webbrowser is scrolled down(When the user is reading the end of a article), when the button clicked, the webbrowser is still at the bottom, the user has to scroll the webbrowser up.
So, before the new article is loaded, I want to set the verticaloffset of the webbrowser to zero. But there is no scrollviewer in the webbrowser, so I can't use the ScrollToVerticalOffset method.
would anyone know how to Control the VerticalOffset of a webbrowser?
Thanks.
You can do this via InvokeScript, which allows you to invoke JavaScript within your page. If you add the following JavaScript function:
function setVerticalScrollPosition(position) {
document.body.scrollTop = position;
}
Then invoke the following (C#)
this.webBrowser.InvokeScript("setVerticalScrollPosition", this.vScrollPos.Text);
Your browser control should scroll (courtesy of this blog post)