How to implement this using Windows forms? - vb.net

I have two problems with my windows form in Visual Basic .NET 2008. If you have worked with sticky notes you will understand me better.
Now my problems:
If you look you'll see the background color of number 1 and 2 are
diffrent but both belongs to the same control. How is this possible?
In right bottom corner, there is something by which a user can resize the form.
How I can do this?

Item 1: I think you are referring to LinearGradient Brush-- look in the System.Drawing.Drawing2D class.
Item 2: They are drawing a resize handler. You can try using the ControlPaint.DrawSizeGrip method or draw your own.
Update:
Per your comments, you can look into Owner-drawing a Windows.Forms TextBox

You can draw a gradient background by overriding OnPaintBackground():
protected override void OnPaintBackground(PaintEventArgs e)
{
// set these to whatever you want
Color color1 = Color.LightBlue;
Color color2 = Color.DarkBlue;
using (Brush backbrush =
new LinearGradientBrush(e.ClipRectangle, color1, color2,
LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(backbrush, e.ClipRectangle);
}
}
You can show the size gripper by setting the form's SizeGripStyle to Show:
SizeGripStyle = SizeGripStyle.Show;
Or just set it in the designer.
EDIT: Look at this page for creating a transparent textbox (if the textbox is transparent, the gradient form background will show through.)

Related

Remove/make transparent some parts of the form from vb .net form

I was trying to create a form in which some of the parts are transparent i.e I can click or use the form that is open behind the current form.
I have heard of transparency key as a way to do it but couldn't figure out a way to do it.
Me.TransparencyKey = Color.Transparent
When using TransparencyKey you have to state the part of the background color that you want to make transparent.
For example:-
Me.BackColor = Color.Green;
Me.TransparencyKey = Color.Green;
this will make all the visible portions of form that are green completely transparent

Opacity of Panel over Awesomium WebControl

I've got a normal Winforms Panel, but under it, I've sent a (Awesomium) WebControl form to the back, and was wondering if it's possible to make the panel transparent to reveal the colors of the webpage basically, but simple solutions such as
Panel1.BackColor = FromARGB(0,0,0,0) (Or any other color)
make the backcolor the same as the Form's backcolor (Goes right through the WebControl). Is there any workaround? My original intent was to see if the panel could display the color under of the webpage, rather than the Form's backcolor.
Look, you have not explained your problem properly, so I can't tell exactly what problem you are getting.
Panel's color is by default transparent but for your convenience you can set the background as transparent.
Here is the code:
Panel1.BackColor = Color.Transparent
Or, if your form's backcolor is a plain color, you can try the following:
Panel1.BackColor = Form1.BackColor
Hope it works perfectly!

Not able to set the Backcolor of label as Transparent

Using properties of "label" not able to set the backcolor as transparent ... when i select the color transparent from the option which is showing some color as backcolor, if transparent works properly must show background instead of some colors. please help
If you add a control at design time when setting the background to transparent it 'displays' the background of the form not the control on which it was placed unless that control is a container such as a panel.
2 options:
1 place the label on a panel and the label then displays the panel background (which can be a picture if that is what you are trying to do)
2 place the label programatically i.e.
dim Label1 As New Label
Control.Controls.Add(Label1)
Label1.BackColor = Color.Transparent

PySide: Resizable scene in QGraphicsView

I'm trying to find a way to mark the border of a QGraphicsScene, and make it resizable inside a QGraphicsView, to create something similar to Microsoft Paint.
In other words, my current QGraphicsView looks like this:
But my image is only this big, as indicated by the red box:
I want my QGraphicsView to be like this (the little black boxes are cornergrabbers for resizing the canvas):
Functionally, I want it to be similar to MS Paint:
The canvas (scene) is resizable, and the scrollbars on the window (view) appear when needed. The blue background color (solid gray background) appears behind the canvas.
How would I go about accomplishing this?
To try to get the grey background, I've been experimenting with QGraphicsView.setBackgroundBrush() and QGraphicsScene.setBackgroundBrush(). I've learned that QGraphicsView's background brush completely overrides QGraphicsScene's background brush if one is set. Even if I only set the background brush for QGraphicsScene, that background brush extends over the image's original boundaries.
Here is a link to my test code.
Help is appreciated!
I have to struggle with your constructors...dunno if it works on Windows, but have to make it to work with Linux. Try :
def setPixmap(self, pixmap):
if self.pixmap_item:
self.removeItem(self.pixmap_item)
self.pixmap_item = self.addPixmap(pixmap)
self.setPixBackGround()
def setPixBackGround(self):
# put Background rect for image
pixR = self.pixmap_item.pixmap().rect()
bgRectangle = self.addRect(pixR.x()-10, pixR.y()-10,
pixR.width()+20, pixR.height()+20)
# set color and Z value to put it behind image
bgColor = QColor(58, 176, 176)
bgRectangle.setBrush(bgColor)
bgRectangle.setZValue(-.1)
# take coordinates for brabbers
bgR = bgRectangle.rect()
grab1R = QRect(-5,-5,10,10)
# put grabbers as wish...
grab1 = self.addRect(grab1R)
grab1.setPos(bgR.topLeft())
grab2 = self.addRect(grab1R)
grab2.setPos(bgR.topRight())
# ....etc....

monotouch dialog cell sizing and section caption color

I am using monotouch dialog to generate a view. I managed to change the background color by subclassing DialogViewController, but the contrast with the section caption makes the text hard to read. How do I change the section caption color?
I am also using a StyledStringElement as a button in the same view. I cant seem to figure out how to shrink this element so that it looks more like a button. Please provide examples. Your help is appreciated.
To solve this issue I used a glassbutton with the it's HandleTapped handler as below.
var butt = new GlassButton(new RectangleF(80,150,150,50))
{
Font = UIFont.BoldSystemFontOfSize(22),
NormalColor = UIColor.Red,
};
void HandleTapped (GlassButton obj)
{
}
as for the colors, I used miguel's solution here. Hope this helps someone down the road.