PDA

View Full Version : سوال: تغییر اندازه فرم در هنگام اجرای نرم افزار



hamid685
دوشنبه 14 بهمن 1392, 17:20 عصر
سلام
ی مشکل دارم هرکی میتونه راهنمای کنه ممنون میشم:قلب:
یک اسکین ساختم برای فرم برنامم که dll هس
اندازش ثابته نمیشه مثل فرم های خود ویندوز اندازشو تغییر داد واسه تغییر اندازش باید تو dll تغییر ایجاد کنم

ایا راهی هست که بشه اندازه این اسکینی ک ساختم رو مثل فرم های معمولی ویندوز تغییر داد؟ مثل فرم های دیگه که با درگ کردن میشه اندازشونو تغییر داد‎

امیدوارم منظورمو درست رسونده باشم:لبخند:

اینم سورس dll مربوط به اسکین


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace WindowsFormsApplication28
{

public partial class MyForm : Form
{

public MyForm()
{


this.Paint += new PaintEventHandler(MyForm_Paint);
this.Paint += new PaintEventHandler(MyForm_Paint);
this.MouseMove += new MouseEventHandler(MyForm_MouseMove);
this.MouseDown += new MouseEventHandler(MyForm_MouseDown);
this.MouseUp += new MouseEventHandler(MyForm_MouseUp);
this.FormBorderStyle = FormBorderStyle.None;

}
void MyForm_Paint(object sender, PaintEventArgs e)
{

Point p = new Point(0, 0);
Size s = new Size(395, 40);
Rectangle Rect = new Rectangle(p, s);
Pen pen = new Pen(Brushes.Aqua);


Color Color1 = Color.FromArgb(36, 36, 36), Color2 = Color.FromArgb(125, 125, 125);
LinearGradientBrush Br = new LinearGradientBrush(Rect, Color1, Color2, LinearGradientMode.Vertical);
e.Graphics.FillRectangle(Br, Rect);


p.Y += s.Height;
s.Height = 10; Rectangle Rect2 = new Rectangle(p, s);
LinearGradientBrush Br2 = new LinearGradientBrush(Rect2, Color1, this.BackColor, LinearGradientMode.Vertical);
e.Graphics.FillRectangle(Br2, Rect2);



Rectangle RectBorder = new Rectangle(0, -2, this.Width - 2, this.Height - 0);
e.Graphics.DrawRectangle(new Pen(Brushes.DimGray, 2), RectBorder);


Point h = new Point(0, 40);
Size d = new Size(395, 300);
Rectangle rect = new Rectangle(h, d);
Pen penc = new Pen(Brushes.Aqua);
Color Color3 = Color.FromArgb(36, 36, 36), Color4 = Color.FromArgb(125, 125, 125);
LinearGradientBrush hr = new LinearGradientBrush(rect, Color3, Color4, LinearGradientMode.Vertical);
e.Graphics.FillRectangle(hr, rect);

}



private void button1_Click(object sender, EventArgs e)
{

}

private void label1_Click(object sender, EventArgs e)
{
Application.Exit();
}
bool mousemove = false;
int mousex, mousey, titlebar0 = 50;
private void MyForm_MouseUp(object sender, MouseEventArgs e)
{
mousemove = false;
}

private void MyForm_MouseMove(object sender, MouseEventArgs e)
{
if (mousemove == true)
{
this.Left += e.X - mousex;
this.Top += e.Y - mousey;
}
}

private void MyForm_MouseDown(object sender, MouseEventArgs e)
{
if (e.Y <= titlebar0)
{
mousemove = true;
mousex = e.X;
mousey = e.Y;
}
}
}
}



لینک دانلود سورس برنامه‎ (http://qfs.mobi/f1171241)

hamid685
دوشنبه 14 بهمن 1392, 19:58 عصر
اساتید کمک نمیکنن؟

hamid685
سه شنبه 15 بهمن 1392, 05:24 صبح
دوستانی که میتونن خواهش میکنم راهنمای کنن. کارم گیره